Ir para conteúdo
  • Cadastre-se

dev botao

  • Este tópico foi criado há 3336 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

Postado

Buongiorno a tutti!

I have a Bematech MP 4000 TH FI. I use ECFTeste.exe to test the commands. When I connect the printer with onboard COM, everything is fine. When I connect with USB, using the Bematech Virtual Serial Port Driver rel 3.0.0.3, the command ACBrECF1.DataHoraSB times-out. I already increased the timeout values but without success. Already tried to decrease/disable the COM buffer, no way.

I tried to install 3.0.0.7 but with this driver the printer is not working AT ALL.

 

Here the logfiles when connected with USB and BVSP Driver:


--------------------------------------------------------------------------------
ATIVAR - 07/10/15 18:02:42:849 - Modelo: Bematech - Porta: COM5 - TimeOut: 3
         Device: BAUD=9600 DATA=8 PARITY=N STOP=1 HANDSHAKE=RTS/CTS HARDFLOW MAXBANDWIDTH=0
--------------------------------------------------------------------------------

-- 18:02:42:884 
                TX -> [STX][4][NUL][FS][19]/[NUL]
   18:02:43:101 RX <- ACK = 6 Falha: 0
   18:02:43:203 RX <- [NUL][NUL][NUL][NUL]
-- 18:02:43:233 
                TX -> [STX][ENQ][NUL][FS]#)h[NUL]
   18:02:43:402 RX <- ACK = 6 Falha: 0
   18:02:43:504 RX <- [SOH][NUL][SOH][NUL][NUL][NUL][NUL]
-- 18:02:43:505 
                TX -> [STX][ENQ][NUL][FS]#<{[NUL]
   18:02:43:700 RX <- ACK = 6 Falha: 0
   18:02:43:801 RX <- BEMATECH       MP-4000 TH FI       ECF-IF [NUL][NUL][NUL][NUL]
-- 18:02:43:802 
                TX -> [STX][ENQ][NUL][FS]#[11]J[NUL]
   18:02:43:992 RX <- ACK = 6 Falha: 0
   18:02:44:093 RX <- [NUL][SOH][NUL][NUL][NUL][NUL]
-- 18:02:44:094 
                TX -> [STX][ENQ][NUL][FS]#(g[NUL]
   18:02:44:224 RX <- ACK = 6 Falha: 0
   18:02:44:326 RX <- BE091210100011322461[NUL][NUL][NUL][NUL]
-- 18:02:44:327 Estado
                TX -> [STX][ENQ][NUL][FS]#[WAK]P[NUL]
   18:02:44:496 RX <- ACK = 6 Falha: 0
   18:02:44:598 RX <- [16][NUL][NUL][NUL][NUL]
-- 18:02:44:599 
                TX -> [STX][ENQ][NUL][FS]#A[128][NUL]
   18:02:44:726 RX <- ACK = 6 Falha: 0
   18:02:44:827 RX <- [NUL][NUL][NUL][NUL][NUL]
-- 18:02:44:828 
                TX -> [STX][ENQ][NUL][FS]#[ESC]Z[NUL]
   18:02:45:018 RX <- ACK = 6 Falha: 0
   18:02:45:120 RX <- [NUL][NUL][NUL][NUL][NUL][NUL][NUL]
-- 18:02:45:124 Estado
                TX -> [STX][ENQ][NUL][FS]#[WAK]P[NUL]
   18:02:45:314 RX <- ACK = 6 Falha: 0
   18:02:45:416 RX <- [16][NUL][NUL][NUL][NUL]
-- 18:02:45:417 
                TX -> [STX][ENQ][NUL][FS]#A[128][NUL]
   18:02:45:607 RX <- ACK = 6 Falha: 0
   18:02:45:710 RX <- [NUL][NUL][NUL][NUL][NUL]
-- 18:02:45:711 
                TX -> [STX][ENQ][NUL][FS]#[ESC]Z[NUL]
   18:02:45:838 RX <- ACK = 6 Falha: 0
   18:02:45:940 RX <- [NUL][NUL][NUL][NUL][NUL][NUL][NUL]
-- 18:02:57:098 DataHoraSB
                TX -> [STX][ENQ][NUL][FS]#[WAK]P[NUL]
   18:02:57:245 RX <- ACK = 6 Falha: 0
   18:02:57:347 RX <- [16][NUL][NUL][NUL][NUL]
