04-11-2021 09:22 PM
Hi,
I have a question about serial data.
When I receive the serial data from NI-9870, is it possible to get the time when the data came in?
Can timestamp helpful?
Please let me know.
Thank you.
Solved! Go to Solution.
04-12-2021 08:40 AM
I just get the time immediately after the message is read. For a RS-232 bus, this is about as accurate as you will really need. If you need more accuracy, then your device that is sending the data should timestamp things and put that information in the message.
04-13-2021 02:22 AM
Thanks for your reply!!
The code I attached is possible to receive serial data and save as a file that contains time and date?
I'm a beginner so not sure about my code....
Thank you 🙂
04-13-2021 07:13 AM - edited 04-13-2021 07:13 AM
1. You should be constantly reading from the serial port to keep the buffer cleared. You can conditionally log the data.
2. No need for the wait since the VISA Read will limit the loop rate.
3. Use the File IO functions to write your file. Open the file before your loop and close the file after the loop.
04-13-2021 06:55 PM
Thank you so much!!!
Have a great day 🙂