I am new to PIC programming, and I am trying to blink an LED using the PIC10F206. It has 4 I/O pins. I understand I must declare them as inputs or outputs, but the IDE I am using (MPLAB) keeps giving me an error when I declare the TRIS register. Attached is a picture.
The datasheet lists the TRIS GPIO register as having the name "TRISGPIO" but the compiler throws this error: "Unable to resolve identifier TRISGPIO".
Am I just getting the name of the TRIS register wrong? Attached is a picture of the TRIS GPIO register from the datasheet.
[EDIT]
Looks like it is a header file problem. When I highlight "xc.h", right click, and go to navigate -> go to definition, the xc.h file is pulled up but the code does not recognize my pic.h file which is where the header file for my chip is. See imagae for the xc.h screenshot.
I tried pointing to the directory in the compiler options but no luck. Any thoughts? Below is a picture of my compiler options
Best Answer
You are using a baseline PIC, so you can refer to the XC8 compiler User's Guide section 5.3.10:
You will find the following definition in the relevant .h file for this chip:
Which indeed contains the aforementioned __control qualifier. However it also defines TRISGPIO! And I tried a simple program and it does work if xc.h (which loads PIC10F206.h) is included, for either TRIS or TRISGPIO (MPLAB-X , XC8 V2.10).
You also have error markers beside your GPIO names, which implies your .h file is not being properly included or is missing something.
Edit: As @brhans mentions, make sure you've properly configured MPLAB-X for that exact chip. Your tree should look something like this:
If it's not properly configured it may be including the wrong file or nothing, I can't say as I've run into that issue myself.