Pin high , Pin low
Hello Forum , i have a motor , one of the pin ( when the pin is low the motor is on , when the pin is high the motor is off )
Is it's good to write like this :
this will be in a code and i can call MotorOff or MotorOn , depends to my need
is this good method ?
Thank you Forum
Anita
Is it's good to write like this :
DAT
org
MotorOff
mov dira,Pin
mov outa,High
MotorOn
mov dira,Pin
mov outa,#0
Pin long|<7
High long $FFFFFFFF
this will be in a code and i can call MotorOff or MotorOn , depends to my need
is this good method ?
Thank you Forum

Anita

Comments
or dira,Pin' this to set the pin output
or outa,Pin' this sets it high
andn outa,Pin' this sets it low
Or, Paul Baker has another way he recommends that I can't remember right off.
If you are setting these up as functions you have to have ret labels.
$0 through $1FF using "mov dest, #N"
$FFFFFFFF through $FFFFFE01 ($-1 through $-1FF) using "neg dest, #-N"
DAT org MotorOff or dira,Pin or outa,High MotorOn or dira,Pin andn outa,Pin Pin long|<7 High long $FFFFFFFFThank you in advance
Anita
or dira,PinMask ' makes the pin an output andn dira,PinMask ' makes the pin an input or outa,PinMask ' make the pin high andn outa,PinMask ' make the pin low PinMask long |< PinIf the pin number is less than 9, you can use immediate operands
or dira,#|< Pin ' makes the pin an output andn dira,#|< Pin ' makes the pin an input or outa,#|< Pin ' make the pin high andn outa,#|< Pin ' make the pin low