View previous topic :: View next topic |
Author |
Message |
skyforme
Joined: 18 Jul 2005 Posts: 14
|
Question about RRNCF. |
Posted: Sun Aug 21, 2005 10:42 pm |
|
|
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? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Aug 21, 2005 10:56 pm |
|
|
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);
} |
|
|
![](templates/subSilver/images/spacer.gif) |
skyforme
Joined: 18 Jul 2005 Posts: 14
|
Thank you for your quick reply |
Posted: Sun Aug 21, 2005 11:04 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Aug 21, 2005 11:27 pm |
|
|
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);
} |
|
|
![](templates/subSilver/images/spacer.gif) |
|