CAN cmd 6, Read message

CAN cmd 6, Read message

Function = 6:

Syntax:

CAN(channel, 6, message, variable)

Description:

Read in the message from the specified buffer to a VR array.

The first VR holds the identifier. The subsequent values hold the data bytes from the CAN packet.

Parameters:

message:

the message buffer to read in

variable:

the start position in the VR memory for the message to be written


The first VR holds the CAN message Identifier (ie the COB ID) so is the same as the identifier that was wet up with CAN function 5.  If you initialise the CAN buffer with a data size,then that is the number of subsequent VRs that will be populated.

For example this has size 8 so it will populate 8 VRS even if the transmitted CAN message has fewer than 8 bytes.

CAN(-1,5,1,110,8,0) 'receive buffer

IF CAN(-1,3,1)=TRUE THEN
    CAN(-1,6,1,200) ' identifier (110) + 8 bytes
ENDIF

This one is set to 2 bytes so fills only 2 VRs but if the other end sends more than 2 bytes, the rest will be lost.

CAN(-1,5,2,120,2,0) 'receive buffer

IF CAN(-1,3,2)=TRUE THEN
    CAN(-1,6,2,210) ' identifier (120) + 2 bytes
ENDIF

    • Related Articles

    • CAN cmd 8, SDO read, data type

      This sub-routine looks at the first value returned by CAN function 8, which is the data type. IF can_ok=FALSE THEN PRINT #op_chan,"CAN error SDO ";HEX(obj_index) ELSEIF VR(vrbase)=$80 THEN PRINT #op_chan,"SDO ";HEX(obj_index);" read aborted by slave" ...
    • CANbus port check

      MC403, MC405, Euro404 and Euro408 Motion Coordinators that appear to have a failed CANbus port. Check that the CANIO_ADDRESS is set to 32 when using Trio CANIO mode or to 40 .. 42 when using CanOpen. The CANIO_ADDRESS is stored in Flash in the above ...
    • AN-315 EtherCAT setup for Panasonic A5B Drive

      When delivered, the Panasonic A5B has 2 features set; the Positive Over Travel Input (POT) and the Negative Over Travel input (NOT). If these are connected to limit switches then the system will work in the usual way until the limit switch is ...
    • M206X with P326 AOUT

      There is no AOUT command in the MC206X so it is necessary to run a program that makes the CANbus telegram from the values you want to send. See the attached program. The program sets up an unused CAN buffer to CAN ID required CAN(-1, 5, 16, $60, 8, ...
    • Ethercat axis trajectory error

      Check the Target Position that is sent over EtherCAT. DAC_OUT is the value the controller puts on the telegram. Every cycle, DPOS --> DPOS * UNITS + offset --> DAC_OUT Compare DAC_OUT to the Target Position object value in the drive. Over SDO on ...