| ??? 12/07/00 20:30 Read: times |
#7068 - RE: add more routines |
Hi Dan,
Did the response on this board help you? What turned out to be the problem? Telling this could help others! Controlling speed and movement: Use an auto reloading timer's overflow rate to control the rotation speed, and a RAM variable to count the amount of steps needed to move a desired angle. Load the counting variable with the amount of steps you want to take, set the timer up to achieve the desired speed, enable it's interrupt and start it. In this timer's interrupt. * Keep a copy of what you last wrote to the motor (eg. 00000101b) in a RAM variable * Within the timer interrupt, recall the previous motor data, use rotate instructions to manipulate the data according to the desired direction, then store the new data back to RAM. Also write it to the motor port (or your motor won't move =). * Decrease the counter. Stop the timer and disable it's interrupt to prevent more movement if the counter reaches 0. In short: abandon the direct approach you've taken towards the motor so far. The beauty with this is: you spend very little CPU time on the motor this way, freeing it for other usefull stuff. The trouble with motors. Your controller doesn't know what position they're in when you turn the power on. To make your system somewhat predictable, you'll need a "0 degrees sensor", for instance a microswitch, and turn the motor until this switch is activated after power up. Keep us informed about how you're doing. |
| Topic | Author | Date |
| add more routines | 01/01/70 00:00 | |
| RE: add more routines | 01/01/70 00:00 | |
| RE: add more routines | 01/01/70 00:00 | |
RE: add more routines | 01/01/70 00:00 |



