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()

 


villagetunic Mar 25, 2024 04:46 AM

A high-level outline of the program's instructions is shown below. For it to function, you'll need to input the parameters of the instruction. geometry dash

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