esgalven
Newbie level 3
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
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