azmax100
- 17th July 2009, 14:20
Hi,
I need to send serial protocol to serial servo. I have success with BS2 and want to transfer to PIC as it has more memory.
But I cant make the servo moving using Picbasic Pro.
I am doing this for a humanoid robot.
I am using PIC 16F877A for testing.
Please Help.
Here I include my BS2 code and Picbasic code.
BS2 code
[QUOTE]
' {$STAMP BS2}
' {$PBASIC 2.5}
Lleg CON 8
PAUSE 1000
SEROUT Lleg,396,[255,5,0,101,181,154,00,186]
SEROUT Lleg,396,[255,5,125,101,181,154,126,182]
SEROUT Lleg,396,[255,5,124,101,181,154,125,180]
SEROUT Lleg,396,[255,5,124,101,181,154,124,179]
SEROUT Lleg,396,[255,5,123,101,181,154,124,178]'
SEROUT Lleg,396,[255,5,123,101,181,154,123,177]
SEROUT Lleg,396,[255,5,122,101,181,154,122,175]
SEROUT Lleg,396,[255,5,121,101,181,154,122,174]
SEROUT Lleg,396,[255,5,121,101,181,154,121,173]
SEROUT Lleg,396,[255,5,120,101,181,154,120,171]
SEROUT Lleg,396,[255,5,120,101,181,154,120,171]
SEROUT Lleg,396,[255,5,119,101,181,154,119,169]
SEROUT Lleg,396,[255,5,118,101,181,154,118,167]
SEROUT Lleg,396,[255,5,116,102,182,154,118,167]
SEROUT Lleg,396,[255,5,113,103,184,154,118,167]
SEROUT Lleg,396,[255,5,111,103,184,154,118,165]
SEROUT Lleg,396,[255,5,110,103,184,154,118,166]
SEROUT Lleg,396,[255,5,109,103,184,154,118,165]
SEROUT Lleg,396,[255,5,107,103,184,154,118,163]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]/QUOTE]
Picbasic Pro Code:
[QUOTE]
include "BS2DEFS.bas"
DEFINE OSC 20
DEFINE SER2_BITS 8
OPTION_REG.7 = 0
Trisb = %00000000 'Setup port b as all outputs
Lleg Var portb.0
PAUSE 1000
SEROUT2 Lleg,396,[255,5,125,101,181,154,126,182]' B6 'repeated 7X,
SEROUT2 Lleg,396,[255,5,124,101,181,154,125,180]' B4 'raise leg at hip
SEROUT2 Lleg,396,[255,5,124,101,181,154,124,179]' B3
SEROUT2 Lleg,396,[255,5,123,101,181,154,124,178]' B2
SEROUT2 Lleg,396,[255,5,123,101,181,154,123,177]' B1
SEROUT2 Lleg,396,[255,5,122,101,181,154,122,175]' AF
SEROUT2 Lleg,396,[255,5,121,101,181,154,122,174] ' AE
SEROUT2 Lleg,396,[255,5,121,101,181,154,121,173]' AD
SEROUT2 Lleg,396,[255,5,120,101,181,154,120,171]' AB
SEROUT2 Lleg,396,[255,5,120,101,181,154,120,171]' AB
SEROUT2 Lleg,396,[255,5,119,101,181,154,119,169]' A9
SEROUT2 Lleg,396,[255,5,118,101,181,154,118,167]' A7 ' repeated 16X
SEROUT2 Lleg,396,[255,5,116,102,182,154,118,167] 'other joints begin motion
SEROUT2 Lleg,396,[255,5,113,103,184,154,118,167]' A7
SEROUT2 Lleg,396,[255,5,111,103,184,154,118,165]
SEROUT2 Lleg,396,[255,5,110,103,184,154,118,166]
SEROUT2 Lleg,396,[255,5,109,103,184,154,118,165]
SEROUT2 Lleg,396,[255,5,107,103,184,154,118,163]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146] ' 73 second servo
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]/QUOTE]
I need to send serial protocol to serial servo. I have success with BS2 and want to transfer to PIC as it has more memory.
But I cant make the servo moving using Picbasic Pro.
I am doing this for a humanoid robot.
I am using PIC 16F877A for testing.
Please Help.
Here I include my BS2 code and Picbasic code.
BS2 code
[QUOTE]
' {$STAMP BS2}
' {$PBASIC 2.5}
Lleg CON 8
PAUSE 1000
SEROUT Lleg,396,[255,5,0,101,181,154,00,186]
SEROUT Lleg,396,[255,5,125,101,181,154,126,182]
SEROUT Lleg,396,[255,5,124,101,181,154,125,180]
SEROUT Lleg,396,[255,5,124,101,181,154,124,179]
SEROUT Lleg,396,[255,5,123,101,181,154,124,178]'
SEROUT Lleg,396,[255,5,123,101,181,154,123,177]
SEROUT Lleg,396,[255,5,122,101,181,154,122,175]
SEROUT Lleg,396,[255,5,121,101,181,154,122,174]
SEROUT Lleg,396,[255,5,121,101,181,154,121,173]
SEROUT Lleg,396,[255,5,120,101,181,154,120,171]
SEROUT Lleg,396,[255,5,120,101,181,154,120,171]
SEROUT Lleg,396,[255,5,119,101,181,154,119,169]
SEROUT Lleg,396,[255,5,118,101,181,154,118,167]
SEROUT Lleg,396,[255,5,116,102,182,154,118,167]
SEROUT Lleg,396,[255,5,113,103,184,154,118,167]
SEROUT Lleg,396,[255,5,111,103,184,154,118,165]
SEROUT Lleg,396,[255,5,110,103,184,154,118,166]
SEROUT Lleg,396,[255,5,109,103,184,154,118,165]
SEROUT Lleg,396,[255,5,107,103,184,154,118,163]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT Lleg,396,[255,5,120,73,184,154,120,146]/QUOTE]
Picbasic Pro Code:
[QUOTE]
include "BS2DEFS.bas"
DEFINE OSC 20
DEFINE SER2_BITS 8
OPTION_REG.7 = 0
Trisb = %00000000 'Setup port b as all outputs
Lleg Var portb.0
PAUSE 1000
SEROUT2 Lleg,396,[255,5,125,101,181,154,126,182]' B6 'repeated 7X,
SEROUT2 Lleg,396,[255,5,124,101,181,154,125,180]' B4 'raise leg at hip
SEROUT2 Lleg,396,[255,5,124,101,181,154,124,179]' B3
SEROUT2 Lleg,396,[255,5,123,101,181,154,124,178]' B2
SEROUT2 Lleg,396,[255,5,123,101,181,154,123,177]' B1
SEROUT2 Lleg,396,[255,5,122,101,181,154,122,175]' AF
SEROUT2 Lleg,396,[255,5,121,101,181,154,122,174] ' AE
SEROUT2 Lleg,396,[255,5,121,101,181,154,121,173]' AD
SEROUT2 Lleg,396,[255,5,120,101,181,154,120,171]' AB
SEROUT2 Lleg,396,[255,5,120,101,181,154,120,171]' AB
SEROUT2 Lleg,396,[255,5,119,101,181,154,119,169]' A9
SEROUT2 Lleg,396,[255,5,118,101,181,154,118,167]' A7 ' repeated 16X
SEROUT2 Lleg,396,[255,5,116,102,182,154,118,167] 'other joints begin motion
SEROUT2 Lleg,396,[255,5,113,103,184,154,118,167]' A7
SEROUT2 Lleg,396,[255,5,111,103,184,154,118,165]
SEROUT2 Lleg,396,[255,5,110,103,184,154,118,166]
SEROUT2 Lleg,396,[255,5,109,103,184,154,118,165]
SEROUT2 Lleg,396,[255,5,107,103,184,154,118,163]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146] ' 73 second servo
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]
SEROUT2 Lleg,396,[255,5,120,73,184,154,120,146]/QUOTE]