 |
:: مهندس ::
تاريخ التسجيل: Feb 2016
الدولة: الجزائر
المشاركات: 16
|
|
نشاط [ ardjarsamba ]
قوة السمعة:0
|
|
12-02-2017, 06:41 PM
المشاركة 1
|
|
سلام عليكم مجتاج مساعدتكم يامهندسين .وجد ابرنامج دا . بس مابيدعم التحكم بواسطة الكمبيوتر .يعني البرنامج ناقص .........................................
program PROGRAMME;
var V1,V2,I1,I2,ordre,k : integer;
const PAS1 : array[8] of byte = (%00000101,%00000001,%00001001,%00001000,%00001010 ,%00000010,%00000110,%00000100) ;
const PAS2 : array[8] of byte = (%10100000,%10000000,%10010000,%00010000,%01010000 ,%01000000,%01100000,%00100000) ;
procedure init;
begin
trisd:=0;
portd:=0;
ADCON1:=$82;
intcon:=0;
trisa:=$FF;
trise:=$0;
V1:=30;
V2:=30;
I1:=0;
I2:=0;
USART_init(9600); TRISC:=%10111111;
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,' LFSTIC3 FST ');
end;
procedure communication;
begin
if Usart_Data_Ready = 1 then
begin
ordre := Usart_Read;
USART_write(ordre);
end;
end;
procedure pas_avant_M1;
begin
portD:=((portD AND %11110000) OR PAS1[I1]);
vdelay_ms(V1);
I1:=I1+1;
if I1=8 then I1:=0;
end;
procedure pas_avant_M2;
begin
portD:=((portD AND %00001111) OR PAS2[I2]);
vdelay_ms(V2);
I2:=I2+1;
if I2=8 then I2:=0;
end;
procedure pas_ar_M1;
begin
portD:=((portD AND %11110000) OR PAS1[I1]);
vdelay_ms(V1);
I1:=I1-1;
if I1<0 then I1:=7;
end;
procedure pas_ar_M2;
begin
portD:=((portD AND %00001111) OR PAS2[I2]);
vdelay_ms(V2);
I2:=I2-1;
if I2<0 then I2:=7;
end;
procedure commande_manuelle;
begin
if portc.0=1 then pas_avant_M1;
if portc.1=1 then pas_ar_M1;
if portc.2=1 then pas_avant_M2;
if portc.3=1 then pas_ar_M2;
end;
// programme principal
begin
init;
while (true) do
begin
commande_manuelle;
communication;
if (ordre = 'A') then pas_avant_M1;
if (ordre = 'B') then pas_avant_M2;
if (ordre = 'C') then begin pas_avant_M2;pas_avant_M1; end;
if (ordre = 'D') then begin pas_ar_M2;pas_ar_M1; end;
end;
end.
|
ممكن تساعدوني او ترشيدوني على صفحة فيها مثل هذا البرنامج
|