What does a setcommand statement do?
JonTitus
Posts: 193
Several SPIN/assembly-language programs include statements such as this one from an SPI object:
PUB SHIFTOUT(Dpin, Cpin, CSpin, Bits, Value) setcommand(1, @Dpin)What does this instruction do? Why do programmers use it? I've assumed the @Dpin points to the starting address of the arguments. That's as far as I got. The setcommand statement isn't documented in the Propeller Manual v. 1.2 and I can't find an explanation--and a clear example in the Forum. Thanks for your help. --Jon
Comments
Look for something like this in the code.
I haven't yet developed a comfort with the SPI modes of the smart pins, so I'm working on an inline P2ASM program. This is the shiftout() function from that code. I really like that the P2 allows us to blend Spin2 and P2ASM without invoking a cog. I still need to wring-out my shiftin() and shiftio() functions -- then I will send to Parallax.
Andy
-- start() (setup pins, clock mode, and clock timing)
-- shiftout() (as above, works in all modes)
-- shiftin() (needs testing -- waiting on some shift registers)
-- shiftio() (needs testing)
At the moment, I'm not convinced using smart pins is the best way for me to do SPI. That said, I reserve the right to be wrong and to change my mind down the line.