Please help servo with pwmpal using BS2px
DmitriX
Posts: 2
Helle everyone, has any one have any experience with pwmpal controlling a servo usind BS2px. It seems very simple to communicate with the PWMPAL and the BS2px(with baud rate of 19200). Here is my sample test code:'
{$STAMP BS2px}
' {$PBASIC 2.5}
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T4800 CON 188
T9600 CON 84
T19K2 CON 32
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T4800 CON 500
T9600 CON 240
T19K2 CON 110
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T4800 CON 813
T9600 CON 396
T19K2 CON 188
T38K4 CON 84
#ENDSELECT
PpBaud CON 188
SEROUT 0, PpBaud, [noparse][[/noparse]"!PWMSS", %00100000]
DO
'''''1ms on time >>>>>> direction
SEROUT 0, PpBaud, [noparse][[/noparse]"!PWMM2",40,0,32,3]
PAUSE 200
'''''2ms on time <<<<<<< direction
SEROUT 0, PpBaud, [noparse][[/noparse]"!PWMM2",80,0,32,3]
PAUSE 200
'''''1.5ms on time <<<<<<<center
SEROUT 0, PpBaud, [noparse][[/noparse]"!PWMM2",60,0,32,3]
PAUSE 200
LOOP
this is just a simple test to make the servo rotate on direction, then opposite direction and center. My problem is that the servo has no response. Servo seems to be functional as i tested it with a BS2px directly, but my project requires the servo to functional independent of BS2px. I dont knw i might be missing something in the sample code or maybe the PWMPAL is not working???? any help would be vary appreciated
{$STAMP BS2px}
' {$PBASIC 2.5}
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T4800 CON 188
T9600 CON 84
T19K2 CON 32
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T4800 CON 500
T9600 CON 240
T19K2 CON 110
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T4800 CON 813
T9600 CON 396
T19K2 CON 188
T38K4 CON 84
#ENDSELECT
PpBaud CON 188
SEROUT 0, PpBaud, [noparse][[/noparse]"!PWMSS", %00100000]
DO
'''''1ms on time >>>>>> direction
SEROUT 0, PpBaud, [noparse][[/noparse]"!PWMM2",40,0,32,3]
PAUSE 200
'''''2ms on time <<<<<<< direction
SEROUT 0, PpBaud, [noparse][[/noparse]"!PWMM2",80,0,32,3]
PAUSE 200
'''''1.5ms on time <<<<<<<center
SEROUT 0, PpBaud, [noparse][[/noparse]"!PWMM2",60,0,32,3]
PAUSE 200
LOOP
this is just a simple test to make the servo rotate on direction, then opposite direction and center. My problem is that the servo has no response. Servo seems to be functional as i tested it with a BS2px directly, but my project requires the servo to functional independent of BS2px. I dont knw i might be missing something in the sample code or maybe the PWMPAL is not working???? any help would be vary appreciated
Comments
Make this change:
PpBaud CON 188
to
PpBaud CON 396
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON