23
FESTO IPC
•
Exemple IO40
–
Algorithme de lecture du canal1:
Lire
Control
TantQue
Control=busy
faire
Lire
Control
Ftq
Control
¬
0
(Index
¬
0)
Temporisation
Lire Data
Tension
¬
Data
Temporisation
Lire
Data
Tension
¬
Tension + 256*Data
–
Programme Pascal:
Var Tension,TensionVolt:Integer;
Repeat
While (Port[$1A4] and $01)= $01 do ;
Port[$1A4] :=0;
Delay(5);
Tension:= Port[$1A5] ;
Delay(5);
Tension:= Port[$1A5]+Tension*256;
TensionVolt:=Tension*
Vref
/
4096
;
{Vref=10}
{Conversion sur 12 bits}
Writeln(‘Tension=’,TensionVolt,’ Volts’);
Until false;