-- 18:02:57:348 
                TX -> [STX][ENQ][NUL][FS]#A[128][NUL]
   18:02:57:538 RX <- ACK = 6 Falha: 0
   18:02:57:641 RX <- [NUL][NUL][NUL][NUL][NUL]
-- 18:02:57:642 
                TX -> [STX][ENQ][NUL][FS]#[ESC]Z[NUL]
   18:02:57:829 RX <- ACK = 6 Falha: 0
   18:02:57:931 RX <- [NUL][NUL][NUL][NUL][NUL][NUL][NUL]
-- 18:02:57:932 
                TX -> [STX][ENQ][NUL][FS]#[TAB]H[NUL]
   18:02:58:057 RX <- ACK = 6 Falha: 0
   18:02:58:160 RX <- [NUL][128][NUL][NUL][NUL][NUL]
-- 18:02:58:161 
                TX -> [STX][WAK][NUL][FS][BS]000080000080R[198][STX]
   18:02:58:329 RX <- ACK = 6 Falha: 0
   18:03:29:570 RX <- [NUL][NUL][NUL][NUL]     OPTIDADOS SOFTWARE OPTICOS LTDA - ME [LF]         RUA:ANTONIO PEDRO,368 CENTRO[LF]          PEDREIRA/SP CEP:13920-000 [LF]CNPJ:09.492.015/0001-99  [LF]IE:519.103.690.113     [LF]IM:5.4.8648            [LF]07/10/2015 14:25:02                   COO:002605[LF] LEITURA MEM[224]RIA FISCAL [LF]              REDU[128][199]O: 0080 a 0080[LF]Contador Geral de Opera[135][198]o N[198]o-Fiscal:    001098[LF]Contador de Redu[135][228]es Z:                     0080[LF]Contador de Rein[161]cio de Opera[135][198]o:            003[LF]Contador de Fita-detalhe:                 000000[LF]               REIN[214]CIO OPERA[128][199]O                [LF]CRO                       DATA       HORA[LF]001#                    13/11/2012 14:51:18 [LF]002                     10/01/2013 06:45:36 [LF]003                     09/04/2013 06:38:33 [LF]             IMPRESS[199]O FITA DETALHE             [LF]CFD    DATA       HORA       COOi   COOf[LF]CNPJ:[LF]                    USU[181]RIOS                    [LF]Usu[160]rio:0001    CRO:001     13/11/2012 14:51:18 [LF]CNPJ: 09.492.015/0001-99  [LF]IE: 519.103.690.113     [LF]IM: 5.4.8648            [LF]GT:                                   555.572,80[LF]                REDU[128][228]ES DI[181]RIAS                [LF]                  Usu[160]rio:0001[LF]CRZ   CRO   COO                 DATA     HORA[LF]                     VENDA BRUTA DI[181]RIA ( R$)[LF]DT=desconto ICMS           DS=desconto ISSQN[LF]AT=acr[130]scimo ICMS          AS=acr[130]scimo ISSQN[LF]CT=canc.ICMS               CS=canc. ISSQN[LF]ON=opera[135][198]o n[198]o-fiscal[LF]0080  003   002603          02/10/2015 02:00:02 [LF]                            R$            198,00[LF]03T18,00%=198,00 [LF][LF]Total do m[136]s 10 de 2015[LF]Venda Bruta ( R$)                         198,00[LF]T18,00%=198,00 [LF][LF]N[163]mero de Redu[135][228]es Restantes:               3266[LF]                  DADOS GERAIS                  [LF]                SOFTWARE B[181]SICO                 [LF]01.00.01                    05/10/2012 13:53:16 [LF]MOEDA:  R                   13/11/2012 14:51:18 [LF]QUANTIDADE: 03              13/11/2012 14:51:19 [LF]VALOR UNIT[181]RIO: 03          13/11/2012 14:51:19 [LF]MFD:[LF]392204112100165705  [LF][LF]CODIFICA[128][199]O GT[LF]a partir de 13/11/2012 14:51:18 [LF]0=Q, 1=W, 2=E, 3=R, 4=T, 5=Y, 6=U, 7=I, 8=O, 9=P[LF]8BQIAGUA BAX4G6EY NMK$LL!N 8BOCABR8 96R3B0DTLBHPBEMATECH MP-4000 TH FI ECF-IF[LF]VERS[199]O:01.00.01 ECF:001 LJ:0001[LF]QQQQQQQQQQYYYYIEOQ 07/10/2015 14:25:02 [LF]FAB:BE091210100011322461                     [LF][LF][LF][LF][LF][LF][ETX]
