Variables and SHIFTIN / SHIFTOUT
jefm
Posts: 50
I'm looking at Stampworks which deals with using SHIFTIN/SHIFTOUT to populate a WORD variable. Instead of one word variable, is it possible to populate several bits? I can only think of two ways to do this; by running SHIFTIN/OUT several times and reading only one bit, which seems like it would mess up the register, Or by running SHIFTIN/OUT normally and converting the word into several bits somehow. The last idea seems best but I'm still working on how to do it.
Is there some other way to do this? Thanks for any help.
Is there some other way to do this? Thanks for any help.
Comments
In the SHIFTIN and SHIFTOUT argument is a Bits expression which establishes the number of bits which are to be clocked in/out.
Read up on that in PBASIC Help.
You can use multiple WORD variables in the following manner…for example, if you have four 74HC595 chips in series and your data is in two word variables named result1 and result2.
This will shift 4 bytes out in order from the two 16-bit word variables. On a real 595 this command would also be followed by a PULSOUT command to latch the data into the registers. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering