Breadcrumbs

set_digital_outputs()

set_digital_outputs(bit_list)

Features

This function sends a signal to multiple digital output contact points of the controller.

The digital signals of the contact points defined in bit_list are output at one.

Parameters

Parameter Name

Data Type

Default Value

Description

bit_list

list (int)

-

List of multiple output contacts

  • The positive contact number outputs ON: 1~16

  • The negative contact number outputs OFF: -1~-16

Return

Value

Description

0

Success

Negative value

Failed

Exception

Exception

Description

DR_Error (DR_ERROR_TYPE)

Parameter data type error occurred

DR_Error (DR_ERROR_VALUE)

Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME)

C extension module error occurred

DR_Error (DR_ERROR_STOP)

Program terminated forcefully

Example

Python
set_digital_outputs(bit_list=[1,2,3,4,5,6,7,8])  # Contact number 1-8 ON 
set_digital_outputs([-1,-2,-3,-4,-5,-6,-7,-8])    # Contact number 1-8 OFF
set_digital_outputs([1,-2,3])               # Contact no. 1 ON, no. 2 OFF, and no. 3 ON 
set_digital_outputs([4,-9,-12])             # Contact no. 4 ON, no. 9 OFF, and no. 12 OFF


set_digital_outputs(bit_start, bit_end, val)

Features

This function sends multiple signals at once from the digital output start contact point (bit_start) to the end contact point (bit_end) of the controller.

Parameters

Parameter Name

Data Type

Default Value

Description

bit_start

int

-

Beginning contact number for output signal (1~16)

bit_end

int

-

Ending contact number for output signal (1~16)

val

int

-

Output value

Note

  • Bit_end must be a larger number than bit_start.

  • Val is the value of the combination of bits where bit_start =LSB and bit_end=MSB.
    Ex) bit_start =1, bit_end=4, val=0b1010 # No. 4=ON, no. 3=OFF, no. 2=ON, and no. 1=OFF

Return

Value

Description

0

Success

Negative value

Failed

Exception

Exception

Description

DR_Error (DR_ERROR_TYPE)

Parameter data type error occurred

DR_Error (DR_ERROR_VALUE)

Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME)

C extension module error occurred

DR_Error (DR_ERROR_STOP)

Program terminated forcefully

Example

Python
# Outputs contact 1=ON, contact 2=ON, contact 3=OFF, and contact 4=OFF.
set_digital_outputs(bit_start=1, bit_end=4, val=0b0011) # 0b means a binary number.

# Outputs contact 3=ON and contact 4=OFF. 
set_digital_outputs(bit_start=3, bit_end=4, val=0b01) # 0b means a binary number.

# Outputs the ON signal from contacts 1 through 8.
set_digital_outputs(1, 8, 0xff)                        # 0x means a hexadecimal number.