Best way to address only 4 pins of a port
Jim Fouch
Posts: 395
This may seem simple, but I was wondering what was the best way to clear the states of only 4 pins on a port w/o·disturbing the others.
In my project I'm using Port B (pins 1-3) for an A/D and also pins 4-7 to drive a stepper motor·.
Here is the code I'm using now...
Just wondering is there is a better way to address (clear) the states of only 4 pins on a port.
Thanks,
Jim
In my project I'm using Port B (pins 1-3) for an A/D and also pins 4-7 to drive a stepper motor·.
Here is the code I'm using now...
SendMotorCommand: Read HalfSteps + StepIndex, Temp1 RB.7 = 0 RB.6 = 0 RB.5 = 0 RB.4 = 0 RB = RB or Temp1 Return RelaxMotor: RB.7 = 0 RB.6 = 0 RB.5 = 0 RB.4 = 0 Return HalfSteps: Data %00000000 Data %00010000 Data %00110000 Data %00100000 Data %01100000 Data %01000000 Data %11000000 Data %10000000 Data %10010000
Just wondering is there is a better way to address (clear) the states of only 4 pins on a port.
Thanks,
Jim
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Without the "#" though. RB = RB AND $0F
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
"Ability may get you to the top, but it takes character to keep you there."
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10