subot.robot
08-18-05, 02:24 AM
I wrote a program for servopod to send pwm signal to servo motors . I have stored this program on to flash. This program is running ( which i inferred by using a sequence of led on off commands) on the flash. But PWM commands are not working. When the same program is run from the terminal it is working. Can u please help me figure out why this might have happened. I am pasting my program here. I have been able to run the RAM version of the same program without changing any connections on the servopod. The program is a simple one. there are 4 states. it starts at RON, then to RFORWARD, then RBACKWARD then ROFF. The LED commands in each state is working, but PWM statements are not working. I think I have added EEWORD, IN-EE where ever necessary, plz let me know if I have missed out somewhere. Can u please let me know where i have gone wrong?
SCRUB
: PARAMETERPWM
DECIMAL 32767 PWMA0 PWM-PERIOD
PWMA0 INDEPENDENT
PWMA2 INDEPENDENT
PWMA4 INDEPENDENT
; EEWORD
LOOPINDEX MAX-COUNTER EEWORD
DECIMAL 200 MAX-COUNTER END
1 MAX-COUNTER START
MACHINE MAX-ROBOT EEWORD
ON-MACHINE MAX-ROBOT
APPEND-STATE RON EEWORD
APPEND-STATE ROFF EEWORD
APPEND-STATE RFORWARD EEWORD
APPEND-STATE RBACKWARD EEWORD
REDLED OFF
GRNLED OFF
YELLED OFF
IN-STATE RON
CONDITION MAX-COUNTER COUNT
CAUSES
GRNLED ON
YELLED OFF
REDLED OFF
DECIMAL 10000 PWMA1 PWM-OUT
DECIMAL 10000 PWMA2 PWM-OUT
DECIMAL 7500 PWMA3 PWM-OUT
THEN-STATE RFORWARD
TO-HAPPEN IN-EE
IN-STATE RFORWARD
CONDITION MAX-COUNTER COUNT
CAUSES
YELLED ON
REDLED OFF
GRNLED OFF
DECIMAL 4500 PWMA1 PWM-OUT
DECIMAL 5500 PWMA2 PWM-OUT
DECIMAL 6500 PWMA3 PWM-OUT
THEN-STATE RBACKWARD
TO-HAPPEN IN-EE
IN-STATE RBACKWARD
CONDITION MAX-COUNTER COUNT
CAUSES
REDLED ON
YELLED OFF
GRNLED OFF
PWMA1 OFF
PWMA2 OFF
PWMA3 OFF
THEN-STATE ROFF
TO-HAPPEN IN-EE
: MAIN
DECIMAL
RON SET-STATE
EVERY 50000 CYCLES SCHEDULE-RUNS MAX-ROBOT
; EEWORD
HEX 3C00 AUTOSTART MAIN
SAVE-RAM
Thanks
Subot.robot
SCRUB
: PARAMETERPWM
DECIMAL 32767 PWMA0 PWM-PERIOD
PWMA0 INDEPENDENT
PWMA2 INDEPENDENT
PWMA4 INDEPENDENT
; EEWORD
LOOPINDEX MAX-COUNTER EEWORD
DECIMAL 200 MAX-COUNTER END
1 MAX-COUNTER START
MACHINE MAX-ROBOT EEWORD
ON-MACHINE MAX-ROBOT
APPEND-STATE RON EEWORD
APPEND-STATE ROFF EEWORD
APPEND-STATE RFORWARD EEWORD
APPEND-STATE RBACKWARD EEWORD
REDLED OFF
GRNLED OFF
YELLED OFF
IN-STATE RON
CONDITION MAX-COUNTER COUNT
CAUSES
GRNLED ON
YELLED OFF
REDLED OFF
DECIMAL 10000 PWMA1 PWM-OUT
DECIMAL 10000 PWMA2 PWM-OUT
DECIMAL 7500 PWMA3 PWM-OUT
THEN-STATE RFORWARD
TO-HAPPEN IN-EE
IN-STATE RFORWARD
CONDITION MAX-COUNTER COUNT
CAUSES
YELLED ON
REDLED OFF
GRNLED OFF
DECIMAL 4500 PWMA1 PWM-OUT
DECIMAL 5500 PWMA2 PWM-OUT
DECIMAL 6500 PWMA3 PWM-OUT
THEN-STATE RBACKWARD
TO-HAPPEN IN-EE
IN-STATE RBACKWARD
CONDITION MAX-COUNTER COUNT
CAUSES
REDLED ON
YELLED OFF
GRNLED OFF
PWMA1 OFF
PWMA2 OFF
PWMA3 OFF
THEN-STATE ROFF
TO-HAPPEN IN-EE
: MAIN
DECIMAL
RON SET-STATE
EVERY 50000 CYCLES SCHEDULE-RUNS MAX-ROBOT
; EEWORD
HEX 3C00 AUTOSTART MAIN
SAVE-RAM
Thanks
Subot.robot