View previous topic :: View next topic |
Author |
Message |
pfournier
Joined: 30 Sep 2003 Posts: 89
|
Reading STATUS on a 18F422 |
Posted: Thu May 20, 2004 12:38 pm |
|
|
It seems I can't read the STATUS (ALU) register in C.
Seems I have to use something like this:
#asm
movff status,status_temp
#endasm
I can then use status_temp.
Trying to read STATUS in a C staement just gets me 0x07.
Is this correct? or am I doing something wrong.
-Pete _________________ -Pete |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu May 20, 2004 12:48 pm |
|
|
Quote: | It seems I can't read the STATUS (ALU) register in C. |
Post your C source code. Also post the line where you
declare the address of the Status register. |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu May 20, 2004 1:39 pm |
|
|
Maybe I'm stupid, but I can't find a 18F422 on Microchip's site. Would you happen to mean 18F4220? |
|
|
pfournier
Joined: 30 Sep 2003 Posts: 89
|
|
Posted: Thu May 20, 2004 3:44 pm |
|
|
OOPS meant 18f452, (never said I could type)
my definition, all the registers are done this way
char status;
#LOCATE status= 0xfd8
I would do something like this:
printf("%x", status); //or some other operation
Instead I do this:
int8 status_temp1;
#asm
movff status, status_temp1
#endasm
printf("%x", status_temp1); //or some other operation
Thanks. _________________ -Pete |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu May 20, 2004 4:56 pm |
|
|
I've had success in doing it this way:
#byte STATUS = 0xFD8 // global declaration
printf("%X", STATUS); // inside main()
Ronald |
|
|
|