Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Serial data to file


RyanSmith Oct 24, 2023 04:54 PM

I have a need to use a CR1000, communicating with a serial sensor, to stream the serial data to an ASCII text file for later processing. This will happen multiple times per day and the created files will get pulled out through Loggernet. The serial output of the device is triggered by a serial command ("A003r") and it then outputs the data until it empties its internal memory. So the length of the serial data output is highly variable and it does not have an "end of transmission" character, it just stops transmitting when there is no more data and then halts for another command to be issued. I have looked in this forum but could not find an example of how to store a variable length serial data set to a file directly (data could create up to a 300kB text file). Any advice on where to point me or examples would be appreciated. Thanks.


JDavis Oct 26, 2023 09:58 PM

Here is a general flow of the program instructions to use. You will have to fill in the instruction parameters for it to work.

 

    SerialOpen()
    SerialOut() 'Send out command
    FileOpen()
    Delay() 'Allow some time for initial response
    Do While SerialInChk()
      SerialIn()
      FileWrite()
      Delay() 'A short delay to allow some more characters to enter buffer
    Loop
    FileClose()

 


soloha Apr 29, 2024 11:05 AM

it so intersting, thanks for everyone for this good forum topic


dansonpasquale May 9, 2024 09:30 AM

It is pretty interesting, and I would want to express my gratitude to everyone who has contributed to developing this fascinating topic of conversation. gorilla tag


lancho Sep 23, 2024 02:19 AM

Thanh you very much

Log in or register to post/reply in the forum.