So I wrote a program to run a stepper motor. If I run the motor from the same Task where I am processing the angles and what not the motor runs slow and I cant get it to the right RPM (I assume because of the lines between the motor steps). My solution is running the motor in a Parallel Task which works great but I found a new problem: As soon as I use the label Start1: in the fist task the program runs through the program lines twice between all the labels ( Main:, STP1:, STP2:, .....) so I'm counting into B2 and simulating the program it does all lines in first task twice so on one of lines I have "Let B2=B2+1" is counts by multiples of 2 and when I want it to stop at an odd number with an "IF Then" command it does not work. I discovered this problem by running the program and when my "ReadADC" equals 255 the program gets stuck in an endless loop due to rollover and the angle I select the stepper motor to do (via "ReadADC") is half of what it is supposed to be. When I get rid of the Parallel task and change the "Start1:" to "Start:" the program works proper. I noticed I had trouble with Parallel Tasks before and I assume I had the same prob. I attached the program for others to see. If you debug when running or if you view the Ram during simulation you will notice the issue where B2 counts twice before the next line. Is there a way around this issue? I'm running editor 6.1.0.0. and using an 14M2 chip
Thanks much
Thanks much
Attachments
-
722 bytes Views: 1
Last edited: