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.
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()
it so intersting, thanks for everyone for this good forum topic
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
Thanh you very much
You can use the SerialOpen and FileWrite functions in CRBasic to handle variable-length serial data streaming to a file. Since there's no end character, you might need to implement a timeout for when the data stops transmitting. Check Campbell Scientific's forums or support resources for more detailed examples.
More infor in: https://s.campbellsci.com/documents/br/manuals/cr1000.pdf/hills of steel
This post is under review.
This post is under review.