Bot board+atom 24+ssc32

I am corrently working on a biped project. I am using a bot board with atom 24 and the ssc32. I wrote this program, and one servo twitches, and the rest do nothing. Can any tell me how to fix. My ssc32 is conected to p15, on the bot board. Thankyou

This is the program:

’ Atom / SSC-32 Test
’ Configure the SSC-32 for 38.4k baud.

servo15pw var word
movetime var word

servo15pw = 1000
movetime = 2500

start:
servo15pw = 1000
serout p15,i38400,"#0P",DEC servo15pw,“T”,DEC movetime,32]
pause 1000

servo15pw = 2000
serout p15,i38400,"#0P",DEC servo15pw,“T”,DEC movetime,32]
pause 1000

goto start

’ Biped example program.
aa var byte '<- general purpose variable.
rax var word '<- right ankle side-to-side. On pin0
ray var word '<- right ankle front-to-back. On pin1
rkn var word '<- right knee. On pin2
rhx var word '<- right hip front-to-back. On pin3
rhy var word '<- right hip side-to-side. On pin4
rht var word '<- right hip twist. on pin5
lax var word '<- left ankle side-to-side. On pin16
lay var word '<- left ankle front-to-back. On pin17
lkn var word '<- left knee. On pin18
lhx var word '<- left hip front-to-back. On pin19
lhy var word '<- left hip side-to-side. On pin20
lht var word '<- left hip twist. on pin21
ttm var word '<- time to take for the current move.

’ First command to turn the servos on.
for aa=0 to 32
serout p15,i38400,"#", DEC2 aa\1, “P”, DEC 1500, 32]
next

walk:

’ First position for step sequence, and time to move, put in your values here.
rax=1500: ray=1500: rkn=1500: rhx=1500: rhy=1500: rht=1500
lax=1500: lay=1500: lkn=1500: lhx=1500: lhy=1500: lht=1500
ttm=2000
gosub send_data
pause ttm
then
’ Secound
rax=1500: ray=1500: rkn=1500: rhx=1500: rhy=1500: rht=1500
lax=1500: lay=1500: lkn=1500: lhx=1500: lhy=1500: lht=1500
ttm=2000
gosub send_data
pause ttm
’ Third…
’ Forth…
’ Etc…

goto walk
’ This sends the data to the SSC-32. The serout is all one line, no Wrap!
send_data:
serout p15,i38400,"#0P", DEC rax,"#1P", DEC ray,"#2P", DEC rkn,"#3P", DEC rhx,"#4P", dec rhy,"#5P", DEC rht,"#16P", DEC lax,"#17P", DEC lay,"#18P", DEC lkn,"#19P", DEC lhx,"#20", dec lhy,"#21", dec lht,“T”, DEC ttm,13]
return :cry: :cry:

This is the program:

’ Atom / SSC-32 Test
’ Configure the SSC-32 for 38.4k baud.

servo15pw var word
movetime var word


servo15pw = 1000 you can kill this line


movetime = 2500

start:
servo15pw = 1000


serout p15,i38400,"#0P",DEC servo15pw,“T”,DEC movetime,32]
**** why sending the value 32 ? in this case you want to execute the order, so you must send the value 13 (CR) and not 32 (Space) ****
**** the correct line is : serout p15,i38400,"#0P",DEC servo15pw,“T”,DEC movetime,13]


pause 1000 ***** Warning ! you set movetime to 2500 but you wait only 1000 before sending new data to Servo on Pin 0 !..so the next order will stop the previous move (which is not finished) and redirect the servo to a new position

servo15pw = 2000


serout p15,i38400,"#0P",DEC servo15pw,“T”,DEC movetime,32] **** same problem, send value 13 and not 32 !
pause 1000 ****again you are not waiting enough
goto start

so, program corrected :

’ ***********************************************
’ Atom / SSC-32 Test
’ Configure the SSC-32 for 38.4k baud.

servo15pw var word
movetime var word

movetime = 2500

start:
servo15pw = 1000
serout p15,i38400,"#0P",DEC servo15pw,“T”,DEC movetime,13]
pause movetime

