View previous topic :: View next topic |
Author |
Message |
johnsonpay
Joined: 05 Oct 2018 Posts: 4
|
header file error |
Posted: Fri Oct 05, 2018 3:49 am |
|
|
Hi all,
I'm new in ccs c compiler I just create simple project for LED Blinking, when I change "_bif void set_tris_a(int8 value)"this code value to 0x0f, after compiler the 0x0f change back to value, I don't know why, please help |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Oct 05, 2018 4:10 am |
|
|
Er. You don't change the _bif defines. These are information to programs like MPLAB, to tell them the 'nature' of this internal function. Bif, stands for 'built in function'. The headers are normally read only anyway.
A basic typical program:
Code: |
#include <your_processor.h>
#fuses //will depend on what your chip needs. Data sheet.
#use delay(clock) //again will depend on your chip, so (internal=4MHz)
//is a typical example
#use rs232(UART1, baud=9600, ERRORS) //sets up RS232 if needed
#include <stdlib.h>
#include <string.h> //Include whatever is needed
void main(void)
{
set_tris_a(0xf); //use the TRIS function
//However for 99% of programs you do not need to do this
//The compiler can control TRIS for you
output_high(PIN_A5);
//Typical compiler line to drive a pin. This actually sets TRISA.5 to 0
//and LATA.5 to 1
while (TRUE)
{
//some code.....
output_toggle(PIN_A5);
delay_ms(1);
}
}
|
Will result in about a 500Hz square wave on A5. |
|
|
johnsonpay
Joined: 05 Oct 2018 Posts: 4
|
|
Posted: Fri Oct 05, 2018 4:17 am |
|
|
Hi Ttelmah,
Thank you for your technical support. I follow you instruction, after compiling it jump to 16F628A.h this header file again, then show error. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Oct 05, 2018 4:26 am |
|
|
OK. So we now know you are using a PIC16F628A.
So you have as your first line:
#include <16F628a.h>
If it is showing an error on this, is the compiler properly installed? (it needs to know 'where' it's include files actually 'are'.
Does the file exist? (if you tried to edit it you may have done something to it...).
What version of the compiler are you using?. Actual version number, and what 'type' of compile (PCB, PCM, PCH or PCD).
You would get this for example if your compiler was PCH, and didn't include PCM (since the PIC16 requires PCM). |
|
|
johnsonpay
Joined: 05 Oct 2018 Posts: 4
|
|
Posted: Fri Oct 05, 2018 4:31 am |
|
|
Ttelmah wrote: | OK. So we now know you are using a PIC16F628A.
So you have as your first line:
#include <16F628a.h>
If it is showing an error on this, is the compiler properly installed? (it needs to know 'where' it's include files actually 'are'.
Does the file exist? (if you tried to edit it you may have done something to it...).
What version of the compiler are you using?. Actual version number, and what 'type' of compile (PCB, PCM, PCH or PCD).
You would get this for example if your compiler was PCH, and didn't include PCM (since the PIC16 requires PCM). |
Yah, I have include <16F628a.h> already
my compiler version is 5.015, compiler type is PCM 14bit |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Oct 05, 2018 6:24 am |
|
|
So you have the IDE, or the command line compiler?.
Is it installed in the standard location (Program Files\PICC)?.
Did you install this as the same user who is now trying to run it?. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Fri Oct 05, 2018 7:16 am |
|
|
Been going through similar things with a pair of new hires and our substandard IT support subcontractor.
- Ensure you're a local administrator. This is important.
- Uninstall the compiler.
- Reinstall the compiler, and ensure that you choose "run as administrator".
- DO NOT change or alter the compiler's include paths (leave blank) if you're using the IDE.
- DO NOT change or alter any of the compiler's built in header files. In my almost 17 years of using this compiler, it's never been necessary.
- Investigate disabling the "virtual store" feature of Windows 7. No idea what it's called for W10. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Oct 05, 2018 7:53 am |
|
|
Yes. You are thinking like me. I suspect the compiler has not got permissions to access it's own files, or their is a corrupted copy in the virtual store.... |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Fri Oct 05, 2018 8:48 am |
|
|
Been fighting this same issue with our IT subcontractor for over a month. They've been shown the door just this week primarily due to this.
CCS will throw cryptic errors if it's not installed or run by a user who has admin rights. Most common symptom is that a project that is absolutely fine (no errors) will throw a seemingly endless list of errors starting with the processor include file, which it will claim it cannot find. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Oct 05, 2018 11:10 am |
|
|
This is caused by Windows. MS decided a while ago that all directories in the 'Program files' directory would be read only, and owned by SYSTEM, not the installer. It causes issues for a lot of programs written before this was done.... |
|
|
johnsonpay
Joined: 05 Oct 2018 Posts: 4
|
|
Posted: Sun Oct 07, 2018 7:26 am |
|
|
Ttelmah wrote: | This is caused by Windows. MS decided a while ago that all directories in the 'Program files' directory would be read only, and owned by SYSTEM, not the installer. It causes issues for a lot of programs written before this was done.... |
Thanks for newguy and Ttelmah, I solve it already. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sun Oct 07, 2018 7:54 am |
|
|
Do you want to share 'how'? For other people in the future.
On my system the PICC directory is owned by me (was created years ago when I first installed CCS), and it has never given this issue. Newguy though has seen the same problem. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Sun Oct 07, 2018 8:24 am |
|
|
As long as the end user is a properly configured local administrator, then there are no issues. What our IT subcontractor was sneakily doing was creating two users with the same name: one with standard (very low) permissions, and the other a local admin. The system, of course, defaults to the user with very low permissions and a never ending stream of issues affects the end user and the one (me) attempting to troubleshoot issues he's never before seen.
On a related note, but as to exactly why I can't say because I don't want to get sued, everyone please watch your servers for evidence of cryptomining. Apparently it is the "du jour" preferred mechanism for criminals to get funds at the moment. Standard antivirus software doesn't detect most crypto programs at present. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sun Oct 07, 2018 2:09 pm |
|
|
Two users with the same name. Ouch.... |
|
|
|