background image

Appendix B. Example data
logger programs

There follows two simple examples of how to write programs in CRBasic to send and receive data
using the SDM-SIO2R. These programs are not extensive and are fundamentally no different to
those written for use when reading data from a standard data logger serial port.

The program code is the same for all data loggers that support the SDM-SIO2R.

The exact program to be used will vary with the serial device being used. Unfortunately, the
number of possible variations of reading different sensors is almost infinite. If you are struggling
to write code, please contact Campbell Scientific who may already have experience with the
sensor and may be able to offer advice on how to deal with it.

A third example shows how to control the switched relay power using the

SDMGeneric()

instruction.

SDM-SIO2R Serial Input/Output Module with Switched Sensor Power

45

Содержание SDM-SIO2R

Страница 1: ...Preliminary 03 2023 Copyright 2023 Campbell Scientific Inc...

Страница 2: ...O2R in a system 20 6 2 1 2 Using two SDM SIO2Rs in a system 20 6 2 1 3 Using three SDM SIO2Rs in a system 21 6 2 1 4 Using three or more SDM SIO2Rs in a system 21 6 2 2 Wiring examples for connecting...

Страница 3: ...ink in receive only mode 35 7 2 Power conservation 35 7 3 Schematic 36 8 Troubleshooting and maintenance 37 8 1 Troubleshooting 37 8 2 Maintenance 39 8 2 1 Upgrading the operating system 39 8 2 2 Oper...

Страница 4: ...tched voltages Figure 1 1 SDM SIO2R 2 Precautions l WARNING Ensure that the 12V power supply for the module is switched off when connecting the power and ground wires to the SDM SIO2R When making conn...

Страница 5: ...connections are not given on the device Instead the user should study this manual and in particular Voltage specifications p 6 to determine the maximum voltages that are applicable to any terminal be...

Страница 6: ...and diagnostic purposes Please refer to the data logger manual for further details The SDM SIO2R has four terminals that allow the user to control voltage on or off l Sensor 1 12V l Sensor 1 V l Sens...

Страница 7: ...e that the characters received by the SDM SIO2R have a delay of at least one bit period between them This does not affect any other configuration and does not affect transmissions out of the SDM SIO2R...

Страница 8: ...rialOpen in receive only mode Active current RS 232 15 18 mA 16 26 mA Active RS 232 command Active current RS 485 15 63 mA 16 77 mA Active RS 485 command no termination resistors RS 232 and RS 485 cur...

Страница 9: ...the maximum recommended loading Removing any termination resistance should dramatically decrease current consumption during transfer of data 4 The RS 485 interface is protected against short circuits...

Страница 10: ...ges as there will be an increased chance that external noise may cause errors in the incoming data 5 3 Temperature and humidity ranges Temperature Range Minimum Maximum Notes Standard range 40 C 70 C...

Страница 11: ...be taken when interpreting any wiring instructions generated by Short Cut to account for the differences in wiring a sensor to the SDM SIO2R rather than directly to the data logger For other sensors...

Страница 12: ...nd some simple program examples The SDM SIO2R can also be used as an interface to Modbus and DNP3 sensors or networks The interface is configured by including an extra SerialOpen instruction at the st...

Страница 13: ...Figure 6 2 DIN rail release bar All SDM SIO2Rs that are connected on the DIN rail will share a common bus SDM SIO2R Serial Input Output Module with Switched Sensor Power 10...

Страница 14: ...Figure 6 3 Multiple SDM SIO2Rs sharing a common bus Keep SDM SIO2Rs apart to maintain separate buses SDM SIO2R Serial Input Output Module with Switched Sensor Power 11...

Страница 15: ...dress of the second serial port will follow sequentially from the port 1 address For example if the address switch is set to 4 sensor 1 has SDM address 4 and sensor 2 has SDM address 5 Since each SDM...

Страница 16: ...address will result in the SDM SIO2R having an address of 0 rather than F 6 2 Connection and wiring SDM SIO2R connections to the data logger are made via the Input connector Strip wires 7 to 9 mm and...

Страница 17: ...er and insert the wire into the round hole Release the clamp and verify the clamp grips the wire rather than the plastic insulation See Serial and switched power connections p 14 Figure 6 6 Serial and...

Страница 18: ...ication connectors longer ferrules must be used for example Campbell Scientific pn 40233 If necessary a connector can be removed from the device by unlocking the slide bar See Connector release slide...

Страница 19: ...ns on the SDM SIO2R Table 6 2 SDM SIO2R input terminal labels and functions Power SDM V V 12V G C1 C2 C3 1 2 3 4 5 6 7 Table 6 3 p 16 shows all the serial communication connections on the SDM SIO2R No...

Страница 20: ...ns Power pass through V V G 12V 1 2 3 4 Table 6 5 SDM SIO2R functional description of input connections Pin Case text Connection to Description 1 V Power supplies Power supply 0 30V AC DC 2 V Power su...

Страница 21: ...nd for RS 232 communications 3 RTS TD RS 232 RTS RS 485 half duplex non inverting RS 485 full duplex outgoing 4 Tx TD RS 232 transmit RS 485 half duplex inverting RS 485 full duplex outgoing 5 Rx RD R...

Страница 22: ...ideration issues such as power consumption cable lengths RS 485 being better than RS 232 for long cables synchronization of data collection etc NOTE If possible use screened cable for connecting the S...

Страница 23: ...6 2 1 1 Using one SDM SIO2R in a system 6 2 1 2 Using two SDM SIO2Rs in a system SDM SIO2R Serial Input Output Module with Switched Sensor Power 20...

Страница 24: ...wiring the SDM SIO2R varies with the type of device it is going to exchange data with The variables include the type of interface used RS 232 RS 485 or RS 422 whether handshaking is used whether the c...

Страница 25: ...igurations are given as examples in the following subsections 6 2 2 1 RS 485 RS 422 full duplex one to one connection example 6 2 2 2 RS 485 full duplex multi drop example SDM SIO2R Serial Input Outpu...

Страница 26: ...ce but RS 485 half duplex networks are the most common multi drop configuration If wiring for multiple devices make the three wire connections in parallel similar to that shown in the full duplex mult...

Страница 27: ...configuration may be used if the device is fitted with a standard 9 way D connector as was commonly fitted to computers for their RS 232 port You need to check whether the device is configured as a D...

Страница 28: ...ircuitry when not being used in handshaking mode Note that when using CTS RD and RT TD lines as input and output the voltage levels are 5V NOT 0 and 5V l CTS RD and RTS TD cannot be used as separate i...

Страница 29: ...d to hold any incoming bytes from the SDM device SDM_addr is the SDM address of the device HexVar is a 2 digit hex value that determines if a voltage is turned on or off The left digit controls V the...

Страница 30: ...he user has knowledge of the CRBasic programming language A useful introduction to programming for serial sensors can be found here https s campbellsci com documents sp technical papers serial pdf See...

Страница 31: ...ussed in greater detail in Using RTS CTS and automatic handshaking p 34 l SerialOpenFormat This parameter sets the data format It also determines whether the SDM SIO2R works in normal RS 232 listen on...

Страница 32: ...rialOpenFormat Parity No stop bits No data bits 14 Even 2 7 15 None 2 7 1 This mode is only supported if there is at least a one bit delay between characters received by the SDM SIO2R SDM SIO2R Serial...

Страница 33: ...n 1 8 19 None 1 8 20 Not used 21 Odd 2 8 22 Even 2 8 23 None 2 8 24 Not used 25 Odd 1 7 26 Even 1 7 271 None 1 7 28 Not used 29 Odd 2 7 30 Even 2 7 31 None 2 7 1 This mode is only supported if there i...

Страница 34: ...n 1 8 51 None 1 8 52 Not used 53 Odd 2 8 54 Even 2 8 55 None 2 8 56 Not used 57 Odd 1 7 58 Even 1 7 591 None 1 7 60 Not used 61 Odd 2 7 62 Even 2 7 63 None 2 7 1 This mode is only supported if there i...

Страница 35: ...R unit into shutdown mode where only SDM communications will operate This means any data coming into the SDM SIO2R on the RS 232 RS 485 interface will be lost This is the lowest possible power mode an...

Страница 36: ...tific data loggers It is possible to reduce this time and the transfer time by using the SDMSpeed instruction This can be done if using short cable runs between the data logger and all SDM devices 6 3...

Страница 37: ...free to receive or transmit data This interface is often called RTS CTS hardware handshaking or DTR DTE Automatic handshaking for the SDM SIO2R is activated through use of the BaudRate parameter of t...