----------------- ERRO -----------------
Impressora Bematech não está respondendo
----------------------------------------

 

and here the logfile, same software, same command (DataHoraSB) but connected with onboard COM:


--------------------------------------------------------------------------------
ATIVAR - 07/10/15 18:04:22:569 - Modelo: Bematech - Porta: COM3 - TimeOut: 3
         Device: BAUD=9600 DATA=8 PARITY=N STOP=1 HANDSHAKE=RTS/CTS HARDFLOW MAXBANDWIDTH=0
--------------------------------------------------------------------------------

-- 18:04:22:570 
                TX -> [STX][4][NUL][FS][19]/[NUL]
   18:04:22:622 RX <- ACK = 6 Falha: 0
   18:04:22:723 RX <- [NUL][NUL][NUL][NUL]
-- 18:04:22:724 
                TX -> [STX][ENQ][NUL][FS]#)h[NUL]
   18:04:22:751 RX <- ACK = 6 Falha: 0
   18:04:22:852 RX <- [SOH][NUL][SOH][NUL][NUL][NUL][NUL]
-- 18:04:22:853 
                TX -> [STX][ENQ][NUL][FS]#<{[NUL]
   18:04:22:881 RX <- ACK = 6 Falha: 0
   18:04:23:024 RX <- BEMATECH       MP-4000 TH FI       ECF-IF [NUL][NUL][NUL][NUL]
-- 18:04:23:025 
                TX -> [STX][ENQ][NUL][FS]#[11]J[NUL]
   18:04:23:050 RX <- ACK = 6 Falha: 0
   18:04:23:151 RX <- [NUL][SOH][NUL][NUL][NUL][NUL]
-- 18:04:23:151 
                TX -> [STX][ENQ][NUL][FS]#(g[NUL]
   18:04:23:179 RX <- ACK = 6 Falha: 0
   18:04:23:298 RX <- BE091210100011322461[NUL][NUL][NUL][NUL]
-- 18:04:23:299 Estado
                TX -> [STX][ENQ][NUL][FS]#[WAK]P[NUL]
   18:04:23:322 RX <- ACK = 6 Falha: 0
   18:04:23:423 RX <- [16][NUL][NUL][NUL][NUL]
-- 18:04:23:424 
                TX -> [STX][ENQ][NUL][FS]#A[128][NUL]
   18:04:23:447 RX <- ACK = 6 Falha: 0
   18:04:23:548 RX <- [NUL][NUL][NUL][NUL][NUL]
-- 18:04:23:549 
                TX -> [STX][ENQ][NUL][FS]#[ESC]Z[NUL]
   18:04:23:575 RX <- ACK = 6 Falha: 0
   18:04:23:677 RX <- [NUL][NUL][NUL][NUL][NUL][NUL][NUL]
-- 18:04:23:681 Estado
                TX -> [STX][ENQ][NUL][FS]#[WAK]P[NUL]
   18:04:23:705 RX <- ACK = 6 Falha: 0
   18:04:23:807 RX <- [16][NUL][NUL][NUL][NUL]
-- 18:04:23:808 
                TX -> [STX][ENQ][NUL][FS]#A[128][NUL]
   18:04:23:831 RX <- ACK = 6 Falha: 0
   18:04:23:933 RX <- [NUL][NUL][NUL][NUL][NUL]
-- 18:04:23:934 
                TX -> [STX][ENQ][NUL][FS]#[ESC]Z[NUL]
   18:04:23:960 RX <- ACK = 6 Falha: 0
   18:04:24:061 RX <- [NUL][NUL][NUL][NUL][NUL][NUL][NUL]
-- 18:04:27:122 DataHoraSB
                TX -> [STX][ENQ][NUL][FS]#[WAK]P[NUL]
   18:04:27:146 RX <- ACK = 6 Falha: 0
   18:04:27:248 RX <- [16][NUL][NUL][NUL][NUL]
-- 18:04:27:249 
                TX -> [STX][ENQ][NUL][FS]#A[128][NUL]
   18:04:27:274 RX <- ACK = 6 Falha: 0
   18:04:27:375 RX <- [NUL][NUL][NUL][NUL][NUL]
-- 18:04:27:376 
                TX -> [STX][ENQ][NUL][FS]#[ESC]Z[NUL]
   18:04:27:403 RX <- ACK = 6 Falha: 0
   18:04:27:505 RX <- [NUL][NUL][NUL][NUL][NUL][NUL][NUL]
-- 18:04:27:506 
                TX -> [STX][ENQ][NUL][FS]#[TAB]H[NUL]
   18:04:27:532 RX <- ACK = 6 Falha: 0
   18:04:27:634 RX <- [NUL][128][NUL][NUL][NUL][NUL]
-- 18:04:27:635 
                TX -> [STX][WAK][NUL][FS][BS]000080000080R[198][STX]
   18:04:27:664 RX <- ACK = 6 Falha: 0
   18:04:32:032 RX <- [NUL][NUL][NUL][NUL]     OPTIDADOS SOFTWARE OPTICOS LTDA - ME [LF]         RUA:ANTONIO PEDRO,368 CENTRO[LF]          PEDREIRA/SP CEP:13920-000 [LF]CNPJ:09.492.015/0001-99  [LF]IE:519.103.690.113     [LF]IM:5.4.8648            [LF]07/10/2015 14:26:31                   COO:002605[LF] LEITURA MEM[224]RIA FISCAL [LF]              REDU[128][199]O: 0080 a 0080[LF]Contador Geral de Opera[135][198]o N[198]o-Fiscal:    001098[LF]Contador de Redu[135][228]es Z:                     0080[LF]Contador de Rein[161]cio de Opera[135][198]o:            003[LF]Contador de Fita-detalhe:                 000000[LF]               REIN[214]CIO OPERA[128][199]O                [LF]CRO                       DATA       HORA[LF]001#                    13/11/2012 14:51:18 [LF]002                     10/01/2013 06:45:36 [LF]003                     09/04/2013 06:38:33 [LF]             IMPRESS[199]O FITA DETALHE             [LF]CFD    DATA       HORA       COOi   COOf[LF]CNPJ:[LF]                    USU[181]RIOS                    [LF]Usu[160]rio:0001    CRO:001     13/11/2012 14:51:18 [LF]CNPJ: 09.492.015/0001-99  [LF]IE: 519.103.690.113     [LF]IM: 5.4.8648            [LF]GT:                                   555.572,80[LF]                REDU[128][228]ES DI[181]RIAS                [LF]                  Usu[160]rio:0001[LF]CRZ   CRO   COO                 DATA     HORA[LF]                     VENDA BRUTA DI[181]RIA ( R$)[LF]DT=desconto ICMS           DS=desconto ISSQN[LF]AT=acr[130]scimo ICMS          AS=acr[130]scimo ISSQN[LF]CT=canc.ICMS               CS=canc. ISSQN[LF]ON=opera[135][198]o n[198]o-fiscal[LF]0080  003   002603          02/10/2015 02:00:02 [LF]                            R$            198,00[LF]03T18,00%=198,00 [LF][LF]Total do m[136]s 10 de 2015[LF]Venda Bruta ( R$)                         198,00[LF]T18,00%=198,00 [LF][LF]N[163]mero de Redu[135][228]es Restantes:               3266[LF]                  DADOS GERAIS                  [LF]                SOFTWARE B[181]SICO                 [LF]01.00.01                    05/10/2012 13:53:16 [LF]MOEDA:  R                   13/11/2012 14:51:18 [LF]QUANTIDADE: 03              13/11/2012 14:51:19 [LF]VALOR UNIT[181]RIO: 03          13/11/2012 14:51:19 [LF]MFD:[LF]392204112100165705  [LF][LF]CODIFICA[128][199]O GT[LF]a partir de 13/11/2012 14:51:18 [LF]0=Q, 1=W, 2=E, 3=R, 4=T, 5=Y, 6=U, 7=I, 8=O, 9=P[LF]CFPOEIGA 5AW3CEFT ERWXPP+T CFNIEDD8 36Q278EOCGNQBEMATECH MP-4000 TH FI ECF-IF[LF]VERS[199]O:01.00.01 ECF:001 LJ:0001[LF]QQQQQQQQQQYYYYIEOQ 07/10/2015 14:26:34 [LF]FAB:BE091210100011322461                     [LF][LF][LF][LF][LF][LF][ETX]
-- 18:04:32:037 Estado
                TX -> [STX][ENQ][NUL][FS]#[WAK]P[NUL]
   18:04:32:061 RX <- ACK = 6 Falha: 0
   18:04:32:163 RX <- [16][NUL][NUL][NUL][NUL]
-- 18:04:32:165 
                TX -> [STX][ENQ][NUL][FS]#A[128][NUL]
   18:04:32:190 RX <- ACK = 6 Falha: 0
   18:04:32:292 RX <- [NUL][NUL][NUL][NUL][NUL]
