PDA

View Full Version : Isopod resetting in the middle of a function


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

nmitech
06-06-08, 03:43 PM
I suspected it does not have enought PRAM to run, so try to split the FSTAND routine in two or three seperate routines and see if it fixes it.

mohanarpit
06-07-08, 10:37 PM
if i break it down into 4 sub routines, the first three execute properly then it gets resetted when i call the fourth. all the 4 sub routines are Similar ( only different motor positions ).

What i have noticed is that this does not happen in the intial functions i load , but as i load new functions , it starts happening.( is the memory too less for say 15 more of FSTAND type functions )

ALso in the end , i would need to run all the sub routines one after the other after a little time delay, so i would esentially need to run everything in order.

Should i shift to a Servo pod, would that definately increase the PRAM enough ?

What is th PRAM difference between the two ?

Thanks

RMDumse
06-09-08, 09:18 AM
if i break it down into 4 sub routines, the first three execute properly then it gets resetted when i call the fourth. all the 4 sub routines are Similar ( only different motor positions ).

Did you do the EEWORD after each?

The idea is there is a limited amount of RAM to create your new definitions in, before moving them to the much larger Flash. EEWORD moves defined words from RAM to Flash, freeing up the RAM for re-use.

What i have noticed is that this does not happen in the intial functions i load , but as i load new functions , it starts happening.( is the memory too less for say 15 more of FSTAND type functions )

Probably.

Here's the thing. Every hard number you put in a definition takes up two locations, one for the word LIT and then one for the number.

I see many numbers in FSTAND. As well as many lines. It is a very large definition.

Definitions can always be broken into smaller definitions, then strung together in a higher definition. Like pyramiding.


Should i shift to a Servo pod, would that definately increase the PRAM enough ?

What is th PRAM difference between the two ?

Well, yes, the ServoPod(TM) has much more memory, but that's not the point. A definition which is longer than the PRAM is still going to need to be broken up into steps and flashed one section at a time. While the ServoPod(TM) is 4x larger, the same principle applies. It's just a matter of scale.

PlugaPod(TM), IsoPod(TM)
32K x 16-bits words Program Flash <- where EEWORD takes definitions
512 x 16-bit words Program Ram <- where definitions are created

ServoPod(TM)
60K x 16-bit words Program Flash
2K x 16-bit words Program ram