Académique Documents
Professionnel Documents
Culture Documents
On désire réaliser une programmation du Grafcet donné. Compléter le programme en Mikropascal selon le
montage à base du PIC suivant.
https://www.youtube.com/@TricitiFedi
1
X0:= ..................................... ;
X1:= ..................................... ;
X2:= ..................................... ;
//Equations des étapes
X3:= ..................................... ;
X4:= ..................................... ;
X5:= ..................................... ;
if (X1=1 OR ...... OR ......) then
...........................
else //Activation de la sortie KA1
...........................
if (X3=1) then
begin
...........................
Delay_ms(..........); t:=1;
end //Activation de la sortie KA2
else
................... ; t:=0;
end;
if (X4=1) then
...........................
else //Activation de la sortie KA3
...........................
end; end. //Fin du programme
On désire réaliser une programmation du Grafcet. Compléter le programme en Mikropascal du circuit PIC
afin de réaliser le grafcet donné selon le montage donné ci-dessous.
https://www.youtube.com/@TricitiFedi
2
program grafcet2; //nom du programme
var LCD_RS : sbit at PORTB.0;
var LCD_EN : sbit at PORTB.1;
var LCD_D4 : sbit at PORTB.2;
var LCD_D5 : sbit at PORTB.3;
var LCD_D6 : sbit at PORTB.4;
var LCD_D7 : sbit at PORTB.5; // connections du module Lcd
var LCD_RS_Direction :sbit at TRISB.0;
var LCD_EN_Direction :sbit at TRISB.1;
var LCD_D4_Direction :sbit at TRISB.2;
var LCD_D5_Direction :sbit at TRISB.3;
var LCD_D6_Direction :sbit at TRISB.4;
var LCD_D7_Direction :sbit at TRISB.5;
Var
m: sbit at portC.0 ;
a: .................... ;
b: .................... ;
KA1: .................... ; //declaration des variables
KA2: .................... ;
X0, X1, X2, X3: ........;
C: .................... ;
C_aff: string[3] ;
begin
//Configuration du Port C (les
TrisC:= $...............; broches non utilisées sont
considérées comme des entrées)
KA1:= ..... ; KA2:= ..... ; C:= ...... ; //Initialisation des sorties
X0:= ..... ; X1:= ..... ; X2:= ..... ; X3:=.....; //Initialisation des étapes
LCD_init(); //...........................
LCD_CMD(_LCD_CURSOR_OFF); //...........................
LCD_OUT(1,1,’C = ’); //...........................
begin
if (...................................) then
begin
...........................
........................... //Activation de l’étape 1
...........................
end;
https://www.youtube.com/@TricitiFedi
3
if (...................................) then
begin
...........................
//Activation de l’étape 2
...........................
end;
if (...................................) then
begin
...........................
//Activation de l’étape 3
...........................
end;
if (...................................) then
begin
...........................
//Activation de l’étape 0
...........................
end;
if (X1=1) then
...........................
else //Activation de la sortie KA1
...........................
if (X3=1) then
...........................
else //Activation de la sortie KA2
...........................
if (X2=1) then
begin
...........................
Bytetostr(C , C_aff); //...........................
LCD_OUT(1,4, .........);
end;
if (X0=1) then
begin
...........................
Bytetostr(C , C_aff); //...........................
LCD_OUT(1,4, .........);
end;
https://www.youtube.com/@TricitiFedi
4