-- 18:04:32:293 
                TX -> [STX][ENQ][NUL][FS]#[ESC]Z[NUL]
   18:04:32:321 RX <- ACK = 6 Falha: 0
   18:04:32:423 RX <- [NUL][NUL][NUL][NUL][NUL][NUL][NUL]

 

 

 

Many thanks for your help!

Andrea

ITALY

 

 

 

Postado

Sei que o protocolo de comunicação é diferente, mas estou com o mesmo problema com MP 4200, que tem somente a opção de COM Virtual. Acontece aleatoriamente, tanto nos clientes como aqui no nosso ECF. 

Estamos com o ACBr e os drivers atualizados.

Segue anexo o log.

Notei que no programa da bematech (WinITFI2 RAT) existem parâmetros, conforme imagem, para setar os tempos de espera de retorno. Todos os testes que fiz até hoje via programa da Bematech deram certo, normalmente quando passamos para as revendas de ECF que está dando problema no comunicação eles usam apenas os programas do fabricante para testar.

No ACBr sei que tem parâmetro pra Timeout e Intervalo, tem relação com esses da imagem?

====================================

I have the same problem with MP 4200 printer. These model has only virtual COM option for communication. 

We have ACBr and drivers updated.

Log files are attached here.

I've noticed that using bematechs software (WinITFI2 RAT) there are parameters to set the timeouts for printer return. All tests that i've made until now using the Bematech software were OK. Usually when we tell hardware resellers that we're having communication issues they test only with the manufacturer software.

I know that ACBr has parameters for Timeout and "Intervalo", do these parameters have any relation with those on the image?

 

LogAcbrBematech.txt

bematech.png

Postado

Daniel,

I downloaded bemaghost and bemadrivers.

Executed with administrator privileges BemaGhost, option 99. Rebooted. Execeuted BemaDrivers --> MP 4000 recognized. Rebooted. Installed Bematech Virtual Serial Port X64 3.0.0.7, configured comport 5 --> FISCAL --> Radiobutton USB 0_MP-400 TH FI. Executed my software : no way. The printer does not print AT ALL, no commands are working. With 3.0.0.3 everything works (I think so), the only thing not working is the DataHoraSB.

Can be a Bematech issue?

Thanks!

Andrea

Here some screenshots....

 

Driver USB.jpg

Virtual serial port.jpg

Driver Virtual Serial Port.jpg

@Ryan molina I my case I have a MP 4000 TH FI, anyway I tried to change the values on the ACBrECF component for timeout and interval between commands (I set 1 hour timeout...) but nothing changed, always the same problem. and ONLY with ACBrECF1.DataHoraSB

Thanks

  • Fundadores
Postado

Looks like some problem on these new Drivers for MP4000... Can you please send the Log file created with the attempt using the new drivers ?

On MP4200 there is a similar problem... The workaround solution we created for MP4200, consist in transmit the command again, after TimeOut occurs...

Not sure if is possible to try the same approach in MP4000.... I need to investigate your Log files...

Can you provide more Log files, with the same error situation ?

Consultor SAC ACBr

Daniel Simões de Almeida
O melhor TEF, é com o Projeto ACBr - Clique e Conheça
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr     Telefone:(15) 2105-0750 WhatsApp(15)99790-2976.

Postado

Hello Daniel

Here the logfiles with the new driver installed 3.0.0.7. I used the ECFTeste demo that is included with ACBr source code. I just pressed the button "Ativar", and I get the error : Impressora Bematech não responde (ACK = 0)

 

--------------------------------------------------------------------------------
ATIVAR - 08/10/15 14:24:21:999 - Modelo: Bematech - Porta: COM5 - TimeOut: 3
         Device: BAUD=9600 DATA=8 PARITY=N STOP=1 HANDSHAKE=RTS/CTS HARDFLOW MAXBANDWIDTH=0
--------------------------------------------------------------------------------

-- 14:24:22:034 
                TX -> [STX][4][NUL][FS][19]/[NUL]
   14:24:22:327 RX <- ACK = 0 Falha: 0
                TX -> [STX][4][NUL][FS][19]/[NUL]
   14:24:22:775 RX <- ACK = 0 Falha: 1
                TX -> [STX][4][NUL][FS][19]/[NUL]
   14:24:23:223 RX <- ACK = 0 Falha: 2
   14:24:23:224 RX <- 
----------------- ERRO -----------------
Impressora Bematech não responde (ACK = 0)
----------------------------------------

-- 14:24:23:226 
                TX -> [STX][4][NUL][ESC][19].[NUL]
   14:24:23:574 RX <- ACK = 0 Falha: 0
                TX -> [STX][4][NUL][ESC][19].[NUL]
   14:24:24:023 RX <- ACK = 0 Falha: 1
                TX -> [STX][4][NUL][ESC][19].[NUL]
   14:24:24:471 RX <- ACK = 0 Falha: 2
   14:24:24:473 RX <- 
----------------- ERRO -----------------
Impressora Bematech não responde (ACK = 0)
----------------------------------------

 

 

As I told you, with Bematech Virtual Serial Port 3.0.0.3 I can Activate the printer, I can do everything, only problem on ACBrECF.DataHoraSB.

With 3.0.0.7, I cannot even activate the communication.

Thanks

Andrea

 

 

  • Fundadores
Postado

Do you use ACBr Trunk2 directory ? Probably this issue is already fixed on Trunk2

I notice ACBrECF is running a special code to read DataHoraSB, on escBematech... Since these model don´t have a specific command to return this information... ACBrECFBematech is querying a report "Leitura Memoria Fiscal", by serial, in order to capture DataHoraSB information on the texts of these report...

Looks like the problem is on the way ACBrECF is detecting the ending of Serial Reports (they always ends with [ETX])... buts as we can see, ETX is on the Log...

Recently, I fix a very similar issue, concerning problems on detecting ending of Serial reports... but only on Trunk2...

Please try the compiled version of ECFTeste, using Trunk2

Consultor SAC ACBr

Daniel Simões de Almeida
O melhor TEF, é com o Projeto ACBr - Clique e Conheça
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr     Telefone:(15) 2105-0750 WhatsApp(15)99790-2976.

Postado

Hi Daniel,

I am using trunk directory. I downloaded the ECFTeste compiled with trunk2, and DataHoraSB WORKS!

So, is there a chance to port the fix done on trunk2 also on trunk? Or the only way is to migrate to trunk2?

Many thanks!

Andrea

 

Postado

Si, I investigated a bit more. The problem is that I cannot debug, as I run delphi on a Virtual Machine, and the USB bema driver cannot be virtualized.

But...by adding some logs, I noticed that the problem is on ACBrECFBematech.pas, procedure VerificaFimLeitura, instruction: 

result:= not fpDevice.Serial.CanReadEx(1000).

This command is used to be sure that, when ETX is received, no other informations are received on the serial. It is a sort of doublecheck.

So: when i connect the MP4000 with COM, everything is ok, no more data after ETX.

When I connect with USB and virtual serial port, the result of fpDevice.Serial.CanReadEx(1000) is always TRUE, even if ETX is received.

So it looks like that, via USB, there are some other "dirty" data on the serial still there, after the ETX.

I commented out this "check" and now all is working good, but I dont think that it could be a solution.

Thanks

Andrea

 

Postado

Solution proposal, in ACBrECFClass.DoLeResposta

 

        Fim := True ;
        if not FimLeitura then
         begin
           Fim  := False ;
           try
              fpRespostaComando := fpRespostaComando + { Le conteudo da porta }
                                   fpDevice.LeString(100) ;
              LenResp := Length( fpRespostaComando ) ;
           except
              sleep(10) ;
           end ;

           if LenResp <> fsBytesRec then
            begin
               // ECF está respondendo, portanto está trabalhando //
               TempoLimite := IncSecond(now, TimeOut);
               fsBytesRec  := LenResp ;
            end
           else
             FimLeitura := VerificaFimLeitura(fpRespostaComando, TempoLimite) ;
         end
        else
           if AguardaImpressao then
           begin
              Fim := VerificaFimImpressao( TempoLimite ) ;
              if not Fim then
                 sleep(200) ;
           end ;

 

Here we check the FimLeitura only when there are no more data to read. When there are no more data, fpDevice.LeString will raise an exception, catched. Then LenResp will be equal to fsBytesRec, and we can finally check the FimLeitura.

With this solution we solve also the problem mentioned on my above post, regarding the ETX that is not a real ETX, and we can remove the fpDevice.Serial.CanReadEx(1000) in ACBrECFBematech.pas that is generating the problem.

Please let me have your opinion,

thanks

Andrea

 

  • Este tópico foi criado há 3336 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar Agora
×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.