SW12 (Switched 12 Volt)
The SW12 instruction is used to set the switched 12 volt channel high or low.
Syntax
SW12 (

This example program shows the use of the SW12 instruction to power an HMP45C temperature and RH sensor.
'measurement being made -- see SW12 instruction in help file
SequentialMode
'Declare Variables and Units
Public Batt_Volt
Public AirTC
Public RH
Units Batt_Volt=Volts
Units AirTC=Deg C
Units RH=%
'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,60,Min,0)
Average(1,AirTC,FP2,False)
Sample(1,RH,FP2)
EndTable
'Main Program
BeginProg
Scan(5,Sec,1,0)
'Default Datalogger Battery Voltage measurement Batt_Volt:
Battery(Batt_Volt)
'HMP45C measurements AirTC and RH:
SW12(
Delay(0,150,mSec)
SW12(
If RH>100 And RH<108 Then
RH=100
'Call Data Tables and Store Data
CallTable(Table1)
NextScan
EndProg
Remarks
The datalogger has two switched 12 volt outputs. These ports are used to provide a 12 volt supply to external peripherals under program control. At room temperature the switched 12 volt supply can source 900 mA between the SW12 terminal and Ground.
Parameters
SW12Chan
The SW12Chan parameter indicates which SW12 port to set. Valid ports are:
Port | Description |
---|---|
SW12_1 | Switched 12 V port 1 (SW |
SW12_2 | Switched 12 V port 2 (SW |
SW12_CSIO | CSIO - CR1000Xe Only |
State
The State parameter indicates whether the switched 12 volts is High (non-zero) or low (0).
Option
Optional parameter that determines whether the instruction will run in the measurement task sequence or the processing task sequence; also affects whether the program will compile and run in SequentialMode or PipelineMode:
Option | Description |
---|---|
Omitted | Instruction is run within the measurement task sequence; program will compile in SequentialMode |
0 | Instruction is run within the measurement task sequence; program will attempt to compile in PipelineMode* |
1 | Instruction is run within the processing task sequence; program will attempt to compile in PipelineMode* |
*other programming may force the program into SequentialMode
Running the SW12 instruction in the processing task when the program is run in Pipeline mode can prove to be problematic if you are using the SW12 control to power a sensor. Because processing tasks can lag behind measurement tasks in PipelineMode, the SW12 instruction may be processed by the datalogger after the measurement has already been made. To avoid this scenario, program the datalogger to operate in SequentialMode.
NOTE: The SW12 supply is unregulated and can supply up to 1.10 A at 20 degrees C, 640 mA at 70 degrees C, and 500 mA at 85 degrees C. A resettable polymeric fuse protects against over-current. Reset is accomplished by removing the load or turning off the SW12 for several seconds.