Componentes TAsync32.

Delphi

09/10/2003

Olá, Pessoal.
Estou usando os componentes TAsync32 para comunicação com uma balança eletronica da toledo.
Mas o componente não executa o envento RxChar que efetua o retorno da balança para o sistema.
Alguem tem algum exemplo de como faço para usar esses componentes ?

Sem mais, agradeço desde já.

Ovidio Jr.


Ovidio

Ovidio

Curtidas 0

Respostas

Aroldo Zanela

Aroldo Zanela

09/10/2003

Colega,

Exemplo utilizando uma leitora de código de barras serial:

procedure TfrmCaixa_Sweda.PortaSerialRxChar(Sender: TObject; Count: Integer);
type CharBuf = Array[ 0..9999 ] of char;
var Buffer: ^CharBuf;
      Bytes, P: Integer;
Begin

GetMem( Buffer, PortaSerial.ReadBufSize );

  try
    FillChar( Buffer^, PortaSerial.ReadBufSize, 0 );
    Bytes := PortaSerial.Read( Buffer^, Count );
    If Bytes = -1 Then
    ShowMessage( ´Erro de leirura nos dados de entrada...´ )
    Else
    Begin
    For P := 0 to Bytes -1 do
      Begin
      Case Buffer^[P] of
        0, 10:;
          13:
          Begin

PassarItem( LineData ); // Envia o código EAN-13
            LineData := ´´;
              rxQtde.Value:= 1;
            End;
          Else
          Begin
            LineData := LineData + CharBuf( Buffer^)[P];
            End;
        End;
      End;
    End;
    Application.ProcessMessages;
  Finally
FreeMem( Buffer );
  end;

End;



GOSTEI 0
POSTAR