'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) 'Send Temperature string over one communication port C1 (COM1 TX). OutString = "*0100Q3"+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 (Temp,InString,"*0001",1,4) 'Send Tper string over one communication port C1 (COM1 TX). OutString = "*0100Q1"+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 (Tper,InString,"*0001",1,4) 'Send ambient temperature string over one communication port C1 (COM1 TX). OutString = "*0100TT"+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 (AmbT,InString,"*0001",1,4) 'Send humidity string over one communication port C1 (COM1 TX). OutString = "*0100RH"+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 (AmbRH,InString,"*0001",1,4) 'Call Output Tables to store values CallTable Digiqrtz NextScan EndProg