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.

How to use PIc to control a motor?

Status
Not open for further replies.

tmtyen

New Member
Hi guys!
i like to control a stepper motor using Pic16 Microcontroller by PWM technique, can you please help me?
1. Which program languages should i use? easy one i'm a beginner.
2. Which Pic16 is the best to use?
do know any useful link?
thank you very much.
tmt
 

TheAnimus

New Member
hey, first question i will probably get flamed for but i find ASM easyest to use, mainly cuas its risc, u just have 36 (ish) instructions, and once u get over some conceptual difficulties it makes life much simpler as long as u don't have to do not arithmetic maths.

16 series PIC realy depends on the rest of ur application some have PWM modules built in, which would make coding ur project a snip but might be un-necisserry if all the chip has to do is make PWM (555 would be easyest!).

In short could u say a little more about ur project, or just pic a 16 with a PWM and the datasheet tells u how to use it in ASM
 

motion

New Member
Use a PIC16F873-20Mhz with two PWM channels to control the current to the two phases of the motors. The PWM frequency is just under 20Khz. Couple the PIC to a pair of H-bridge circuits with current sensing resistors at the bottom of the bridge. Amplify the voltage from current sense resistors using op-amps and feed them into the analog-to-digital converter inputs of the PIC.

There is a newer pin compatible version. It's the PIC18F242-40Mhz. The advantage is that this PIC has a hardware multiply that is needed to calculate the PWM value corresponding to the error in the current level.

There is an application note at Microchip for a DC motor application but this will give you some idea on how to do it with steppers.

I also agree that assembly would be best, specially for the timing critical portion of the software that controls the current.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top