Страница 38: ...as been transmitted before the SDM SIO2R will listen for new incoming data NOTE When in either RS 485 half duplex or full duplex modes the user cannot set or clear the spare I O ports pins 8 and 11 7...

Страница 39: ...output drivers see Using the RS 232 link in receive only mode p 35 If using RS 232 mode also avoid connecting handshaking lines that are not required to avoid an unnecessary 2 mA drain per line The S...

Страница 40: ...R 8 Troubleshooting and maintenance 8 1 Troubleshooting If correctly connected the SDM SIO2R normally operates seamlessly However there are some common issues people encounter during setup or sometime...

Страница 41: ...ed and transposed Generally for these lines it is safe to try swapping them around if there is doubt as to whether the same terminology is being used If you are sure the configuration and wiring of th...

Страница 42: ...tware New versions can be downloaded from the Campbell Scientific website at www campbellsci com Follow the instructions for that device to load a new operating system At the end of the process a succ...

Страница 43: ...sing the preceding procedure If this does not correct the fault the unit may be faulty and will need to be returned to the factory for repair 8 2 3 Checking the operating system version and signature...

Страница 44: ...big endian or 0 little endian Const delay_usec 0 constant delay between outgoing bytes negative means delay also for incoming bytes Const Ver_values_in 20 constant number of values to receive Const S...

Страница 45: ...r enables automatic handshaking as discussed in Using RTS CTS and automatic handshaking p 34 these pins cannot be accessed A 1 The input pin CTS The state of the input line can be read by using the sp...

Страница 46: ...eric instruction to send command 0x01 which returns the input line state as bit 16 SDMGeneric sio1response addr cmd bytes_out Values_in bytes_val _ big_endian delay_usec bit 16 set for input line high...

Страница 47: ...set the output pin on the SDM SIO2R high then low respectively on the SDM SIO2R device set to address 0 on its rotary switch Any value greater than 1 will set the output pin high but usually the numbe...

Страница 48: ...ata loggers that support the SDM SIO2R The exact program to be used will vary with the serial device being used Unfortunately the number of possible variations of reading different sensors is almost i...

Страница 49: ...ed Scan 1000 mSec 0 0 Open serial port to RS 232 mode 115200bps 8 bit data 1 stop bit and no parity SerialOpen SensorPort 115200 3 100 10000 open the serial port to the sensor Request data will need t...

Страница 50: ...are the serial port the sensor is set to The sensors address switch should be set to position 0 SDMSpeed 30 Optionally set the SDMSpeed not normally needed Scan 1000 mSec 0 0 Open serial port to RS 48...

Страница 51: ...ting with valid addresses 0 14 Const SDM_addr1 1 sdm address of device communicating with valid addresses 0 14 Const cmd_byte 7 setup byte sent to SDM device Public hexVar0 As Long variable holding va...

Страница 52: ...Sensor2 12V OFF Sensor2 V OFF SDMGeneric dest SDM_addr0 cmd_byte num_vals_out hexVar0 num_vals_in bytes_per_value big_endian delay_byte SDMGeneric dest SDM_addr1 cmd_byte num_vals_out hexVar1 num_vals...

Страница 53: ...in bytes_per_value big_endian delay_byte ElseIf counter 9 Then hexVar0 H02 Sensor1 12V OFF SDMGeneric dest SDM_addr0 cmd_byte num_vals_out hexVar0 num_vals_in bytes_per_value big_endian delay_byte Els...

Страница 54: ...er manufacturer s products that are resold by Campbell Scientific are warranted only to the limits extended by the original manufacturer Refer to www campbellsci com terms warranty for more informatio...

Страница 55: ...ion or Repair Reference number contact your CAMPBELL SCIENTIFIC regional office Please write the issued number clearly on the outside of the shipping container and ship as directed For all returns the...

Страница 56: ...rohibit climbing by other persons Take reasonable precautions to secure tripod and tower sites from trespassers l Use only manufacturer recommended parts materials and tools Utility and Electrical l Y...

Страница 57: ...nfo campbellsci fr www campbellsci fr Germany Location Phone Email Website Bremen Germany 49 0 421 460974 0 info campbellsci de www campbellsci de India Location Phone Email Website New Delhi DL India...

Отзывы: