Discover our Clipsal Smart Home packages as seen on The Block 2018

in location


I'm looking for

  • Wholesalers
    • Uncheck All Check All
    • Expand
    • Expand
    • Expand
    • Uncheck All Check All
  • Switchboard Manufacturers
    • Uncheck All Check All

The best way to see what Clipsal electric products can do for your home is seeing them in action at a Clipsal Display Centre.

Product stock may vary according to location. If you're after a specific product range, please check with your chosen location before visiting.

10 Results
    Load More Load Complete
    Change Location

    Setting up a Write_VAR function block in a M340 to write to SDOs in a CAN device.

    Goals and Symptoms

    M340, CANopen, Write_Var

    Causes and Fixes

    First your project Configuration and double click on the CAN port to configure it

    Configure the CAN port as needed for your application and notice the Channel # of the CAN port (Channel 2)
    Note: The Inputs & Outputs configured here are for PDOs not SDOs.

    Next open the CANopen Network from the Configuration. Double click on the Node to add a CAN device.

    From the available list chose the CAN device you will be using and press OK.
    For this example we are using a Altivar 71 drive.

    A picture of the device will appear on the network. Double click in the Node box to adjust the Node ID of the device.
    Then double click on the device for its configuration.

    Configure the CAN Device as needed.
    Note: PDOs are memory mapped directly to memory locations within the M340 SDOs are not.

    Next open the Project Settings and configure them so that you can directly address arrays in your program.
    This step is optional however if you do not do this you will need to declare variables as array's in you program.

    Next open you program section and add a ADDM block (for addressing the CAN device) and a
    Read_Var block.

    The ADDM block for CAN has an input syntax of r.m.c.e ( and is
    entered as a string so a ' is needed before and after the string. The OUT pin is connected directly to the
    ADR pin of the Read_Var.

    The remaining parameters of the WRITE_VAR are configured as follow:

    OBJ (object type we are reading, string input)
    NUM (location in the CAN device we are reading from. Subindex_index for CAN)
    NB (length of read in words)
    EMIS (location array in the M340 where the information to be written is stored)
    GEST (Array of 4 INTs used for the Write Manager Exchange)

    In this Example we are writing a value from %MW110 of the M340 to the ACC Acceleration
    at Subindex 0002 (hex) and Index 2032 (hex) in the Altivar drive.

    Before you can download this to you PLC there is one additional step required.
    For CANopen writes to SDOs from a Write_Var block a timeout value and transmission length
    need to be configured in the Write Manager Exchange array.

    Open the Variable Declaration editor declare variables for the 4 INTs in the Write Manager Exchange array.
    The third and fourth INTs are for the timeout value (in tenths of a second) and the transmission length (in Bytes).

    In our example we are writing 1 word so the length is 2 bytes.

    Finally Build/Download your project and Run the PLC.

    Didn’t find what you were looking for?

    Try Searching Again View Our Categories

    Need further assistance?

    Our Customer Care department provides total customer service solutions for our residential, industrial and commercial applications.

    Get Assistance