Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Servo Controller - help with code — Parallax Forums

Parallax Servo Controller - help with code

kevinb2050kevinb2050 Posts: 56
edited 2008-10-28 11:52 in BASIC Stamp
I thought I was reasonable good with code but can not understand the following line of code for the PSC

" SERIN Sdat, Baud, 1000, Init,[noparse][[/noparse]STR Buff\3] "
I thought the call to " Init " is just looping the code within itself.

Unfortunately I have been unable to find any other "user manual or reference material" for the PSC
If any one knows of any it would be appreciated as I think this is a unit with great potential especially if the USB software interface could be turned into loadable code

The following code is from the·Parallax Servo Controller – USB (#28823) Rev B " user manual ???"
RSP Command – Report the Position of a Servo Channel
Syntax: “!SCRSP” x $0D
Reply: x y z(where x is the channel number, and z:y is the value reported)

·
ch VAR Byte
pw VAR Word
ra VAR Byte
x VAR Byte
Buff VAR Byte(3)
Sdat CON 15
baud CON 396
Init:
ra = 15: ch = 12
DO
pw = 1240: GOSUB WRservo
pw = 240: GOSUB WRservo
LOOP
WRservo:
SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
FOR x = 0 TO 4
PAUSE 1000
SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SCRSP", ch, CR]
SERIN Sdat, Baud, 1000, Init,[noparse][[/noparse]STR Buff\3]
DEBUG "Servo ", DEC buff(0), " ", HEX2 buff(1), " :", HEX2 buff(2), CR
NEXT
RETURN
·

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-10-28 11:31
    Kevin -

    The parameter you're questioning is the routine that SERIN branches to in the event of a PARITY ERROR. Here is the general format of the SERIN command:

    SERIN Rpin {\Fpin}, Baudmode, {Plabel,} {Timeout, Tlabel,} [noparse][[/noparse]InputData]

    Additional information about the SERIN command can be found in the PBASIC Reference Manual, or the PBASIC Help file.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When all else fails, try inserting a new battery.
  • kevinb2050kevinb2050 Posts: 56
    edited 2008-10-28 11:52
    doh - Just about to wipe the egg off my face - thanks Bruce
    Still looking for material on the PSC if any one knows of any
Sign In or Register to comment.