|
| |
HARDWARE PARA EL PC
Programación en PASCAL.
1.- Tarjeta de relés
program tecla;
{$M 1024, 0, 0}
uses dos, crt;
var
pnormal : procedure;
antiguo : byte; (* Aqu¡ almacenaremos el valor antiguo del reg AL *)
procedure inicializar_puerto;
var
reg : registers;
begin
reg.AH := 01; (* Int. que pone a 0 todos los bits de la direc *)
reg.DX := 0; (* del puerto de impresora LPT1 *)
intr($17,reg);
end;
procedure rele; interrupt;
var
reg : registers;
tec : byte;
begin
reg.AH :=$02; intr($16, reg);
if reg.AL = 40 then
begin
tec := port[$60];
if ((tec=16) or (tec=17) or (tec=18) or (tec=19)) then
begin
case tec of
16 : antiguo := ($02 XOR antiguo); (* activo aparato 1 *)
17 : antiguo := ($08 XOR antiguo); (* activo aparato 2 *)
18 : antiguo := ($20 XOR antiguo); (* activo aparato 3 *)
19 : antiguo := $0;
end;
port[$378] := antiguo;
end;
end;
inline($9C);
pnormal;
end;
(*********************** Programa Principal ************************)
begin
inicializar_puerto;
antiguo := 0;
writeln (' Programa RELE 1.0 instalado ');
getintvec($9, @pnormal);
setintvec($9, @rele);
keep(0);
end.
Este programa se queda residente, y espera la pulsación de las teclas
de función para encender hasta 3 relés o apagarlos todos.
3.- Termómetro.
procedure leer_jocks(var x,y : integer);
var regs: registers;
begin
regs.ah := $84;
regs.dx := 1;
intr($15, regs);
x := regs.ax;
y := regs.bx;
end;
|