servo15pw = 2000
serout p15,i38400,"#0P",DEC servo15pw,“T”,DEC movetime,13]
pause movetime

goto start
’ ***********************************************

this is your program example corrected
it need a better system to assign Pin to Moves wordtable values (if you want to send the data in the second column to the Pin 28 for example)
i will post another version soon to fix this

’ **********************
’ Biped example program.
’ **********************

’ *******************************************
’ Warning !
’ in this example, only the servo on Pin #0 will move from 1300 to 1700 Maximum
’ according to the datas in the Moves wordtable
’ other servos will stay at 1500 (while you don’t change datas)
’ *******************************************

’ Variables
’ ----------------------
i var byte 'Counter 1
J var byte 'Counter 2
TimeValue var word 'Pause/Time Value

’ Moves Table structure :
’ rax <- right ankle side-to-side. On pin0
’ ray <- right ankle front-to-back. On pin1
’ rkn <- right knee. On pin2
’ rhx <- right hip front-to-back. On pin3
’ rhy <- right hip side-to-side. On pin4
’ rht <- right hip twist. on pin5
’ lax <- left ankle side-to-side. On pin16
’ lay <- left ankle front-to-back. On pin17
’ lkn <- left knee. On pin18
’ lhx <- left hip front-to-back. On pin19
’ lhy <- left hip side-to-side. On pin20
’ lht <- left hip twist. on pin21
’ ttm <- time to take for the current move.
’ rax ray rkn rhx rhy rht lax lay lkn lhx lhy lht ttm
Moves wordtable 1400,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,2000, |’ First position for step sequence, and time to move, put in your values here.
1600,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,2000, |’ Second position
1300,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,2000, |’ Third …etc
1700,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,2000 ’ Last (whithout the ‘,’ and the ‘|’)

’ Constants
’ ----------------------
NbMoves con 4 ’ yes ! you must count the lines in moves wordtable an put the value here
NbServo con 12 ’ it mean that you use 12 servos in moves wordtable…the last value is the Time

’ ----------------------
’ Init
’ ----------------------
’ First command to turn the servos on.
for i = 0 to 31 ’ and not 32 !
serout p15,i38400,"#", DEC i, “P”, DEC 1500] 'DEC i is enough, no need to add a ‘space’ (32) between commands (it cost time)
next
serout p15,i38400,[13] 'you must validate the previous command line with 13(CR) for the SSC-32 to execute it !

’ ----------------------
’ Main Loop
’ ----------------------
walk:
for i = 0 to NbMoves - 1 ’ we will read the Moves wordtable line by line…we reuse the ‘i’ variable here
gosub send_data
pause TimeValue ’ we return from send_data with the TimeValue computed
next
goto walk

’ ----------------------
'Sub routine
’ ----------------------
send_data:
for j = 0 to 5 ’ 0 to 5 = 6 servos from pin 0 to pin 5
serout p15,i38400,"#", DEC j, “P”, DEC Moves(j + i * (NbServo + 1))] ’ browsing Moves columns (with j) according to the line # (with i)
next
for j = 6 to NbServo - 1 ’ 6 to 11 = 6 servos from pin 16 to pin 21
serout p15,i38400,"#", DEC j + 10, “P”, DEC Moves(j + i * (NbServo + 1))] ’ browsing Moves columns (with j) according to the line # (with i)
next
TimeValue = Moves(NbServo + i * (NbServo + 1)) ’ reading the TimeValue for this move
serout p15,i38400,“T”, DEC TimeValue, 13] ’ sending the Time and validate the entire commands
return

now, here is a dump of data sent to the SSC-32 during the first loop :
#0P1400#1P1500#2P1500#3P1500#4P1500#5P1500#16P1500#17P1500#18P1500#19P1500#20P1500#21P1500T2000
#0P1600#1P1500#2P1500#3P1500#4P1500#5P1500#16P1500#17P1500#18P1500#19P1500#20P1500#21P1500T2000
#0P1300#1P1500#2P1500#3P1500#4P1500#5P1500#16P1500#17P1500#18P1500#19P1500#20P1500#21P1500T2000
#0P1700#1P1500#2P1500#3P1500#4P1500#5P1500#16P1500#17P1500#18P1500#19P1500#20P1500#21P1500T2000

