Shop OBEX P1 Docs P2 Docs Learn Events
bpx with servo controller serial problem — Parallax Forums

bpx with servo controller serial problem

Brendon PolandBrendon Poland Posts: 7
edited 2008-01-08 18:24 in BASIC Stamp
I wrote code for a bs2 and it works great, it controlls·one servo via·the servo controller board.·I need the code to run on a bpx and i cant seem to figure out the problem, but it doesn't work. Take a look and let me know what you think. Everything else is working but i think the problem is in the serial format. Thanks.

Brendon

Code:

' {$STAMP BS2px}

' {$PBASIC 2.5}

CH VAR Byte

PW VAR Word

RA VAR Byte

SDAT CON 15

BAUD CON 396

RA = 6

CH = 11

DO

PW = 1250

SEROUT SDAT, BAUD+$8000,[noparse][[/noparse]"!SC", CH, RA, PW.LOWBYTE, PW.HIGHBYTE, CR]

PAUSE 1000

PW = 300

SEROUT SDAT, BAUD+$8000,[noparse][[/noparse]"!SC", CH, RA, PW.LOWBYTE, PW.HIGHBYTE, CR]

PAUSE 1000

LOOP

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-12-17 15:04
    Brendon -

    While the BAUD constant of 396 is fine for a BS-2, it must be changed to 1646 for a BS-2PX.
    After changing that, you should be good to go.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Brendon PolandBrendon Poland Posts: 7
    edited 2008-01-08 18:24
    Sorry for the long delay in getting back to you (christmas Break). It worked, thanks very much.
Sign In or Register to comment.