Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSCOMM32 return missing ETX
Message
De
11/01/2004 21:31:43
 
 
À
09/01/2004 08:11:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00865346
Message ID:
00865891
Vues:
28
Hi,

Thank for your advise and code. I tried to use your code
for my OnComm Event but still not able to get the ETX.

I observed that it happened to events when I expecting more
than 80 character from the device that I using.

If I expect less than 40 character from the inbuffer, I can
detect the ETX.

I am really at a loss, any other suggestion or comment to
assist me on this weird problem.

Thank you


>If you are indeed getting overruns (CommEvent = 1006), then you can either lower the baud setting or implement handshaking.
>
>If by overrun you mean getting more than 1 character from your .INPUT, you are setting the .INPUTLEN property too late. By the time your system responds the the OnComm event, there may very well be more than 1 character waiting in the buffer. Set this property beforehand or leave it at 0, my preference. Try the following in your OnComm event:
>
>
>WITH THISFORM
>  DO CASE
>    CASE THIS.commevent = 1
>      * characters sent => SThreshold
>    CASE THIS.commevent = 2
>      * characters received => RThreshold
>      .cBuffer = .cBuffer + THIS.INPUT
>      * Test for your ETX in the buffer
>      IF CHR(3)$.cbuffer
>        * ETX in .cbuffer.
>        * Extract string into .cresult (new property)
>        * and leave remaining data in .cbuffer
>        lnetxpos = AT(CHR(3),.cbuffer,1)
>        .cresult = LEFT(.cbuffer,lnetxpos)
>        .cbuffer = SUBSTR(.cbuffer,lnetxpos+1)
>        * now process .cresult and clear when done.
>      ENDIF
>    CASE THIS.commevent = 3
>      * change in CTS
>    CASE THIS.commevent = 4
>      * change in DSR
>    CASE .commevent = 5
>      * Change in CD
>    CASE .commevent = 6
>      * Ring detected
>    CASE .commevent = 7
>      * EOF detected
>    CASE THIS.commevent = 1001
>      * Break Received
>    CASE THIS.commevent = 1004
>      * Framing Error
>    CASE THIS.commevent = 1006
>      * Overrun
>    CASE THIS.commevent = 1008
>      * Overflow
>    CASE THIS.commevent = 1009
>      * Parity Error
>    CASE THIS.commevent = 1010
>      * TX buffer full
>    CASE THIS.commevent = 1011
>      * DCB error
>  ENDCASE
>ENDWITH
>
Best Regards
Virusim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform