Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSCOMM
Message
De
14/08/2001 05:06:17
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
13/08/2001 18:21:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Re: MSCOMM
Divers
Thread ID:
00543278
Message ID:
00543398
Vues:
31
>I have a infrared remote control and I'm trying to get data from COM1 with code below but nothing happen.
>Any suggestion?
>Thank's in advance,
>NPedro
>
>
>
>Do WHILE !OK
> IF THISFORM.c.InBufferCount > 0
> cChar = THISFORM.c.Input
> OK = .T.
> Endif
>Enddo
>
>wait wind "Result: " + cChar

Hi Nuno,
I also tried to read data from MSComm for GPS data and was getting nothing. Finally I got this working code :
* load mscomm
oComm = CREATEOBJ('MSCOMMLib.MSComm')
* Open and Initialize COM port #1 for use
With oComm
  .CommPort = 1
  .Settings = "4800,N,8,1"
  .InputLen = 1
  .PortOpen = .T.

  lcDATA=''
  lnStart = datetime()
  llDataReady = .F.
  Do while datetime()-lnStart < 5
    .InputLen = 1
    lcDATA = lcDATA+.input
    lnGGA = at('$GPGGA',lcDATA)
    lnGSA = at('$GPGSA',lcDATA)
    If lnGGA > 0 and lnGSA > lnGGA && Read enough
      llDataReady = .T.
      Exit
    Endif
  Enddo
  * Close the port
  .PortOpen = .F.
Endwith
Release oComm
If llDataReady
  Thisform.WriteGPSData(lcDATA, datetime())
Else
  Wait window timeout 2 'GPS timedout!'
Endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform