I am trying to connect a Vector instrument (by Nortek AS) to CR1000 using the serial port. Vector is streaming data structures in binary format. All data structure is starting with a5 byte, and then are followed by one byte which identifies the data structure (e.g. &H10, &H11, etc). Third and fourth bytes give the size of the structure which is being streamed. The content of the data structure follows and at the end we get the check-sum.
Problem 1:
I set the instrument to continuous streaming of data. If I connect the instrument to the computer and set the hyperterminal, the data are coming instantly (i.e. without giving any additional commands to the instrument).
If I connect the CR1000 to computer through RS232, the LoggerNet and PC400 can communicate without problem to the data logger.
When I connect Vector to CR1000 and try to listen to the serial port through either SerialIn or SerialInBlock, the instrument seemed to be silent. I tried this both with Com1 and RS232. However, when I interchange the Tx and Rx wires, CR1000 starts immediately showing that there are data coming. Why?
Problem 2:
Even though I start to get some bytes, the data is corrupt. At first I used SerialIn and I got first 2 bytes of information. I could clearly see that there is missing &HA5 byte. Then I tried to use SerialInBlock to read the data into an array of longs. I decoded the data that I got into bytes and I analyzed the stream. I noticed that CR1000 is skipping all &HA5 bytes. Even forgetting about this byte and analyzing other bytes of the structure, I didn't get enough bytes. I think CR1000 was skipping also other bytes. There was not any problem when reading the stream on the PC HyperTerminal. Could it be a problem of SerialInBlock? If I don't have any termination character and I don't know a priori the size of the data structure, how can I use SerialInRecord in this case?
Thank you for any help.
Eugen
However, when I interchange the Tx and Rx wires, CR1000 starts immediately showing that there are data coming. Why?
The datalogger's RS232 port is a DCE device, thus enabling it to communicate with a computer using a "straight-through" serial cable. (Computers are DTE devices.) See the manual, appendix C.2 for additional information.
I noticed that CR1000 is skipping all &HA5 bytes.
If the serial port is not set to "always on", you may miss the first few characters of incoming data. Refer to the manual, section 11.8.9 Q&A (for Serial ports). You may want to read the entire section 11 of the manual for a good overview of using serial devices.
The manual can be found here:
http://www.campbellsci.com/documents/manuals/cr1000.pdf
Regards,
Dana W.