Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using 16F628a as Speed Control

Status
Not open for further replies.

gogo2520

New Member
Hello
I am new to using the capture, capare/campare and PWM operations. I am using a Pic16F628a and could use some direction. Here is what I want to do. I want to set up a Pot and have the mcu read the value to see if it increases or decreases then adjust a delay accordingly. I am not sure about what way to go. I have the data sheet and the mid-range manual. and having fun trying to figure it out but I am not getting a desired result. Pretty much what I am doing is using the code on the data sheets and running them in the MPLAB simulator, watching the file registers and changing this and that around to see what happens and watch some more. End results would be making a speed control for a stepper motor.
Could anyone steer me in the right direction.
Thanks in advance.
gogo
 
The 16F627A isn't a good choice as it doesn't have an A/D converter. You can read a pot without one but it is more difficult.

Speed control on a stepper motor is done by changing the delay between each phase of the stepper motor drive.

What I would do is this:-

Each time TMRO rolls:-
Read A/D converter.
subtract result from accumulator
If accumulator has rolled, move on stepper motor one step.

Obviously there are several things that need setting up when it turns on, and the timer settings and the size of the accumulator need to be decided to get the speed correct.

You need power drivers to provide current to the stepper motor.

Stepper motors run much more smoothly if you turn off each phase in between running it forwards and backwards. The phase sequence I suggest is:-

A+ B+
A+ B0
A+ B-
A0 B-
A- B-
A- B0
A- B+
A0 B+

where A+ means energise A winding forwards, A0 means turn it off and A- means turn it on backwards.
 
Thank you for the reply. I am using a 16F628a because I have a lot of them. The reason I want to use a pot instead of using push buttons is because pots look neater. I was reading something about using capacitors with a pot heirs the thread **broken link removed**
have fun
gogo
 
Status
Not open for further replies.

Latest threads

Back
Top