View previous topic :: View next topic |
Author |
Message |
RLScott
Joined: 10 Jul 2007 Posts: 465
|
Make .H files from .INC files? |
Posted: Mon Feb 21, 2011 4:28 pm |
|
|
Does anyone know of a utility to make a SFR definition .H file out of a Microchip processor definition .INC file? I would like to access the SFRs using the Microchip register designations and I am tired of hand-composing them myself from the Microchip data sheet. (I've done it several times already!)
I remember a discussion here years ago about making your own SFR definition .H files, and as I recall, they are not supplied by CCS. Is that still true? I just updated to the latest PCM and I don't see anything along those lines. And no, I don't want to use the CCS library to talk to the SFRs for me. I have always done that myself, thank you. _________________ Robert Scott
Real-Time Specialties
Embedded Systems Consulting |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Mon Feb 21, 2011 4:41 pm |
|
|
In the Device Editor under Registers you will find the Make Include File
option that will make the SFR definition files. _________________ Google and Forum Search are some of your best tools!!!! |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Feb 21, 2011 4:44 pm |
|
|
Quote: | I just updated to the latest PCM
|
Do you have the PCM command line compiler or do you have the full IDE ?
If you have the CCS IDE, there is a button to make the SFR header files
for you:
http://www.ccsinfo.com/forum/viewtopic.php?t=40862&start=3
I don't have the full IDE.
If you don't have the IDE, maybe you could post the PIC that you want
an SFR header file for, and maybe some kind soul could make it and
send it to you in a PM. |
|
![](templates/subSilver/images/spacer.gif) |
RLScott
Joined: 10 Jul 2007 Posts: 465
|
|
Posted: Wed Feb 23, 2011 8:37 am |
|
|
PCM programmer wrote: | ..If you don't have the IDE, maybe you could post the PIC that you want an SFR header file for, and maybe some kind soul could make it and send it to you in a PM. |
And indeed a kind soul has already offered and done that. (Thanks, dyeatman.) I am using that header file now and it works great.
I do have some observations, though, about how these SFR headers are constructed. One is that there does not appear to be any definition of 16-bit registers composed of two 8-bit registers, such as TMR1, composed of TMR1L and TMR1H. Now there are some non-Microchip designations of some of these registers in the CCS device include file, such as CCP_1 standing for the 16-bit combination of CCPR1L and CCPR1H, but it would have been nice if the standard Microchip designations could have been used, such as:
Code: | #byte CCPR1L = 0x291
#byte CCPR1H = 0x292
#word CCPR1 = 0x291 |
instead of what the SFR header provides:
Code: | #byte CCPR1 = 0x291
#byte CCPR1H = 0x292 |
This leads to possible confusion where the user thinks he is referring to all 16 bits when he writes CCPR1, whereas he is only referring the low-order 8 bits. And TMR1 as a 16-bit register is missing entirely from both the standard device header and from the newly-generated SFR header. Of course it is easy enough to add your own:
Code: | #word TMR1 = getenv("SFR:TMR1L") |
But as I think about it more, maybe it is better not to have this definition since accessing a running 16-bit timer needs special high byte/low byte considerations. And having the definition just encourages misuse. _________________ Robert Scott
Real-Time Specialties
Embedded Systems Consulting |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Wed Feb 23, 2011 5:05 pm |
|
|
There is an option in the IDE ChipEdit tool to combine 16 bit registers and I
didn't know whether you wanted that. I will send you another with that done.
P.S. The file is in your inbox.
Dave _________________ Google and Forum Search are some of your best tools!!!! |
|
![](templates/subSilver/images/spacer.gif) |
|