Skip to main content
Skip table of contents

Modbus TCP WCI Writer

Create WCI using Workcell Item Writer.

  • WCI can be newly created, or existing WCI can be modified.
  • Create new WCI: Add New
  • Modify existing WCI: Check one of existing WCI → Edit


Write and modify WCI (General Info)

  1. Select WCI Category.
    • EndEffector → Gripper

  2. Enter WCI Name and Description in WCI Info.
    • Modbus_TCP
    • Modbus TCP gripper
  3. Enter the name or Language Code of WCI in Multi-language input field (The name written here will appear on teach pendant).
    • Choose: (none)
    • Enter: Modbus_gripper
  4. Select WCI icon.
    • gripper

  5. Enter WCI version.
    • 0.1

  6. Select Visibility Type.
    • Internal


Write and modify WCI (Workcell Item Setting)

  • Workcell I/O Component: Communication Component
  • DRL Component: Component that writes the functions of WCI Action
  • UI Component: Component that provides user input connection function


Workcell I/O Component

1. Add Modbus TCP in Communication Component and enter the Property values as follows.

  • IP Adress : 192.168.137.253
  • Port Number : 502
  • Slave ID : 255


2. Add Output Signal and enter the Property values as follows.

  • Write Signal Name : ctrlword
  • Signal Type : Write Multiple Registers
  • Signal Address Index : 2049
  • Signal Initial Value : 0
  • Custom Data : 0,0,0,0


3. Add Input Signal and enter the Property values as follows.

  • Write Signal Name : statusword
  • Signal Type : Red Registers
  • Signal Address Index : 1


DRL Component

1.  Mandatory WCI Action: Set up essential functions related to WCI.

  • Gripper → Grasp

Grasp()

PY
def Grasp():
    # get gripper status, split and return the 2,1,0 bit of first byte of the status word     .
    # 0(0b xxxx.x000): Error
    # 1(0b xxxx.x001): Out of specification
    # 2(0b xxxx.x010): Maintenace required
    # 3(0b xxxx.x011): Ready for operation (= there is no error)
    def get_gripper_status(_status_bin):
        _status_bin_list = []
        for n in _status_bin:
            tp_log("pos SW002: " + str(bin(n)[2:]))
            _status_bin_list.append(bin(n)[2:])    
        
        status_bin_buf = _status_bin_list[0][5:8]
        status_bin2int = int(status_bin_buf, 2)
        
        return status_bin2int
    
    set_modbus_output_multi("ctrlword",[int('0000010000000000',2),int('0000001100000000',2),0,0]) 
    wait(0.1)
    set_modbus_output_multi("ctrlword",[int('1000010000000000',2),int('0000001100000000',2),0,0]) #grasp
    wait(2)        
    status = get_modbus_input_multi("statusword")     #StatusWord
    #tp_log("pos SW002: " + str(status))
    now_gripper_status = get_gripper_status(status)
    tp_log("gripper_status: " + str(now_gripper_status))    
    while True:
        if now_gripper_status == 3:
            break
        else: 
            tp_popup("Error: Wrong gripper status!, (CW, 512)", DR_PM_MESSAGE)


2. Mandatory WCI Action: Set up essential functions related to WCI.

  • Gripper → Release

Release()

PY
def Release():
    # get gripper status, split and return the 2,1,0 bit of first byte of the status word     .
    # 0(0b xxxx.x000): Error
    # 1(0b xxxx.x001): Out of specification
    # 2(0b xxxx.x010): Maintenace required
    # 3(0b xxxx.x011): Ready for operation (= there is no error)
    def get_gripper_status(_status_bin):
        _status_bin_list = []
        for n in _status_bin:
            tp_log("pos SW002: " + str(bin(n)[2:]))
            _status_bin_list.append(bin(n)[2:])    
        
        status_bin_buf = _status_bin_list[0][5:8]
        status_bin2int = int(status_bin_buf, 2)        
        
        return status_bin2int
	set_modbus_output_multi("ctrlword",[int('0000010000000001',2),int('0000001100000000',2),0,0]) 
    wait(0.1)
    set_modbus_output_multi("ctrlword",[int('1000010000000001',2),int('0000001100000000',2),0,0])   #release
    wait(2)
    status = get_modbus_input_multi("statusword")     #StatusWord    
    now_gripper_status = get_gripper_status(status)
    tp_log("gripper_status: " + str(now_gripper_status))    
    while True:
        if now_gripper_status == 3:
            break
        else: 
            tp_popup("Error: Wrong gripper status!, (CW, 512)", DR_PM_MESSAGE)


3. User Defined WCI Action: Optional functions related to WCI can be added.

  • Init_comm_gripper

init_comm_gripper()

PY
def init_comm_gripper():
    # Initialize Acknowledging,Referencing,Position words
    set_modbus_output_multi("ctrlword",[int('0000000100000000',2),0,0,0]) #00 00 00 01 00 00 00 00
    wait(0.05)
    set_modbus_output_multi("ctrlword",[int('1000000100000000',2),0,0,0]) #10 00 00 01 00 00 00 00
    wait(0.05)
    set_modbus_output_multi("ctrlword",[int('0000001000000000',2),0,0,0]) #00 00 00 10 00 00 00 00
    wait(0.05)
    set_modbus_output_multi("ctrlword",[int('1000001000000000',2),0,0,0]) #10 00 00 10 00 00 00 00
    wait(0.05)
    set_modbus_output_multi("ctrlword",[int('0000010000000000',2),int('0000000000000000',2),0,0]) 
    wait(0.1)
    set_modbus_output_multi("ctrlword",[int('1000010000000000',2),int('0000000000000000',2),0,0]) 
    wait(2)        
    set_modbus_output_multi("ctrlword",[int('0000010000000001',2),int('0000000000000000',2),0,0]) 
    wait(0.1)
    set_modbus_output_multi("ctrlword",[int('1000010000000001',2),int('0000000000000000',2),0,0]) 
    wait(2)    
    
    status = get_modbus_input_multi("statusword")     #StatusWord
    tp_log("log SW: " + str(status)) 


UI Component

Add Line Edit in UI Component and enter the Property values as follows.

  • Component Name : Wait Time
  • Component Label Name : Wait Time
  • Default Value : 0.5
  • Value Type : Double
  • Double Range
    • Min Value : 0
    • Max Value : 10000
    • Value Type: SI Unit
    • Unit Type: Second
  • Variable Name
    • Component sub-variable name : waitTime

The following UI Components can be used as user input.

  • Label
  • Text Edit
  • Toggle Switch
  • Radio Button
  • Button – Define DRL


The following DRL Components can be used

  • Global Variable

  • Global Function

Write and modify WCI (Workcell Item Setting)

  • Save WCI → Confirm
  • WCI list can be checked as follows.



JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.