mohanarpit
06-06-08, 02:22 AM
Hi
First of all , thanks for the great support you guys have provided in the past.
There are few other forums today providing this kind of support even to novices like me.
I have built a biped and am using the Isopod to control it. The motors are being driven via the SSC-32 ( purchased from lynxmotion) and the Isopod only sends out signals to the SSC-32 via the SCI1 port.
The problem is, the Isopod resets in the middle of the function that I am trying to execute. I suspect stack overflow. I have pasted the code below. Is there something I am missing out ? Also is there any way to induce delays ( like 250ms etc ) in Isomax ? I am currently using very primitive empty loops ( which I don't think is the best way )
Here is the code:
VARIABLE FLAGT EEWORD
( this function sets the baud rate of the sci1 port )
: SETBAUDRATE
38400 SCI1 BAUD
; EEWORD
( this function outputs the ASCII value of any given number )
: AS
48 +
;
( this function outputs the syntax accepted by the SSC 32 )
: PS
35 SCI1 TX
SWAP
DUP
7 = NOT IF
DUP
10 < IF AS SCI1 TX ELSE
10 /MOD AS SCI1 TX AS SCI1 TX
THEN
80 SCI1 TX
1000 /MOD DUP 0 = IF DROP ELSE AS SCI1 TX THEN
100 /MOD AS SCI1 TX 10 /MOD
AS SCI1 TX
AS SCI1 TX
THEN
; EEWORD
( this function outputs a carriage return )
: EN
13 SCI1 TX
; EEWORD
( this function outputs the time required by the SSC-32 to execute the move )
: T
0 FLAGT !
84 SCI1 TX
10000 /MOD DUP 0= IF DROP 0 FLAGT ! ELSE
AS SCI1 TX 1 FLAGT !
THEN
1000 /MOD DUP 0= IF FLAGT @ 0= IF DROP ELSE
AS SCI1 TX THEN ELSE AS SCI1 TX
1 FLAGT !
THEN
100 /MOD DUP 0= IF FLAGT @ 0= IF DROP ELSE
AS SCI1 TX THEN ELSE AS SCI1 TX 1 FLAGT !
THEN
10 /MOD DUP 0= IF FLAGT @ 0= IF DROP ELSE
AS SCI1 TX THEN ELSE AS SCI1 TX
1 FLAGT !
THEN
AS SCI1 TX
; EEWORD
( this function induces a delay of 125 ms )
: WAIT
50000 0 DO LOOP
; EEWORD
AUTOSTART SETBAUDRATE
SAVE-RAM
The syntax accepted by the SSC-32 is #motor no. <space> pulsewidth P <time in ms> T <cr>
( this function resets in the middle . it is intended to make the robot stand when fallen down )
: FSTAND
3 1900 PS 6 600 PS 5 600 PS 20 600 PS 4 1500 PS
12 1100 PS 14 2400 PS 25 2400 PS 26 2400 PS 21 1500 PS 250 T EN
4 WAIT
2 1500 PS 9 1500 PS 15 1950 PS 1 1050 PS 8 1500 PS
0 1120 PS 29 2065 PS 27 1100 PS 17 1000 PS
18 740 PS 19 1080 PS 16 1960 PS
28 740 PS 31 1000 PS 30 1980 PS 250 T EN
4 WAIT
4 2100 PS 21 950 PS 20 2250 PS 26 750 PS
6 1500 PS 14 1500 PS 100 T EN
4 WAIT
0 1950 PS 27 1950 PS 100 T EN
4 WAIT
1 1500 PS 15 1500 PS EN
2 WAIT
1 1920 PS 15 1080 PS 29 1565 PS 17 1500 PS 4 1500 PS 21 1500 PS 200 T EN
;
Is there something vital that I have not noticed or not understood about Isomax ( I am still a novice )
Thanks again
Arpit
First of all , thanks for the great support you guys have provided in the past.
There are few other forums today providing this kind of support even to novices like me.
I have built a biped and am using the Isopod to control it. The motors are being driven via the SSC-32 ( purchased from lynxmotion) and the Isopod only sends out signals to the SSC-32 via the SCI1 port.
The problem is, the Isopod resets in the middle of the function that I am trying to execute. I suspect stack overflow. I have pasted the code below. Is there something I am missing out ? Also is there any way to induce delays ( like 250ms etc ) in Isomax ? I am currently using very primitive empty loops ( which I don't think is the best way )
Here is the code:
VARIABLE FLAGT EEWORD
( this function sets the baud rate of the sci1 port )
: SETBAUDRATE
38400 SCI1 BAUD
; EEWORD
( this function outputs the ASCII value of any given number )
: AS
48 +
;
( this function outputs the syntax accepted by the SSC 32 )
: PS
35 SCI1 TX
SWAP
DUP
7 = NOT IF
DUP
10 < IF AS SCI1 TX ELSE
10 /MOD AS SCI1 TX AS SCI1 TX
THEN
80 SCI1 TX
1000 /MOD DUP 0 = IF DROP ELSE AS SCI1 TX THEN
100 /MOD AS SCI1 TX 10 /MOD
AS SCI1 TX
AS SCI1 TX
THEN
; EEWORD
( this function outputs a carriage return )
: EN
13 SCI1 TX
; EEWORD
( this function outputs the time required by the SSC-32 to execute the move )
: T
0 FLAGT !
84 SCI1 TX
10000 /MOD DUP 0= IF DROP 0 FLAGT ! ELSE
AS SCI1 TX 1 FLAGT !
THEN
1000 /MOD DUP 0= IF FLAGT @ 0= IF DROP ELSE
AS SCI1 TX THEN ELSE AS SCI1 TX
1 FLAGT !
THEN
100 /MOD DUP 0= IF FLAGT @ 0= IF DROP ELSE
AS SCI1 TX THEN ELSE AS SCI1 TX 1 FLAGT !
THEN
10 /MOD DUP 0= IF FLAGT @ 0= IF DROP ELSE
AS SCI1 TX THEN ELSE AS SCI1 TX
1 FLAGT !
THEN
AS SCI1 TX
; EEWORD
( this function induces a delay of 125 ms )
: WAIT
50000 0 DO LOOP
; EEWORD
AUTOSTART SETBAUDRATE
SAVE-RAM
The syntax accepted by the SSC-32 is #motor no. <space> pulsewidth P <time in ms> T <cr>
( this function resets in the middle . it is intended to make the robot stand when fallen down )
: FSTAND
3 1900 PS 6 600 PS 5 600 PS 20 600 PS 4 1500 PS
12 1100 PS 14 2400 PS 25 2400 PS 26 2400 PS 21 1500 PS 250 T EN
4 WAIT
2 1500 PS 9 1500 PS 15 1950 PS 1 1050 PS 8 1500 PS
0 1120 PS 29 2065 PS 27 1100 PS 17 1000 PS
18 740 PS 19 1080 PS 16 1960 PS
28 740 PS 31 1000 PS 30 1980 PS 250 T EN
4 WAIT
4 2100 PS 21 950 PS 20 2250 PS 26 750 PS
6 1500 PS 14 1500 PS 100 T EN
4 WAIT
0 1950 PS 27 1950 PS 100 T EN
4 WAIT
1 1500 PS 15 1500 PS EN
2 WAIT
1 1920 PS 15 1080 PS 29 1565 PS 17 1500 PS 4 1500 PS 21 1500 PS 200 T EN
;
Is there something vital that I have not noticed or not understood about Isomax ( I am still a novice )
Thanks again
Arpit