![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Stepper Motors and Drives Discuss stepper motors, drivers and related topics here. |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Over the weekend I have cut traces on an existing controller board that used PIC16F84's, and have replaced the 3 PICs with one Propeller chip, I have everything very close to being right on the motor control end of it. I am now trying to get the encoders dialed in on the program. The motors have USdigital E2-200 encoders already factory installed, and they were fine with the old system. I am bringing in each encoders A and B, setting a mask that waits for A and B to be low, then another mask to wait for A to be high, then after that I determine with IF THEN whether B is high or low to increment or decrement the counter for that motor(i.e. XEncCount). On each pulse to the motor output I add or subtract to another counter called Xcount. 1 count for each motor pulse at 200 pulses per rev, and 1 count per encoder at 200 counts per rev, so they are both the same resolution. I notice that turning by hand and counting detents, it never gets off on the counters, but using the motors, it picks up some noise and ads 2 or 3 pulses each direction. Also, on the old system, if you tried to turn a threaded rod on an axis sitting still, it would fight you to get back to its position. How do you write that code? What method is there to keep track of where the motor "should be?" Would that simply be IF XencCount(encoder counter) <> Xcount by X, move motor X? If you are cutting a part and it misses a pulse, what do you want the machine to do? I would say stop it, but based on the fact that the other controller seemed to want to keep correcting itself, I am sondering if there are different schools of thought on it. Thanks for any tips. What a heck of a lot of work, but a nice learning experience though. Last edited by originator; 10-02-2006 at 04:27 AM. |
|
#2
| |||
| |||
| You will need to get a few PIC18F2331s to drive your steppers easier. The 18Fxx31 units have a built in quadrature encoder interface which can handle count rates up to Fosc/8. As far as software decoding, search for quadrature encoder on sxlist.com and you will find several software methods that are much faster than your method. I have not looked much at the propeller but you will probably need to dedicate a cog to each encoder input. For the closed loop control, check out MicroChips (PIC) website and look for the servo application notes. They describe in detail how to impliment a PID compensator. If you go with the PIC chip, I can work with you as I am designing a servo controller based on the PIC18F4431 for hobby use target price <$100 10amp - 120V (options to go higher in voltage and current) Step&Direction or EPP parallel interface. accessories - EPP opto-isolated interface/BOB, relay card Aaron |
|
#3
| |||
| |||
| Thanks for the sxlist tip. I knew there was a Jon Williams SX/B code somewhere but had no luck finding it, it was on the sxlist as you said. I am assigning 1 encoder per cog on the Propeller and one motor per cog as well. I know the chip to some extent and can work my way around the Spin, or basic style language, much easier than a PIC, although Pic basic may be something to look at one day. For now I need to get things back to normal right away so I'll have to stick with what I am familiar with for this go around. The encoder code you pointed out is nice and I am going to translate the useful parts now. I appreciate the offer on the controller, I am going to try to go the Propeller route as I think it is more than fast enough to do all control and encoder transalation. Thanks again. Amazing.. I just found a Rotary Encoder Object for the Propeller, just plug it in and instant decoding! Thats one reason I like this thing so much. Last edited by originator; 10-03-2006 at 01:47 AM. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |