Delay in program execution
J Ludwig
Posts: 19
I am using a single accelerometer axis from a Sparkfun 5DOF module connected to an MCP3208 A/D using the code from the Propeller software v1.2.6. There is an RC servo connected to the prop using the ASM code from the DAT section of Single_Servo_Assembly by Gavin Garner. The goal is to have the arm on the servo stay level when the 5DOF is tilted. It works but there is around a 55 second delay from the time I load it until it starts working. (In another version I have a Parallax 2-line serial LCD attached to monitor values. The delay is the same but then after several operations, the LCD backlight shuts off and the text on the screen disappears - but the servo continues to work.) I suspect it is a stack issue but haven't found a solution. Any thoughts on what causes the delay?
Thanks, Jim
Thanks, Jim
Comments
Your assembler code is running before you setup your position variable (it defaults to 0 as a global). Therefore the initial waitcnt target calculation results in a cycle count which you just missed, i.e. you have to wait for the counter to wrap once (53.6sec @80MHz).
Quick fix, setup position with some safe default value (=> 13) before starting the PASM cog.
Jim