and of course, the program wait the TimeValue’ between each line

I tried the program, and then I changed the values, as you can see below. And for some reason only the servo on p0 moves. In a slow gitery motion. Thankyou for your help

’ **********************
’ Biped example program.
’ **********************

’ *******************************************
’ Warning !
’ in this example, only the servo on Pin #0 will move from 1300 to 1700 Maximum
’ according to the datas in the Moves wordtable
’ other servos will stay at 1500 (while you don’t change datas)
’ *******************************************

’ Variables
’ ----------------------
i var byte 'Counter 1
J var byte 'Counter 2
TimeValue var word 'Pause/Time Value

’ Moves Table structure :
’ rax <- right ankle side-to-side. On pin0
’ ray <- right ankle front-to-back. On pin1
’ rkn <- right knee. On pin2
’ rhx <- right hip front-to-back. On pin3
’ rhy <- right hip side-to-side. On pin4
’ rht <- right hip twist. on pin5
’ lax <- left ankle side-to-side. On pin16
’ lay <- left ankle front-to-back. On pin17
’ lkn <- left knee. On pin18
’ lhx <- left hip front-to-back. On pin19
’ lhy <- left hip side-to-side. On pin20
’ lht <- left hip twist. on pin21
’ ttm <- time to take for the current move.
’ rax ray rkn rhx rhy rht lax lay lkn lhx lhy lht ttm
Moves wordtable 1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,2000, |’ First position for step sequence, and time to move, put in your values here.
1500,1125,1825,1125,1500,1500,1500,1825,1125,1825,1500,1500,2000, |’ Second position
1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,1500,2000, |’ Third …etc
1500,1825,1125,1825,1500,1500,1500,1125,1825,1125,1500,1500,2000 ’ Last (whithout the ‘,’ and the ‘|’)

’ Constants
’ ----------------------
NbMoves con 4 ’ yes ! you must count the lines in moves wordtable an put the value here
NbServo con 12 ’ it mean that you use 12 servos in moves wordtable…the last value is the Time

’ ----------------------
’ Init
’ ----------------------
’ First command to turn the servos on.
for i = 0 to 31 ’ and not 32 !
serout p15,i38400,"#", DEC i, “P”, DEC 1500] 'DEC i is enough, no need to add a ‘space’ (32) between commands (it cost time)
next
serout p15,i38400,[13] 'you must validate the previous command line with 13(CR) for the SSC-32 to execute it !

’ ----------------------
’ Main Loop
’ ----------------------
walk:
for i = 0 to NbMoves - 1 ’ we will read the Moves wordtable line by line…we reuse the ‘i’ variable here
gosub send_data
pause TimeValue ’ we return from send_data with the TimeValue computed
next
goto walk

’ ----------------------
'Sub routine
’ ----------------------
send_data:
for j = 0 to 5 ’ 0 to 5 = 6 servos from pin 0 to pin 5
serout p15,i38400,"#", DEC j, “P”, DEC Moves(j + i * (NbServo + 1))] ’ browsing Moves columns (with j) according to the line # (with i)
next
for j = 6 to NbServo - 1 ’ 6 to 11 = 6 servos from pin 16 to pin 21
serout p15,i38400,"#", DEC j + 10, “P”, DEC Moves(j + i * (NbServo + 1))] ’ browsing Moves columns (with j) according to the line # (with i)
next
TimeValue = Moves(NbServo + i * (NbServo + 1)) ’ reading the TimeValue for this move
serout p15,i38400,“T”, DEC TimeValue, 13] ’ sending the Time and validate the entire commands
return

i have tested the program with your values (copy and paste all the program you posted)…and it works !..
with the value you have entered the servo on P0 stay at 1500 and
the p1, p2, p3, p17, p18, p19 are moving.
are you sure about the SSC-32 Bauds jumpers ? only one must be on (just above the ‘B’ of the word ‘Baud’ on card) …set to 38400

i use a BA28 but it must work on a BA24 too

check the servos connection on SSC-32 card too.

are you sure that you have downloaded the program again on the BA24 after you have changed the values ? :wink: