![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#5
|
|||
|
|||
|
Aquí va el código que utilizo para calzular el checksum dichoso y enviar correctamente el resultado a la balanza.
En el ejemplo envío la siguiente cadena: 9 8 0 0 1 5 0 X Cr Lf Código:
a:='30';
b:='30';
c:='31';
d:='35';
e:='30';
h:=inttohex(hextoint('39') xor hextoint('38'),1);
h:=inttohex(hextoint(h) xor hextoint(a),1);
h:=inttohex(hextoint(h) xor hextoint(b),1);
h:=inttohex(hextoint(h) xor hextoint(c),1);
h:=inttohex(hextoint(h) xor hextoint(d),1);
h:=inttohex(hextoint(h) xor hextoint(e),1);
//Cadena completa en HEX
edit21.text:='39'+'38'+a+b+c+d+e+h+'0D'+'0A';
//Cadena en ASCII (sin #13 ni #10)
edit19.text:=chr(hextoint('39'))+chr(hextoint('38'))+chr(hextoint(a))+chr(hextoint(b))+chr(hextoint(c))+chr(hextoint(d))+chr(hextoint(e))+chr(hextoint(h));
//Cadena ASCII completa (CON #13#10)
ApdComPort1.OutPut := edit19.text+#13+#10;
|
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Recibir datos del puerto serie en bytes. | REHome | .NET | 1 | 31-10-2008 17:50:10 |
| Puerto Serie / Envio De Datos | alebarto | C++ Builder | 4 | 07-09-2008 22:46:58 |
| Quiero tomar datos de puerto serie con Delphi4PHP | lsg | PHP | 1 | 09-08-2008 03:24:37 |
| Capturar datos por el puerto serie | mierda | Varios | 8 | 05-12-2007 18:23:29 |
| Envio de datos al puerto serie COM1 | Niko | Varios | 5 | 15-03-2005 18:38:21 |
|