RE: Multiple loops interrupt each other :(
- Posted by "Weichel" <steen.weichel at deepspace.dk> Jan 13, 2004
- 374 views
The problem is that the motors are for driving a telescope. One axis tracks the earth rotation and have a constant but tunable rate + the option for slowing down or speeding up at a mouse click. Other axis corrects error in misalignment to earth axis that is it may have a slight constant drift in one direction + the option for slowing down or speeding up at a mouse click. So in the loops you have varying step speeds, currently controlled by a time() fkt. and a time constant after which the loop continues to the next step (4 steps for the four coils in the motor, then back again). All speeds are controlled by varying the time between steps for each motor. This is all working fine, but only one motor at a time. Therefore is I have to use only one loop it's very difficult not to have one motor stepping rate influenced by the rate of the other. Steen Weichel -----Original Message----- From: C. K. Lester [mailto:euphoric at cklester.com] Sent: 13. januar 2004 21:06 To: EUforum at topica.com Subject: Re: Multiple loops interrupt each other :( Weichel wrote: >I am trying to merge bit patterns for the parallel port data segment that is >the 8 data out registers. > >I have one stepper running one the four first bits, the other on the next >four bits. >Of course writing only to set a bit state for only one of the motors, will >also set the bits of the other motor. >So i have to merge the bit patterns into one bit pattern output for the port >which provides the required state for both motors. > >Any comments? and thanks for the advice. > > For each time interval, why not just read the whole port and have it process all the data? I don't get it (but that's not unusual). :) -- pseudo-code follows while i_say_go do x = read_port() y = left_4_bits(x) z = right_4_bits(x) y = process(y) z = process(z) x = combine(y,z) write_to_port( x ) end while TOPICA - Start your own email discussion group. FREE! --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.536 / Virus Database: 331 - Release Date: 03-11-2003 ---