Shop OBEX P1 Docs P2 Docs Learn Events
Shiftout help — Parallax Forums

Shiftout help

SeanRoSeanRo Posts: 2
edited 2008-03-07 22:33 in Propeller 1
Hi,

Im new to programming with the propeller.· Ive previously used the basic stamp to write a program and now im trying to switch it over to the propeller.· Im having a hard time figuring out how to output a 24 bit serial command word on a single pin.· The code i previously used on the basic stamp is listed below.

shiftout P14, P13, 0, [noparse][[/noparse]%000000001010001000000000\24]

This is from the Basic Stamp manual:
SHIFTIN Dpin, Cpin, Mode, [noparse][[/noparse] Variable { \Bits } {, Variable { \Bits }} ]
Function
Shift data in from a synchronous serial device.
Dpin is a variable/constant/expression (0 – 15) that specifies the I/O
pin that will be connected to the synchronous serial device’s data
output. This pin will be set to input mode.
Cpin is a variable/constant/expression (0 – 15) that specifies the I/O
pin that will be connected to the synchronous serial device’s clock
input. This pin will be set to output mode.
Mode is a variable/constant/expression (0 – 3), or one of four
predefined symbols, that tells SHIFTIN the order in which data bits
are to be arranged and the relationship of clock pulses to valid data.
See Table 5.115 for value and symbol definitions.
Variable is a variable in which incoming data bits will be stored.
Bits is an optional variable/constant/expression (1 – 16) specifying
how many bits are to be input by SHIFTIN. If no Bits argument is

given, SHIFTIN defaults to 8 bits.


How would·i do something like this on the propeller?

Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-07 20:31
    Download and look carefully at the BS2 Compatibility Library from the Propeller Object Exchange. This is a library (object) with routines (methods) that pretty much duplicate the statements in Parallax Basic. Specifically, there's a SHIFTIN routine that does the same thing as the SHIFTIN statement. You have to call it for each of the variables in the list, but the net effect is the same.

    There are comments just before each routine that explain and demonstrate how to use it.
  • SeanRoSeanRo Posts: 2
    edited 2008-03-07 22:33
    Thanks
Sign In or Register to comment.