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.

NAN response from serial connection with Vaisala PTB330

whoneyc Sep 15, 2021 09:56 PM

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:

'CR6 Series

'Declare Variables and Units
Public BattV
Public PTemp_C
Public Temp_C
Public PBT330_TQFE as String * 50

Units BattV=Volts
Units PTemp_C=Deg C
Units Temp_C=Deg C

'Define Data Tables


'Main Program
'Open Serial port
SerialOpen(COMU3, 4800, 26, 0, 25)
'Main Scan
'Default CR6 Datalogger Battery Voltage measurement 'BattV'
'Default CR6 Datalogger Wiring Panel Temperature measurement 'PTemp_C'
'Type T Thermocouple measurements 'Temp_C'
SerialOutBlock(COMU3,"TQFE ?",6)
'Call Data Tables and Store Data
CallTable testasdf
CallTable Table2

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:

" 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.

My Questions

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?

smile Sep 22, 2021 08:48 AM


your sentence:

"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?


whoneyc Sep 29, 2021 11:45 PM

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.

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