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

How do I create a header file for the PIC16F1507?

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



Joined: 28 Mar 2012
Posts: 5
Location: Minnesota

View user's profile Send private message

How do I create a header file for the PIC16F1507?
PostPosted: Wed Mar 28, 2012 5:58 pm     Reply with quote

Hello everyone. Just joined here today. I also just recently bought the PCM compiler. It list the 16F1507 as not tested and the header file for it does not have any of the PWM functions included. I would like to make my own but I am not sure how to do this. I have never done it before. I'm sure that shows how green I am, but we all gotta start somewhere.

I'm sure I left out something needed so you can help. Please let me know.

Thank you for your help.

Steve
_________________
Never give up, just keep throwing more money at it..
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 28, 2012 6:20 pm     Reply with quote

What compiler version do you have ?

List of CCS compiler versions:
http://www.ccsinfo.com/devices.php?page=versioninfo
jeremiah



Joined: 20 Jul 2010
Posts: 1349

View user's profile Send private message

PostPosted: Wed Mar 28, 2012 6:43 pm     Reply with quote

I have 4.131 PCWHD and don't have any PWM values in the header file either. As far as how to do it yourself, look up the pertinent SFR address in the memory organization table and setup some variables.

For example:
Code:

#byte TMR2 = 0x01A
#byte PR2 = 0x01B
#byte PWM1DCL = 0x611
#byte PWM1DCH = 0x612
#byte PWM1CON0 = 0x613


That creates variables and maps them to the actual registers (assuming those addresses are correct). Normally, you can do a little shortcut for portability:
Code:

#byte TMR2 = getenv("SFR:TMR2")


But since your chip is untested, you might get the wrong values.

EDIT: you can also define specific bits:
Code:

#bit PWM1EN = PWM1CON0.7


Those will let you change individual bits if you need.

One you have those variables, you need to make a function and fill it either with C code that uses those variables or assembly that uses those values. If you choose assembly, you can use:
Code:

#ASM
   //assembly code here
#ENDASM


As far as what C or ASM code to put, look at section 19.1.9 of the data sheet. It provides step by step instructions.

If you have trouble, post your code up here, but make sure it is a small complete program so we can toss it into a compiler and be able to compile it without changing. Also, tell us your compiler revision.
dyeatman



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

View user's profile Send private message

PostPosted: Wed Mar 28, 2012 7:25 pm     Reply with quote

If you just bought the compiler tell CCS! They should fix the header for you.
_________________
Google and Forum Search are some of your best tools!!!!
BrokenRotor



Joined: 28 Mar 2012
Posts: 5
Location: Minnesota

View user's profile Send private message

PostPosted: Wed Mar 28, 2012 8:04 pm     Reply with quote

PCM programmer, What I bought is the command line compiler. I do not know what version or how to find out. I just bought it two or three weeks ago.

jeremiah, I think what you posted is what I need. I will try it and see. Thanks!

dyeatman, they already know. They list the part in the supported devices as not tested. I emailed them and they said to make my own header file. That is what brought me to this forum.

Thanks to all of you Very Happy . I will report back and let you know how it goes. Just might be a couple days.

Steve
_________________
Never give up, just keep throwing more money at it..
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 28, 2012 8:27 pm     Reply with quote

Quote:
I do not know what version or how to find out.

Compile a program and then look at the top of the .LST file in the
project directory. Look for a number like this:
http://www.ccsinfo.com/devices.php?page=versioninfo

Or, open a command prompt window and go to the c:\Program Files\picc
directory and run: ccsc +v
It will open a window which shows the version.
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