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 support@ccsinfo.com

Reading STATUS on a 18F422

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



Joined: 30 Sep 2003
Posts: 89

View user's profile Send private message

Reading STATUS on a 18F422
PostPosted: Thu May 20, 2004 12:38 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu May 20, 2004 12:48 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu May 20, 2004 1:39 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu May 20, 2004 3:44 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu May 20, 2004 4:56 pm     Reply with quote

I've had success in doing it this way:

#byte STATUS = 0xFD8 // global declaration

printf("%X", STATUS); // inside main()

Ronald
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