Mani Yuvan
Member level 1
- Joined
- Jan 18, 2015
- Messages
- 41
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Location
- Tamilnadu , India
- Activity points
- 321
Hang problem on Motor control in pic
i done the wireless control dc motor interface with pic. I check the output in Proteus successfully and also i checked in the real time.it works good but after some time it's not responding the control key example when i pressed forward direction it not responded.after some time gap it respond. i also attach my coding..here....
i done the wireless control dc motor interface with pic. I check the output in Proteus successfully and also i checked in the real time.it works good but after some time it's not responding the control key example when i pressed forward direction it not responded.after some time gap it respond. i also attach my coding..here....
Code:
#include<p18f452.h>
#include"H:\RECovery RObot\header files\motor.h"
#include"H:\RECovery RObot\header files\delay.h"
#include"H:\RECovery RObot\header files\ladder.h"
#pragma config OSC=HS, OSCS=OFF
#pragma config DEBUG=OFF, LVP=OFF, STVR=OFF
#pragma config WDT=OFF
#pragma config BOR=OFF, PWRT=OFF
#define s1 PORTBbits.RB2
#define s2 PORTBbits.RB3
#define s3 PORTBbits.RB4
#define s4 PORTBbits.RB5
void main()
{
TRISBbits.TRISB2=1;
TRISBbits.TRISB3=1;
TRISBbits.TRISB4=1;
TRISBbits.TRISB5=1;
TRISCbits.TRISC0=0;
TRISCbits.TRISC1=0;
TRISCbits.TRISC2=0;
TRISCbits.TRISC3=0;
TRISCbits.TRISC4=0;
TRISCbits.TRISC5=0;
ADCON1=0X07;
TRISAbits.TRISA0=0;
TRISAbits.TRISA1=0;
while(1)
{
if(s1&s3)
{
ladder_up();
breaks();
delay(200);
}
else if(s4&s3)
{
ladder_down();
breaks();
delay(200);
}
else if(s1&s2)
{
pump_r();
breaks();
delay(200);
}
else if(s4&s2)
{
pump_l();
breaks();
delay(200);
}
else if(s1==1)
{
stop();
rotate_f();
delay(200);
}
else if(s2==1)
{
stop();
rotate_r();
delay(200);
}
else if(s3==1)
{
stop();
rotate_l();
delay(200);
}
else if(s4==1)
{
stop();
rotate_b();
delay(200);//200 ms delay
}
else
{
breaks();
stop();
delay(200);
}
}
}
Last edited: