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

Define PR2

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







Define PR2
PostPosted: Wed Feb 01, 2006 5:38 am     Reply with quote

Hello all,

i'm working with a 18F452 to produce a variable frequency with PWM1.
I looked up in mplab that the address of PR2 is 0xFCB.
So, i added #define PR2 0xFCB to the header file.

Why is PR2= 25; not working?
Compiler error says:
Expecting LVALUE such as a variable name or * expression

What am i doing wrong?

Thanks.

K
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Feb 01, 2006 6:37 am     Reply with quote

Quote:
Why is PR2= 25; not working?
Because this is invalid C code.

You could have written
Code:
#define PR2 0xFCB
*PR2 = 25;

or
Code:
#byte PR2 = 0xFCB
PR2 = 25;


Instead of creating your own defines it is easier to use the include file with register definitions that Mark posted for the 18F452: http://www.ccsinfo.com/forum/viewtopic.php?t=14755
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