In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote: Bamse, If you only using the SHIFTIN and SHIFTOUT commands, it wouldn't be too hard to make specialized versions that WOULD allow different pins to be used. If you don't need high speed, you could probably write them in SX/B too. I would use a method of numbering the pins from RA.0 to RC.7 with number from 0 to 23 (I know that RA.3-RA.7 don't exist, but it makes the code easier to pretend they do). Then do something like: [code] 'UNTESTED CODE pinNumber VAR Byte pinBit VAR Byte pinAddr VAR Byte PinHigh SUB 1 PinHigh: pinNumber = __PARAM1 ' Get passed pin number (0 to 23) pinBit = pinNumber AND 7 ' Get pin bit position pinBit = 1 << pinBit ' Make pin mask pinAddr = pinNumber >> 3 ' Get pin port address pinAddr = pinAddr + @RA ' Start at port RA (notice @) __RAM(pinAddr) = __RAM(pinAddr) OR pinBit ' Set the port bit high RETURN [/code] I would just make routines to set a pin number high and low. Then just call them as needed in your higher level subroutines (like shiftout). Let me know if you need for info, but I think that will work for ya. Bean. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=142595#m142626 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)