Technical FAQs

Ask a Question

Setting up a Read_VAR function block in a M340 to read SDOs from CAN devices.

Goals and Symptoms

M340, CANopen, Read_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 (rack.module.channel.EQUIPMENT) 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 READ_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)
RECP (location array in the M340 where the read information is stored)
GEST (Array of 4 INTs used for the Read Manager Exchange)

In this Example we are reading the LFR Frequency Reference at Subindex 0003 (hex) and Index 2037 (hex)
from the Altivar drive and storing it in %MW100 of the M340.

Finally Build/Download your project and Run the PLC.


Legacy KB System (APS) Data: RESL187577 V1.0, Originally authored by MiMe on 08/16/2007, Last Edited by MiMe on 08/16/2007
Related ranges: Modicon M340
Was this helpful?
What can we do to improve the information ?