Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   ayuda con recibir fichero texto por RS-232 (https://www.clubdelphi.com/foros/showthread.php?t=35630)

rusadir 15-09-2006 23:15:29

ayuda con recibir fichero texto por RS-232
 
Estoy en un proyecto con un terminal metrologic que almacena los
datos en un fichero txt y luego con un software propio se pueden descargar
al PC y necesitaria si alguien me puede ayudar para desde delphi poder descargarme el fichero, para elaborar una programacion que gestione estos ficheros de un forma personal, nose si me he explicado bien si alguien me puediese hechar un cable al respecto lo agradeceria.


Un saludo, Rusadir

FGarcia 16-09-2006 01:54:33

Saludos!

De acuerdo a tu mensaje necesitas "bajar" del terminal Metrologic un fichero de texto a traves del protocolo RS232 y en delphi manipular esos archivos.

1. Necesitas un componente que te permita conectar via rs232 tu terminal y la PC. Busca ComPort de Dejan Crnila en Sourceforge, hay muchos mas pero ese es el que conosco y uso.

2. Una vez que tengas instalado el componente, necesitas conocer si existe una secuencia de comandos que ordena la descarga del terminal a la pc o si el terminal tiene una opcion que inicia la descarga directamente

3. Para probar tu comunicacion pc - terminal puedes usar el Hyperterminal de windows, solo comprueba que los parametros de comunicacion esten correctos: Velocidad (baudios) Formato (bits) Paridad y control de flujo (Handshaking). Esto te permitira conocer los datos que envia el terminal y la manera en que estan ordenados para despues en tu aplicacion programar el tratamiento; SI el terminal necesita recibir una orden -secuencia de comandos- debes de conocerla para enviarla desde el hyperterminal.

Espero que esto te ayude en tu problema. De otro modo alguien del club nos podria dar mas informacion.

rusadir 16-09-2006 10:51:37

Gracias por la ayuda, eso hare, estoy buscando el componente ya y hare las pruebas lo antes que me sea posible. Si consigo algo prometo contarlo,

Un saludo, Rusadir

rusadir 17-09-2006 20:42:12

Adjunto fichero del protocolo metrologic para rs-232
 
Adjunto pongo el txt bajado de metrologic sobre el que estoy trabajando
con el protocolo del terminal para recibir fichero de datos y el protocolo de subir datos,

Por si alguien se anima y me hecha una manita,


Je Je Je,

Un Saludo, Rusadir


Fichero txt:

****************************************************************************
***** Protocol for downloading lookup files to ScanPal2 terminals *****
****************************************************************************
Note : All commands or records sent to /or received from the ScanPal2
terminals should be ended with a return character (0x0d).
1. Send the "CIPHER" command to ScanPal2 terminal and wait for return.
2. If the terminal returns "ACK", then it is ready for receiving lookup data
from the PC.
3. Send lookup data to terminal record by record. Each record should be ended
with 2 bytes of checksum. The checksum is calculated according to the
following rules:
A. Sum up the record data byte by byte.
B. Devide the sum by 256 to get the first byte checksum value. If this
value happens to be 13 (the return character: 0x0d), change it to 14
(0x0e).
C. The remaining of the above calculation is the second byte checksum
value. If it happens to be 13, change it to 14.
4. If the terminal returns "ACK", send next record to the terminal,
otherwise, re-send the same record to the terminal. Repeat the same
procedures until all the data is successfully transmitted.
5. Send the "OVER" command to the ScanPal2 terminal to stop this communication.

****************************************************************************
***** Protocol for receiving transaction data from ScanPal2 terminals *****
****************************************************************************
Note : All commands or records sent to or received from the ScanPal2
terminals should be ended with a return character (0x0d).
1. Send the "READ" command to the ScanPal2 terminal and wait for return.
2. If the terminal returns "ACK", then it is ready to send data to PC.
3. The format of each record received from the terminal is as follows,
A. The first byte is a sequence count rotated from 0 to 9. It's purpose
is to ensure the correct order of data transmission.
B. The last two bytes are the checksum values. The checksum is calculated
by adding up the sequence count and all the data bytes.
C. Devide the sum calculated above by 256 will get the last byte checksum
value. If this value happens to be 13 (the return character: 0x0d),
change it to 14 (0x0e).
D. The remaining of the above calculation is the first byte checksum
value. If it happens to be 13, change it to 14.
E. Please note that the checksum byte-order for this protocol is different
to that of downloading lookup files.


La franja horaria es GMT +2. Ahora son las 15:52:21.

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