Toggling pins on/off in PASM
Philldapill
Posts: 1,283
How do you toggle a pin on and off in PASM? Is there an equivalent of OUTA[noparse]/noparse in PASM?
Comments
or outa, mask
andn outa,mask
Turns on P0
Use it with a pin mask to turn on a specific pin eg outa, #1 <<16 would turn on P16
Regards,
Coley
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
Post Edited (Coley) : 6/30/2008 11:51:41 PM GMT
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
Post Edited (Phil Pilgrim (PhiPi)) : 6/30/2008 11:36:04 PM GMT
Oops, my bad!
This does work though!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
·
Now I have a question... If I set the period to 80,000, the frequency should be 1kHz, right? No. My meter says it's ~166Hz... pretty off if you ask me...
I need to see some incremental count has reached a threshold, then do something else.
you test and cmp you need to specify to set wz or wc
then you can use
cmp t0,#4 wz
if_z jmp #equal4
it compares t0 to 4 sets the wz flag if they are the same.
if_z says execute the instruction if the wz flag is set, so you would execute the jmp otherwise its a nop
you can set the flags on most instructions and you can use if_z etc on most instructions, so for example
cmp t0,#4 wz
if_z mov t0, #0
would set t0 to 0 if it was 4
I would take a look through fullduplexserial, its a pretty good straightforward piece of pasm that is complex enough to show a lot of stuff. (I would not look at my version of fullduplexserial4fc, I was trying to push the prop and so it re-writes the code on the fly - not just source/dest addresses but the instructions, etc. Once you get used to pasm take a look at some of the stuff you can do if you really want but it does make the code a lot harder for anyone to understand)