Hello,
I am trying to connect to and query a Larson Davis 824 noise level meter through the cs i/o port of a CR3000. I am able to connect to the sound meter via puttytel on my computer no problem, so the issue must be the code I am using. The noise level meter baud rate is set to 9600. For right now all I am trying to do is query the current sound pressure level. In puttytel I am using the following commands:
"enter"
R4,x "enter"
What is returned is a number, e.g., 33.8
This is the code I am using:
'CR3000
'Larson Davis Noise Level Meter Test Program
'\\\\\\\\\\\\\\\\\\\\\\\\\ DECLARATIONS /////////////////////////
Public SPL As String * 100
Public NBytesReturned, SensorInput As String *16
'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ////////////////////////////
BeginProg
SerialOpen (ComME,9600,0,0,10000)
Scan (10,Sec,0,0)
SerialOut (ComME,CHR(13),"",1,1)
SerialOut (ComME,"R4,x"&CHR(13),"",1,1)
Delay(0,100,mSec)
SerialInRecord (ComME,SPL,0,8,0,NBytesReturned,00)
SerialFlush (ComME)
NextScan
EndProg
Any help you could provide would be greatly appreciated. I have been banging my head all day trying to figure this out.
Thank you,
Aaron
Do you have a CSIO to RS232 converter between the sensor and the logger?
I do not, whoops. Would it be possible to switch everything to the RS232 port? I tried code for that as well with no luck.
I switched everything over to Com1 and can now see the traffic on the Device Configuration Terminal, but the data isn't showing up in the real time data tables. This is where the code is at now:
'CR3000
'Larson Davis Noise Level Meter Test Program
'\\\\\\\\\\\\\\\\\\\\\\\\\ DECLARATIONS /////////////////////////
SequentialMode
Public SPL As String
Public SPLBytes, DateTimeBytes
Public DateTime As String
Const CR=CHR(13)'+ CHR(10)
'Define Data Tables
DataTable(TableLD,true,-1)
DataInterval(0,1,Min,10)
Sample(1,SPL,String)
EndTable
'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ////////////////////////////
BeginProg
SerialOpen (Com1,9600,0,0,1024)
Scan (10,Sec,0,0)
SerialOut (Com1,"R4,x" + CR,"",1,0)
SerialInRecord (Com1,SPL,&H20,256,0,SPLBytes,00)
Delay(0,1,Sec)
SerialOut (Com1,"R2" + CR,"",1,5)
SerialInRecord (Com1,DateTime,0,256,0,DateTimeBytes,00)
CallTable TableLD
NextScan
EndProg
I changed serialinrecord to serialin, and it seems to be working now.