Shop OBEX P1 Docs P2 Docs Learn Events
Will the Parallax appmod serial protocol work with N&V project #143 & a BS2 — Parallax Forums

Will the Parallax appmod serial protocol work with N&V project #143 & a BS2

Capt. QuirkCapt. Quirk Posts: 872
edited 2007-05-10 19:19 in General Discussion
Jon used the appmod protocol in N&V #117, but so far all my attempts have ended up with my servos shaking worse than I do.

Also Jon mentions that the serial protocol uses two byte periods preceeding the data. Does that mean I need to add 2 dummy bytes before the data?

Thanks

Bill

Comments

  • JonnyMacJonnyMac Posts: 8,941
    edited 2007-05-10 15:03
    Are you referring to the May 2007 issue? (#117 is actually a display multiplexer)

    If you're talking about the latest project it does not use the AppMod protocol -- I took a page from the DMX and LANC protocols that use a "rest" period between packets to create a sync point. In the Animatronic Controller project the device will wait until there has been no activity on the RX line for at least two byte periods (~502 uS at 38.4K baud). After that it is "armed" and waits for nine bytes: the first byte being the digital control outputs (RC port) and the next eight being the servo position values expressed in ~10 uS units (close to the BS1).

    I suspect you didn't actually build the board but dropped the code into an SX28 on your PDB -- no problem, that's where I started. If you're connecting between the Stamp and the A/C's RX pin (RA.1), then you need to use open baud mode and have a 10K pull-up on that line.

    Since I built the board to run from a PC I used the PDBs extra serial port for testing. My PDB prototype was tested using the VB program that I supplied with the project. I've also run the board with a neat little program called Vixen (www.vixenlights.com) -- I'll talk about that in the next issue.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-05-10 19:07
    JonnyMac,

    That's right, I am using my·PDB. I've had the magazine since late April and I have read the artical many times. You referred to #117·"Timming is everything" artical as to when you used that UART before·and you have recomended it, to me before to read up on the appmod protocol.

    In the artical you mention it could be ran by a BS2, and so I was trying to duplicate that idea. I didn't understand the need for the transmiting uart, so I left that code in place and ran a single wire to the RX uart. In the SX/B Serial LCD example·it used the AppMod protocol and my wire connections were wired to those specs. A inline (series?) 220 resistor and a 4.7K pullup resistor between the stamp and SX and OT9600 baud.

    The part that I understand the least is what the BS2 SEROUT line should look like and what the Control packet is. I am also under the impression that the first 2 byte periods are just time, instead of 2 packets with no data·inside them?. Also is the 4.7K pullup to weak?, I might have fried the BS2 last night. lol.

    Bill

    PS, thanks for publishing this project in Nuts n Volts. I thought it was going to be part of the book.TY



    Post Edited (Capt. Quirk) : 5/10/2007 7:13:32 PM GMT
  • JonnyMacJonnyMac Posts: 8,941
    edited 2007-05-10 19:19
    The TX UART is not used by that project but could be used by another so I left it in place. You'll notice that each section of the ISR is very modular and can be pulled out if you desire.

    Since you're using a PDB, put a 10K pull-up on RA.1 and use open-true baud mode. And you only need to update the device when required -- the servo updates are handled internally, so refreshing more frequently that 20 milliseconds doesn't do anything for you. To use the controller as it's designed you'll need a byte for the digital outputs and an eight byte array for the servos; you should be able to send the values like this:

    PAUSE 1
    SEROUT Sio, Baud, [noparse][[/noparse]digOuts, STR servos\8]
    
    



    The initial pause ensures the device has seen the proper break between packets and can re-arm to receive the next.
Sign In or Register to comment.