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
DataTable(testasdf,True,-1)
DataInterval(0,2,Sec,10)
Average(1,Temp_C,FP2,False)
Sample(1,PBT330_TQFE,String)
EndTable

DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,BattV,FP2,False,False)
EndTable

'Main Program
BeginProg
'Open Serial port
SerialOpen(COMU3, 4800, 26, 0, 25)
'Main Scan
Scan(500,mSec,4,0)
'Default CR6 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default CR6 Datalogger Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,60)
'Type T Thermocouple measurements 'Temp_C'
TCDiff(Temp_C,1,mv200C,U1,TypeT,PTemp_C,True,0,60,1,0)
SerialOutBlock(COMU3,"TQFE ?",6)
Delay(0,5000,mSec)
SerialInRecord(COMU3,PBT330_TQFE,&h02,0,&h0D,PBT330_TQFE,01)
'Call Data Tables and Store Data
CallTable testasdf
CallTable Table2
NextScan
EndProg

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.

Results

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.

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

Hi

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?

Smile


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.