bpx with servo controller serial problem
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
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