By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,988 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,988 IT Pros & Developers. It's quick & easy.

Timestamp within sec. accuracy

P: 2
Hi..

Need a timestamp for data coming in for a serial port within second accuracy.How can i achieve this??
Nov 5 '06 #1
Share this Question
Share on Google+
1 Reply


100+
P: 267
Hi..

Need a timestamp for data coming in for a serial port within second accuracy.How can i achieve this??
hi

maybe you can put the systemtime before the incoming data?

Expand|Select|Wrap|Line Numbers
  1.  
  2. With MSComm1
  3.     .InputLen = 1
  4.     .RThreshold = 0
  5.     .SThreshold = 0
  6.     .InBufferSize = 10240
  7.     .InputMode = comInputModeText
  8.     .Handshaking = 0
  9. End With
  10.  
  11. sub where you receive your data from rs232...
  12.  
  13. Do
  14.     RxTxt = MSComm1.Input
  15. Loop Until RxTxt > vbNullString
  16.  
  17. inBuffer=vbNullString
  18. Do
  19.     DoEvents
  20.     RxTxt = MSComm1.Input
  21.     If Len(RxTxt) > 0 Then 
  22.         If inBuffer = vbNullString then inBuffer = Format (Time,"hh:mm:ss") & chr(10)    
  23.      inBuffer = inBuffer + RxTxt
  24.     End If
  25. Loop Until RxTxt = vbNullstring 'or any character to end the session
  26.  
  27.  
Nov 5 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.