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

Question about RRNCF.

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



Joined: 18 Jul 2005
Posts: 14

View user's profile Send private message

Question about RRNCF.
PostPosted: Sun Aug 21, 2005 10:42 pm     Reply with quote

Hello

I am trying to use RRNCF command.
my code is

movf PORTA,W
andlw 0x1C
rrncf WREG,W

and
this error message showed.

evaluation must evaluate to a constant WREG
in the line of rrncf.

and
rrncf command say that

rrncf f,d
f
may be a constant (file number) or a simple variable
d
may be a constant (0 or 1) or W or F.

I do not figure out what is wrong.
Could you give me any hint?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 21, 2005 10:56 pm     Reply with quote

The compiler has no idea what WREG is until you tell it.
You can do this with a #byte statement.

Code:
#include <18F452.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP   
#use delay(clock=4000000)

// The following address comes from Table 4-1
// in the 18F452 data sheet.
#byte WREG = 0xFE8   

void main()
{

#asm   
rrncf WREG,W
#endasm   

while(1);
}
skyforme



Joined: 18 Jul 2005
Posts: 14

View user's profile Send private message

Thank you for your quick reply
PostPosted: Sun Aug 21, 2005 11:04 pm     Reply with quote

Hello

I just found that I didn't declare the command.
And I came back here to post it.
Wow.
But already there is a post!!

Thank you very much.
I have another problem now.

I also try to use "return" as an assembler.
but when I insert the command
error says that "expecting an identifier"
what is the problem?

Thank you very much.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 21, 2005 11:27 pm     Reply with quote

It requires a parameter. Please read the section called "Instruction
Set Summary" in the PIC data sheet. It explains this.
Code:
#include <18F452.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP   
#use delay(clock=4000000)

void main()
{

// The "Return" instruction requires a parameter of 0 or 1
// in CCS.
#asm   
RETURN 0
RETURN 1
#endasm   

while(1);
}
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