Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSCOMM32 return missing ETX
Message
De
09/01/2004 08:11:00
 
 
À
09/01/2004 01:24:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00865346
Message ID:
00865392
Vues:
77
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform