View previous topic :: View next topic |
Author |
Message |
Bob Milner Guest
|
restart_cause |
Posted: Mon Mar 29, 2004 12:44 am |
|
|
Can somone explain this section of the restart_cause?
movf status,W
andlw 0x18
iorlw 0
bne xxxx
What does the iorlw 0 do? |
|
![](templates/subSilver/images/spacer.gif) |
random_person Guest
|
|
Posted: Mon Mar 29, 2004 5:09 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Bob Milner Guest
|
|
Posted: Mon Mar 29, 2004 6:07 am |
|
|
Thanks but doesn´t the andlw do all of the logic that is
necessary for branching? |
|
![](templates/subSilver/images/spacer.gif) |
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Mon Mar 29, 2004 6:14 am |
|
|
Correct. 'irolw 0' basically means 'if (w==0)' or 'if(w!=0)' depending on the branch instruction coming after it. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Mon Mar 29, 2004 3:47 pm |
|
|
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](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|