
Paroscientific, Inc. Technical Note
Precision Pressure Instrumentation Doc. No. G8044 25 March 2005
©2005 Paroscientific, Inc.
11
Appendix –B
Source Code for CR1000 to Read Data from Digiquartz® Instruments
'CR1000 Series Datalogger Program for Digiquartz Intelligent Sensors
'Program author: Paroscientific, Inc.
'Description: This code reads and stores data from Digiquartz Intelligent Products.
'The code has the necessary commands to read pressure (P3), pressure period (P1), sensor
'temperature (Q3), sensor temperature period (Q1), humidity (RH) and ambient temperature (TT).
'Enable or disable related code lines to read different parameters.
Public OutString as string * 100
Public InString as string * 100
Public Pressure as string * 100
Public Pper as string * 100
Public Temp as string * 100
Public Tper as string * 100
Public AmbT as string * 100
Public AmbRH as string * 100
'Define storage area in memory. Table name is Digiqrtz.
'Enable/disable the parameters below to include/exclude different parameters. Default reading is pressure
DataTable (Digiqrtz,1,-1)
DataInterval (0,10,Sec,10)
Sample (1,Pressure,String) 'Store Pressure
Sample (1,Pper,String) 'Store Pressure Period
Sample (1,Temp,String) 'Store Temperature
Sample (1,Tper,String) 'Store Temp. Period
Sample (1,AmbT,String) 'Store Ambient Temperature
Sample (1,AmbRH,String) 'Store Humidity
EndTable
'Main Program
BeginProg
'Set up communication port to send and receive data
SerialOpen (Com1,9600,0,0,10000) 'Uses COM1. Default 9600 baud rate. Change if instrument has different baud
rate.
Scan (10,Sec,0,0) 'Read data every 10 seconds. Change if needed.
OutString = "*0100P3"+CHR(13)+CHR(10)
'Send Pressure string over one communication port C1 (COM1 TX).
SerialOut (Com1,OutString,"",0,500)
'Receive String on port C2 (COM1 RX).
SerialIn (Instring, Com1,500,10,100) 'Receive timeout is 5 secs. Change if needed.
SplitStr (Pressure,InString,"*0001",1,4)
'Send Pper string over one communication port C1 (COM1 TX).
OutString = "*0100P1"+CHR(13)+CHR(10)
SerialOut (Com1,OutString,"",0,500)
'Receive String on port C2 (COM1 RX).
SerialIn (Instring, Com1,500,10,100) 'Receive timeout is 5 secs. Change if needed.
SplitStr (Pper,InString,"*0001",1,4)
Comentários a estes Manuais