dc motor control with PIC microcontroller

Status
Not open for further replies.

esgalven

Newbie level 3
Joined
Feb 16, 2008
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,305
dc motor control...

hello to all.
i am new in programing pic.
i am good at programming plc but my prof. doesnt want to use it, because of high price.
i have a project. i am controlling a wire straightener machine.
i am using a 24V, 40 Watt dc motor to roll the rollers.

what i am trying to do is to control the motor by using pwm.
the motor should work under about 6-7.5 Vdc.
it should turn slowly in order to straight the wires effectively.

it has a start button and stop button.
but i have problem about them. coz i do not know how to assign it and
i use porta.f0 for input and porta.f1 for output.

void Main (){
int deger;
trisa=0x00;
trisc=0xff;
pwm_init(5000) ;
pwm_start() ;
porta=0x03;
while(1)
{ while(porta.f0=1,porta.f1=0)
{
deger=52;
PWM1_Change_Duty(deger);

while(porta.f1=0, porta.f1=1)
{
deger=5;
PWM1_Change_Duty(deger);
}
} } }


i am planning to use mikroc compiler. it is not working good.

my second question is ;
how to drive a motor , i want to use a h-bridge.
but i do not know where to connect it..

if anyone can answer my questions i will be so happy...


thanks
 

where is the shcematic of the project?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…