Searching \ for '[SX] Best way to address only 4 pins of a port' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/ubicom/lib/io/index.htm?key=port
Search entire site for: 'Best way to address only 4 pins of a port'.

Exact match. Not showing close matches.
PICList Thread
'[SX] Best way to address only 4 pins of a port'
2006\01\19@104630 by Jim Fouchn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Jim Fouch wrote:

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...




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


---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=105636
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\01\19@105834 by Coriolisn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Coriolis wrote:

Using the logic operand AND is the most efficient means of clearing a series of bits, RB = RB AND #$0F, would clear bits 4-7, I may have the syntax wrong since I don't use SX/B that much.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=105636#m105641
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\01\19@112247 by beann/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote:

Paul,
 Without the "#" though.  RB = RB AND $0F
Bean.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=105636#m105644
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

2006\01\19@114047 by Coriolisn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Coriolis wrote:

Thanks Bean, that was what I suspected was incorrect.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=105636#m105648
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...