Shop OBEX P1 Docs P2 Docs Learn Events
DC-16 Serial Commands — Parallax Forums

DC-16 Serial Commands

Charlie JohnsonCharlie Johnson Posts: 147
edited 2006-12-02 17:22 in Propeller 1
How would something like this
' get version
  SEROUT Sio, Baud, [noparse][[/noparse]"!DC16", Addr, "V"]
  SERIN  Sio, Baud, 200, Main, [noparse][[/noparse]STR id\3]
  DEBUG "DC-16 Version ", STR id\3, CR

Be coded in spin using the FullDuplexSerial or some more appropriate Serial object?· Serial TX and RX are on the same pin.· I thought I would make a DC-16 Object, but I am already stumped on the serial I/O.

Thanks

Charlie

AKA dy8coke

Comments

  • JonnyMacJonnyMac Posts: 9,003
    edited 2006-12-01 17:54
    I believe the latest version of FullDuplexSerial allows for I/O on the same pin.
  • acantostegaacantostega Posts: 105
    edited 2006-12-01 19:19
    How much bauds do you need? If it's 9600 or less you can use one of the serial routines that don't take up an extra cog, like the simpleDebug one or the ones included in the BS2 object.
  • Charlie JohnsonCharlie Johnson Posts: 147
    edited 2006-12-01 21:11
    The DC-16 talks at either 2400 or 38400, I was using the FullDuplexSerial for the 38400 baud, but I can use the SimpleSerial at 2400. The problem is that the serial output is a mixture of string data and numeric data for the commands. I guess I can try something like:

    OBJ

    SS : "SimpleSerial"

    PUB getVersion
    SS.str(String("!DC16")) 'Preamble
    SS.bin(11,2) 'DC-16 address
    SS.str(string("V") 'Get version

    I will continue to hack at it..... Thanks

    Charlie
    AKA dy8coke
  • JonnyMacJonnyMac Posts: 9,003
    edited 2006-12-02 17:22
    Charlie:

    Keep in mind that the ID parameter in the DC-16 control string is numeric, and the .bin method sends a string representation -- just use the .tx method for sending values and single characters.
Sign In or Register to comment.