Appendix C. Monitoring Sampler Status via RS-485
C-7
C.4.2.1 Modbus® Monitoring with Time-Based Configuration
'PVS5120/VSC100 program communicating via Modbus
'hardware includes MD485
'date: 2014-10-21
PreserveVariables
'Declare Public Variables
'The following two variables are used to convert the numeric error code value from the sampler
'to a text message.
Dim Response_List(9) As String
Public response_code_message As String
Public GetStatus As Boolean
Public MBAddress
Public Sampler_status(4)
'*** Status Values returned by the sampler once a sample is collected ****
Alias Sampler_status(1) = CurrentBottle 'Discrete distrubitor arm position
Alias Sampler_status(2) = SampleCount 'How many samples are currently in bottle
Alias Sampler_status(3) = ResponseCode 'Numeric response code
Alias Sampler_status(4) = SamplerBatt 'Sampler battery voltage (V)
Public MbResult'need a result variable for every Modbus instruction
'increment greater than zero to let you know if a communication does not occur
'Define tables
DataTable (SamplerStatus,True,-1) 'stores sampler status values
Sample (1,CurrentBottle,FP2)
Sample (1,SampleCount,FP2)
Sample (1,ResponseCode,FP2)
Sample (1,response_code_message,String)
Sample (1,SamplerBatt,FP2)
EndTable
DataTable (ModbusErrors,true,-1) 'stores the Modbus errors
Sample (1,MbResult,FP2)
EndTable
'Main Program
BeginProg
'The following text is associated with the numeric response codes provided
'from the sampler after each attempted sample.
Response_List(1) = "No error"
Response_List(2) = "All samples complete"
Response_List(3) = "Low start battery (V<11.0 V)"
Response_List(4) = "Low run battery (V<10.5V)"
Response_List(5) = "Sampler vacuum timed out, no sample detected"
Response_List(6) = "Sample overflow detected"
Response_List(7) = "No sample liquid detected"
Response_List(8) = "Arm calibration error"
Response_List(9) = "Conductivity rod and Sample tube are shorted"
MBAddress = 1'This must also be set in DevConfig for each sampler. The address must be unique if you are
‘using multiple samplers.
Scan (30,Sec,0,0)
ModbusMaster (MbResult,ComSDC7,38400,MBAddress,3,Sampler_status(),23,4,3,100,0)
'reading actual status values
response_code_message = Response_List(Respo1)
'adjust the numeric response code the to assigned message
CallTable SamplerStatus
'send the sampler status to the table
NextScan
EndProg
Summary of Contents for PVS5120 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 8: ......
Page 70: ...Appendix A Sample Transport Velocity A 2...
Page 78: ...Appendix B Example Programs B 8...
Page 86: ...Appendix C Monitoring Sampler Status via RS 485 C 8...
Page 96: ...Appendix G Generic Modbus Control G 4...
Page 100: ...Appendix H ISO5667 Conformity H 4...
Page 101: ......