Assembly pushbutton?
electric550
Posts: 122
Hello can somebody post some assembly code to mirror a pushbutton to an LED(Pushbutton positive when pressed)? Or even better seven pushbuttons to seven leds and record the lengths of the button presses to variables? I was thinking maybe using the counters or something but I am just starting in parallax assembly and really need to learn how to use the IO more efficiently. Is there a way to address single pins in assembly? I am surprised that all I have found for pin IO requires bit masking the entire port. I have been using assembly for phillips and si labs chips, (in which case I know how to do this), but it seems complicated to me right now on the propeller. Anyways thanks for your help.
Comments
You should also consider the needs of software/hardware debouncing of the signal. Usually this introduces enough of a delay that the timing becomes spin compatible anyway. Search the forum, there have been some threads recently on this.
Cheers!
Paul Rowntree
Asm has no individual bit adressing, so you must use masks.
To set a pin use
or REGISTER, Mask
To clear a pin use
andn REGISTER, Mask
EDIT : Hey it works. Here is the full version
This should get you·started on the right track.
TJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I owe everyone here a bunch, So thanks again for answering my dumb questions.
Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
Suzuki RG500 in a RGV 250 frame.
Bimota V-Due (Running on the fuel injection system)
Aprilia RS250
Post Edited (TJHJ) : 4/9/2009 4:36:16 PM GMT