Roy Spiller
New Member
Hi i have two motors with a hall sensor on each with a full reel of tape on one and an empty spool on the other, i need to run the tape of the full one onto the empty one and back again without the tape running off (going to far). My idea is to count both sensor pulse's until they are the same which would be the middle of the tape then double that amount to reach the end. The motors are working fine but i can only get it to count on one channel at a time therefore i cannot compare both counts. I have just found out the 40x2 does not support parallel tasks. is there any way i can count both pulses the same time on the 40x2, ihave built everthing else around this chip, or will i have to use one of the m type chips. This is one motor and sensor code thats works fine.
Roy
main:
if pinb.4 = 0 then test push button
goto main
test:
w0 = 0
w1 = 0
low b.6
pwmout c.2, 199, 500
do
do:loop until pinb.0 = 0
do:loop until pinb.0 = 1
w1 = w1 + 1
if w1 >= 1200 then high b.6 high a.5 endif brake and led
loop
Roy
main:
if pinb.4 = 0 then test push button
goto main
test:
w0 = 0
w1 = 0
low b.6
pwmout c.2, 199, 500
do
do:loop until pinb.0 = 0
do:loop until pinb.0 = 1
w1 = w1 + 1
if w1 >= 1200 then high b.6 high a.5 endif brake and led
loop