* 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!' EndifCetin