Proteus: We will use RC0 and RC1 output to control the motor. L293D will drive the motor.
RC0=1, RC1=0 will turn CW
RC0=0, RC1=1 will turn CCW
RC0=0, RC1=0 will stop
XC8: inside the main while(1) loop you can change RC0, RC1 pins as you want. turn CW, turn CCW and stop for example.
while (1)
{
// Add your application code
IO_RC0_SetHigh();
__delay_ms(2000);
IO_RC0_SetLow();
IO_RC1_SetHigh();
__delay_ms(2000);
IO_RC0_SetLow();
IO_RC1_SetLow();
__delay_ms(2000);
}
download the example
Hiç yorum yok:
Yorum Gönder