I am attempting to Hello World a serial connection with a CR6-WIFI connected to a Vaisala PTB330 pressure sensor. I have attempted to follow the serial communications white paper for the datalogger, and I receive an "NAN" response. This is my first time using CRBasic, coming from Arduino, so I may be missing something obvious. Here is my code:
'Declare Variables and Units
Public PBT330_TQFE as String * 50
Units PTemp_C=Deg C
Units Temp_C=Deg C
'Define Data Tables
'Open Serial port
SerialOpen(COMU3, 4800, 26, 0, 25)
'Default CR6 Datalogger Battery Voltage measurement 'BattV'
'Default CR6 Datalogger Wiring Panel Temperature measurement 'PTemp_C'
'Type T Thermocouple measurements 'Temp_C'
'Call Data Tables and Store Data
Wiring is a 3-Wire RS-232 type connection using the RX/TX/Gnd terminals on the PTB330.
Simple Description of Operations
In the code, I attempt to send ``TQFE ?`` via serial, which is the command required by the Vaisala to read a temperature value (picked arbitrarily as my Hello World variable). I delay for a moment, then I request bytes to be stored in PBT330_TQFE with that length.
The expected result is a string which looks like: "T 123.45 C". The observed result is "NAN".
What I've Tried
I have played with portions of the code here to no avail, this includes: changing the delay length, the line begin char, and the line termination char. I am particularly suspicious of the line ending char, since the protocol guide for the PTB330 is decidely vague on the subject. I would normally assume a EOL or null termination, but the guide only vaguely hints at LF and CR symbols.
I attempted to analyze the communications using the terminal emulator. When I do so, I only see the OUT message:
"12.34.56.000 T TQFE ?"
and nothing following it. I can't tell without pulling out my oscilloscope if the sent message is sending a response. The "NAN" I see in the data viewer is likely an empty or overrun string.
Why am I not receiving a response from the sensor? Is there something obvious I have messed up? Does anyone have any experience with this instrument?
"I attempted to analyze the communications using the terminal emulator. "
which terminal do you mean? that of the logger? or via RS232 via PC?
if you use the logge,r via the Serial Talk Through and/or Comms Watch function?
Smile, I was able to fix the problem with a little more effort. It turns out it was a wiring problem.
I meant the debugging "terminal emulator" via the LoggerNet Connect software.
Also, I apologize for dual-posting topics. If the Mods are able to merge and close threads, please do so. I will be replying in more detail in the other thread: https://www.campbellsci.com/forum?forum=1&l=thread&tid=16747.
This topic is closed.