I have a weater station connected to the MD485 on port A- and B+. The led B flashes correctly every second, that means that the signal commes without errors. I connected CS I/O port of the MD485 to CS I/O port of the datalogger CR1000 with the RS232 cable. I set the MD485 protocol configuration to transparent mode and SD7.
With my programm on CR1000 I read the MetPack string (wm_string) as follows:
...
Scan (1,Sec,0,0)
SerialOpen (ComSDC7,9600,0,0,512)
SerialIn (wm_buffer,ComSDC7,5,ETX,55)
SerialFlush(ComSDC7)
iStart = InStr (1,wm_buffer,"Q",2)+2
iEnd = InStr (1,wm_buffer,ETX,2)-1
wm_string = Mid(wm_buffer,iStart,iEnd-iStart)
SplitStr (wm_token(),wm_string,"",5,0)
...
For about the first 10 minutes it works fine, evey second I read the string. But after that time I get empty strings. I can't explain what happens, both leds on the MD485 have a short flash every 2 or 3 seconds. Any help would be appreciate.
I recommend taking out the SerialIn, SerialFlush, and InStr. Replace them all with a SerialInRecord. You can read from the Q to the ETX character. Look at the manual for the Windsonic1-L. It has a similar output.
Ok, I wrote SerialInRecord(ComSDC7, wm_string, &h512C, 0, &h2C03,NBReturn,01) and it workes like a charm. &h512C stands for "Q," and &h2C03 for ",ETX" (without double quotes).
Thanks for help.