CAN Send

From OpenMBD
< HANcoder‎ | STM32‎ | Blocks
Jump to: navigation, search
Supported Targets: Olimexino, E407, P405

General information about CAN Send

With this CAN send block you can send a CAN message with a specified identifier on a specified CAN bus. Each time the block is evaluated, a message is send containing the input values.





Block inputs (inports)

input 1: CAN identifier, the CAN identifier number used to identify the message. This identifier can be changed run-time. The data type is uint32
Note: Set the 32nd bit to 1 in the CAN ID to configure it as a 29-bit Extended CAN identifier. For example 0x80000200 for CAN ID 0x200 as 29-bit identifier
Tip: Use the hex2dec function to be able to use hexadecimal numbers, e.g.: hex2dec('24F') to send a CAN message with identifier 0x24F.
input 2..9: The data you wish to send. (Number of inputs depends on the block parameter: Input ports)

Block parameters

Parameter Description
CAN channel The CAN channel to be used, the E407 and P405 have two CAN channels, the Olimexino has only one.
Identifier type The type of message identifier to be used: either standard(11-bit) or extended(29-bit).
Input ports The number of input ports, the maximum number of bytes in a message is 8 so the maximum number of input ports is also 8. If for example uint16's are used you can only send 4 per message so you can select a maximum of 4 input ports per block.
Input data type The input data type to be used. This assumes all signals in a message have the same datatype. If this is not the case then just use uint8 and do the

processing of the bits and bytes in Simulink.

Byte order Byte order or endianness can be selected. If the checkbox is selected then the Most Significant Byte order, big-endian or Motorola order is used, if not then the Lease Significant Byte, little-endian or Intel order is used.
Sample time Sample time of the block. The Sample time (in seconds) defines the rate at which the block is visited by the real-time scheduler of the target. The value of the Sample time has to be an integer multiple of the base sample time of the model.


CAN Communication Example | OBD reader example

See Also

CAN receive | CAN config | XCP on CAN config