SWVX (Switched Voltage Excitation)

The SWVX instruction is used to set an excitation channel high or low. To set a digital I/O port high or low, use the PortSet instruction.

Syntax

SWVX ( ExChan, State, Voltage, SWOption )

Remarks

CR1000X dataloggers have 4 excitation channels. These channels can be used to provide a regulated 5 V or 3.3 V supply to external peripherals under program control. If more specific voltage levels are desired, consider using ExciteV to power peripherals.

Parameters

ExChan (Excitation Channel)

The EXCHan argument specifies the excitation channel that should be set by the instruction. An alpha-numeric code is entered:

Alphanumeric Code Description
VX1 Excitation channel 1
VX2 Excitation channel 2
VX3 Excitation channel 3
VX4 Excitation channel 4

Type: Constant

State

Determines whether to set the port high or low. Right-click to display a list.

Value State
0 Low
≠0 High

Type: Constant, Variable, or Expression

Voltage

Sets the voltage for the VX channel.

Option Description
0 3.3V
1 5V (default)

Type: Numeric

NOTE: When the datalogger is powered by USB only, the voltage is ~ 2.5 V for either voltage option.

Option (Run Mode Option)

An optional parameter that determines whether the instruction will run in the measurement task sequence or the processing task sequence, and 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 this instruction in the processing task when the program is run in Closedpipeline mode A CRBasic program execution mode wherein instructions are evaluated in groups of like instructions, with a set group prioritization. can prove to be problematic if you are using the instruction to power a sensor. Because processing tasks can lag behind measurement tasks in PipelineMode, the instruction may be processed by the device after the measurement has already been made. To avoid this scenario, program the datalogger to operate in SequentialMode.

Type: Constant