Abb to ssc-32, digital inputs

hi guys,

i am a noob :unamused: to the programming side of things, ive managed to do a few
things so far such as sending code from my seq software to my abb (with basic pro28)which then controls the ssc-32. it plays seq’s great, but now i am wanting to control these sequences with simple switches(I/0), does anyone have any code i could manipulate please? im goin nuts… iv tried to make my own code but no luck…

[code]**delay var byte
rate var byte
count1 var byte

delay=80
rate=40
startloop
button p4,0,delay,rate,count1,1,right
goto startloop
right
Steps Wordtable $03E8, $0BE8, $13E8, $1BE8, $23E8, $2BE8, $33E8, $3BE8, $43E8, $4BE8, $53E8, $5BE8, $63E8, $6BE8, $73E8, $7BE8, $83E8, $8BE8, $93E8, $9BE8, $A3E8, $ABE8, $B3E8, $BBE8, $C3E8, $CBE8, $D3E8, $DBE8, $E3E8, $EBE8, $F3E8, $FBE8, $F81F, $F81F, |
$07D0, $001F, $001F, |
$0FD0, $081F, $081F, |
$17D0, $101F, $101F, |
$1FD0, $181F, $181F, |
$27D0, $201F, $201F, |
$2FD0, $281F, $281F, |
$37D0, $301F, $301F, |
$3FD0, $381F, $381F, |
$47D0, $401F, $401F, |
$4FD0, $481F, $481F, |
$57D0, $501F, $501F, |
$5FD0, $581F, $581F, |
$67D0, $601F, $601F, |
$6FD0, $681F, $681F, |
$77D0, $701F, $701F

SeqPos Wordtable $0000, |
$004F

SeqIndex var Word
Index var Word
LastServo var Byte
TmpServo var Byte
TmpValue var Word
DejaVu var bit

LastServo = 99
DejaVu = 0

pause 500

Main
For SeqIndex = 0 to 0
For Index = SeqPos(SeqIndex) to SeqPos(SeqIndex + 1) - 1
TmpServo = Steps(Index) >> 11
TmpValue = Steps(Index) & 2047
if LastServo = TmpServo then
TmpValue = TmpValue << 5
if DejaVu then
Pause TmpValue
LastServo = 99
else
serout p0,i38400,“T”, DEC TmpValue, 13]
DejaVu = DejaVu ^ 1
endif
else
TmpValue = TmpValue + 500
serout p0,i38400,"#", DEC TmpServo, “P”, DEC TmpValue]
DejaVu = 0
LastServo = TmpServo
endif
next
next
goto Maingoto
startloop[/code]**

also, how would you plug in your I/O switches to the abb? iv been pluggin mine in P4 (push=1 release=O) with one wire on signal and one on positive?

oh im using 08.0.1.07 ide
please help :blush:

Welcome,

I will try to give you a couple of quick thoughts. However I am leaving in a couple of minutes so sorry if I am a bit brief.

Not sure what no luck means. Is your sequence part of the code being called at all or all of the time?

Do you have the Atom Bot Board or Bot Board 2? If it is the original ABB, then the onboard switches and LEDS are on IO pins 4,5,6 and if you have the jumpers in place you may be fighting with this logic. You might try either using the onboard switches or try moving your switch to another input, like maybe P11?

At the end you have:
goto Maingot
Startloop

Not sure what this is supposed to be? Maybe you meant to have the goto Startloop replace the goto Main?

Again good luck. Sorry I have to run…

Kurt

hi Kurt, thank you for your reply,

i need to make or manipulate :wink: a code that will control my biped with just simple microswitches to start with, i guess i need a main program running the servos making my biped move forwards, then when the button is pressed or the robot bumps into something then this interupts the main program and makes the robot move backwards then turn left for a short time then returns to the main program until it bumps ito another object. i can make my bot board 2 (with atom pro28 pin) speak to the ssc-32 and make a sequence loop, but cannot seem to make a button control a sequence??

heres how the code is in my IDE;

[code]
delay var byte
rate var byte
count1 var byte

delay=80
rate=40
startloop
button p4,0,delay,rate,count1,1,right
goto startloop
right
Steps Wordtable $03E8, $0BE8, $13E8, $1BE8, $23E8, $2BE8, $33E8, $3BE8, $43E8, $4BE8, $53E8, $5BE8, $63E8, $6BE8, $73E8, $7BE8, $83E8, $8BE8, $93E8, $9BE8, $A3E8, $ABE8, $B3E8, $BBE8, $C3E8, $CBE8, $D3E8, $DBE8, $E3E8, $EBE8, $F3E8, $FBE8, $F81F, $F81F, |
$07D0, $001F, $001F, |
$0FD0, $081F, $081F, |
$17D0, $101F, $101F, |
$1FD0, $181F, $181F, |
$27D0, $201F, $201F, |
$2FD0, $281F, $281F, |
$37D0, $301F, $301F, |
$3FD0, $381F, $381F, |
$47D0, $401F, $401F, |
$4FD0, $481F, $481F, |
$57D0, $501F, $501F, |
$5FD0, $581F, $581F, |
$67D0, $601F, $601F, |
$6FD0, $681F, $681F, |
$77D0, $701F, $701F

SeqPos Wordtable $0000, |
$004F

SeqIndex var Word
Index var Word
LastServo var Byte
TmpServo var Byte
TmpValue var Word
DejaVu var bit

LastServo = 99
DejaVu = 0

pause 500

Main
For SeqIndex = 0 to 0
For Index = SeqPos(SeqIndex) to SeqPos(SeqIndex + 1) - 1
TmpServo = Steps(Index) >> 11
TmpValue = Steps(Index) & 2047
if LastServo = TmpServo then
TmpValue = TmpValue << 5
if DejaVu then
Pause TmpValue
LastServo = 99
else
serout p0,i38400,“T”, DEC TmpValue, 13]
DejaVu = DejaVu ^ 1
endif
else
TmpValue = TmpValue + 500
serout p0,i38400,"#", DEC TmpServo, “P”, DEC TmpValue]
DejaVu = 0
LastServo = TmpServo
endif
next
next
goto Main
goto startloop[/code]

Please help?? :smiling_imp:

forgot to say… when i try the above code the servos just loop there sequence…

The first thing I would look at is your last two lines of code.

In particular you have a goto main, followed by a goto Startloop. This last line will never be executed. Try removing the goto main and see if maybe this helps.