Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   API de Windows (https://www.clubdelphi.com/foros/forumdisplay.php?f=7)
-   -   Diferente velocidad en distintos pines del puerto paralelo (https://www.clubdelphi.com/foros/showthread.php?t=61655)

gaston260 16-11-2008 18:52:26

Diferente velocidad en distintos pines del puerto paralelo
 
Hola ! me podrian guiar en una aplicacion con la que estoy practicando , quiero sacar un tren de pulsos por el pin uno del puerto paralelo y cuando intento sacar el segundo tren de pulsos por el segundo pin resulta que un pin ya no va a la velocidad que yo quiero ! , creo que estoy teniendo problemas de logica pero no se como encararlo ! aca paso el codigo

procedure Tform1.Timer1Timer(Sender: TObject);
var
Estado1: String;

begin
if (valorActual = strtoint(txtPararEntrada.text)) then
begin
exit;
end;

if envios1 = 3 then
begin
if checkbox1.checked then
begin
valor := 1;
im3.Brush.Color := clRed;
Estado1 := 'si';
end;
end;

if envios1 = 4 then
begin
im3.Brush.Color := clblack;
valor := 0;
Estado1 := 'no';
end;

if envios1 = 0 then
begin
imReset.Brush.Color := clyellow;
im3.Brush.Color := clblack;
Estado1 := 'Indefinido';
end
else
imReset.Brush.Color := clBlack;
begin
if envios1 = 1 then
begin
im3.Brush.Color := clYellow;
Estado1 := 'Indefinido';
end;
end;
if envios1 = 4 then
envios1 := 2;
Out32(StrToInt(txtpuertobucle.text), valor);
envios1 := envios1 + 1;
be.panels[9].text := 'Envíos: ' + Estado1;
Timer1.Interval := ((strtoint(txtmaximo.text) + 1) - deslizador1.position) {div 1};
end;

//************************************

procedure Tform1.Timer3Timer(Sender: TObject);
var
Estado2: String;

begin
if (valorActual = strtoint(txtPararEntrada.text)) then
begin
exit;
end;
if envios2 = 3 then
begin
if checkbox2.checked then
begin
valor := 2;
im4.Brush.Color := clRed;
Estado2 := 'si';
end;
end;
if envios2 = 4 then
begin
im4.Brush.Color := clblack;
valor := 0;
Estado2 := 'no';
end;
if envios2 = 0 then
begin
imReset.Brush.Color := clyellow;
im4.Brush.Color := clblack;
Estado2 := 'Indefinido';
end
else
imReset.Brush.Color := clBlack;
begin
if envios2 = 1 then
begin
im4.Brush.Color := clYellow;
Estado2 := 'Indefinido';
end;
end;
if envios2 = 4 then
envios2 := 2;
Out32(StrToInt(txtpuertobucle.text), valor);
envios2 := envios2 + 1;
be.panels[9].text := 'Envíos: ' + Estado2;
Timer3.Interval := ((strtoint(txtmaximo.text) + 1) - deslizador2.position) {div 1};
end;

//******************************************************************************

procedure Tform1.Iniciar1Click(Sender: TObject);
begin
Timer1.Interval := deslizador1.position;
Timer2.Interval := (strtoint(txtmaximo.text) + 1) - deslizador1.position;
im1.Brush.Color := clblack;
im2.Brush.Color := clgreen;
im3.Brush.color := clblack;
envios1 := 1;
valor := 0;

if valor = 256 then
Timer2.Enabled := False;
Timer1.Enabled := True;
be.panels[0].text := 'Bucle iniciado';
be.panels[1].text := 'Iniciar 1 Activado';
end;

//************************************

procedure Tform1.Iniciar2Click(Sender: TObject);
begin
Timer1.Interval := deslizador2.position;
Timer4.Interval := (strtoint(txtmaximo.text) + 1) - deslizador2.position;
im1.Brush.Color := clblack;
im2.Brush.Color := clgreen;
im3.Brush.color := clblack;
envios2 := 2;
valor := 0;

if valor = 256 then
Timer4.Enabled := False;
Timer3.Enabled := True;
be.panels[0].text := 'Bucle iniciado';
be.panels[2].text := 'Iniciar 2 Activado';
end;

fjcg02 16-11-2008 21:58:10

No entiendo muy bien el código, pero parece que usas dos timers, uno para cada 'pin'.
Si es así, es un error, quiero decir que lo que tienes que hacer es leer el puerto una sola vez y de ahí obtener el valor de cada 'pin'.

Saludos

gaston260 17-11-2008 22:12:55

Creo que no soy muy claro ! Perdón !
 
Creo que no soy muy claro ! Perdón ! lo que estoy buscando es escrivir y no leer pero mas concretamente quiero saver si puedo con un reloj mandar un tren de pulsos en el pin 1 y con otro reloj mandar al pin 2 otro tren de pulsos el reloj 1 tendria un tiempo distinto al reloj 2 ; es posible sacar datos en dos pines a diferentes frecuencias ? ? .

PD : perdón por la identación ! .


La franja horaria es GMT +2. Ahora son las 11:33:28.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi