hello ALL ,
I build line follower robot -based pic16F877A and ULN2003A when i made the program it is work with isiss, but when i put it in the pic 1 motor rotates and the other 1 no pls check it fot me , i write it with micro pascal , pls help me
This is the program :
program Robotsuiveurdeligne;
var x,y : LONGINT;
v :longint;
txt: string[10];
begin
TRISC:=0;
PORTC:=0;
USART_init(9600);
lcd_config(portb,0,1,2,3,portb,6,5,4);
lcd_cmd(LCD_CURSOR_OFF);
lcd_out(1,1,' ROBOT SUIVEUR ');
lcd_out(2,1,' DE LIGNE M_Y ');
begin
if Usart_Data_Ready = 1 then
begin
USART_write(Usart_Read);
end;
end;
adcon1:=$80; // activation du convertisseur
//pwm_init(1500); // activation du MLI
//pwm_change_duty(180); // changement du rapport cyclique
//pwm_start;
while (true) do
begin
x:=adc_read(0);
y:=adc_read(1);
if (x > (y+40)) then
begin
PORTC.0:=1;
PORTC.1:=0;
PORTC.2:=1;
PORTC.4:=0;
end else
if (y > (x+40)) then
begin
PORTC.0:=0;
PORTC.1:=1;
PORTC.2:=0;
PORTC.4:=1;
end else
begin
PORTC.0:=1;
PORTC.1:=0;
PORTC.2:=0;
PORTC.4:=1; end;
end;
end.
pls help me and i wanna the lcd affiche when the robot turns right ,display right and when turns left , display left .
I build line follower robot -based pic16F877A and ULN2003A when i made the program it is work with isiss, but when i put it in the pic 1 motor rotates and the other 1 no pls check it fot me , i write it with micro pascal , pls help me
This is the program :
program Robotsuiveurdeligne;
var x,y : LONGINT;
v :longint;
txt: string[10];
begin
TRISC:=0;
PORTC:=0;
USART_init(9600);
lcd_config(portb,0,1,2,3,portb,6,5,4);
lcd_cmd(LCD_CURSOR_OFF);
lcd_out(1,1,' ROBOT SUIVEUR ');
lcd_out(2,1,' DE LIGNE M_Y ');
begin
if Usart_Data_Ready = 1 then
begin
USART_write(Usart_Read);
end;
end;
adcon1:=$80; // activation du convertisseur
//pwm_init(1500); // activation du MLI
//pwm_change_duty(180); // changement du rapport cyclique
//pwm_start;
while (true) do
begin
x:=adc_read(0);
y:=adc_read(1);
if (x > (y+40)) then
begin
PORTC.0:=1;
PORTC.1:=0;
PORTC.2:=1;
PORTC.4:=0;
end else
if (y > (x+40)) then
begin
PORTC.0:=0;
PORTC.1:=1;
PORTC.2:=0;
PORTC.4:=1;
end else
begin
PORTC.0:=1;
PORTC.1:=0;
PORTC.2:=0;
PORTC.4:=1; end;
end;
end.
pls help me and i wanna the lcd affiche when the robot turns right ,display right and when turns left , display left .
Attachments
-
127.7 KB Views: 15