CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Make .H files from .INC files?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Make .H files from .INC files?
PostPosted: Mon Feb 21, 2011 4:28 pm     Reply with quote

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
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Mon Feb 21, 2011 4:41 pm     Reply with quote

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!!!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 21, 2011 4:44 pm     Reply with quote

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.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

PostPosted: Wed Feb 23, 2011 8:37 am     Reply with quote

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
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Wed Feb 23, 2011 5:05 pm     Reply with quote

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!!!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group