unable to set DOs

  • Hi,


    I am using SNPX option (HMI communication) with fanuc. The settings on the system variables are as follows:


    $SNPX_PARAM. $MODBUS_ADR = 1

    $SNPX_PARAM.$NUM_MODBUS = 2 (someone on the forum pointed out ,that this value should be above '0')


    Using SNPX_ASG parameter, I tried to map 15 digital outputs, DO[5] - DO[20] and 20 data registers, R[1] - R[20].


    For data registers,


    $SNPX_ASG.$ADDRESS = 51

    $SNPX_ASG.$SIZE = 40

    $SNPX_ASG.$VAR_NAME = R[1]

    $SNPX_ASG.$MULTIPLY = 1000



    For digital outputs,


    $SNPX_ASG.$ADDRESS = 91

    $SNPX_ASG.$SIZE = 15

    $SNPX_ASG.$VAR_NAME = DO[5]

    $SNPX_ASG.$MULTIPLY = 1


    I am using pymodbus to read/write the above. I can write to data registers, using the following:


    client.write_registers(start_address, payload, skip_encode=True, unit=1)


    I use the following to write a DO.


    coil_response = client.write_coil(address=93, value=True, unit=1)


    But, on TP screen, when I MENU -> I/O -> Digital


    DOs are always appearing OFF on TP.


    When I read the status for the DO that was just written,


    coil_response = client.read_coils(address=93, count=1, unit=DEVICE_ID)


    it shows me that it has been 'set'


    Why can't I see the changed status of DOs on TP, or are they really changed.



    thanks,


    Zahid

  • Shouldn't you be writing to DIs, not DOs? The robot should be the only thing that can turn on a DO not an external source.

    I think HawkME is correct here. The status of your robot DO's arent changing on the teach pendant because they probably aren't changing at all. I'm not 100% sure that something like SNPX or PCDK cant change robot outputs externally but I wouldn't be surprised if they couldn't.


    If you wanted, you could map to some robot DI's and then use the IO-> INTERCONNECT feature on the robot to map those DI's directly to some Digital Outputs. A little bit of extra work on the robot side but this should pass your HMI signals through.

  • thanks all for inputs. I read at a link


    Modbus with pymodbus - HackMD
    # Modbus with pymodbus Hence I can not understand well the usage from the [official document](http
    hackmd.io


    For 'single bit' you have DI, and DOs.

    And, when using modbus, DIs are 'read_only' whereas DOs are the ones that can be 'read and write'. Similarly, input registers are 'read_only' and holding registers can be 'read and write'.

    It was the reason to write to DOs using pymodbus library function.


    Further, modbus addresses in FANUC are one based, but in the library that we use pymodbus they are zero based.


    I noticed though, while

    $SNPX_ASG.$ADDRESS = 91

    $SNPX_ASG.$VAR_NAME = DO[5] (start point is DO[5], at address 90)



    I found out that in fact when I issued the following


    DEVICE_ID = 1

    ADDRESS_START = 90 # actual corresponds to DO[91] on Roboguide

    coil_response = client.write_coil(address=ADDRESS_START, value=True, unit=DEVICE_ID)


    I was able to TURN ON DO[91]. It should have been DO[5]?


    For current purpose, that is ok because I can use DO[91].


    thanks,


    Zahid

Advertising from our partners