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

restart_cause

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







restart_cause
PostPosted: Mon Mar 29, 2004 12:44 am     Reply with quote

Can somone explain this section of the restart_cause?
movf status,W
andlw 0x18
iorlw 0
bne xxxx

What does the iorlw 0 do?
random_person
Guest







PostPosted: Mon Mar 29, 2004 5:09 am     Reply with quote

movf status,W
;//moving content of Status Register to W
andlw 0x18
;//purpose is to isolate Time-Out and Power-Down status bits (for 16F87x at least...)
iorlw 0
;//purpose is to set the Z-ero flag if and only if neither a Time-Out nor a Power-Down occurred
bne xxxx
;//if Z flag was not set, this means that one or both of the "restart_cause"s occurred, so branch to xxxx


I'm pretty sure thats how you'd interpret it though I'm not at all familiar with the fuction itself
Bob Milner
Guest







PostPosted: Mon Mar 29, 2004 6:07 am     Reply with quote

Thanks but doesn�t the andlw do all of the logic that is
necessary for branching?
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Mon Mar 29, 2004 6:14 am     Reply with quote

Correct. 'irolw 0' basically means 'if (w==0)' or 'if(w!=0)' depending on the branch instruction coming after it.
Guest








PostPosted: Mon Mar 29, 2004 3:47 pm     Reply with quote

Quote:
Thanks but doesn�t the andlw do all of the logic that is
necessary for branching?


Now that you mention it...I agree. I'm not sure the iorlw needs to be there since ior 0 is an identity function and the ANDLW fuction would set the zero flag anyway...

In any case, I don't think it affects the function in any way other than adding a delay. Smile
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