Blockset described on this wiki is deprecated since 2012.

For Model Based Design (MBD), use the free MPLAB Device Blocks for Simulink, tool from Microchip.
Updated Rapid Control Prototyping (RCP) custom projects are published at: https://lubin.kerhuel.eu.

DsPIC Block/CAN Transmit

From http://www.kerhuel.eu/wiki - Simulink device driver Blockset for dsPIC / PIC24 / PIC32 Microcontrollers --[[User:LubinKerhuel|LubinKerhuel]] 12:40, 3 September 2009 (UTC)
Jump to navigation Jump to search
Block CAN Transmit

Write data to a CAN bus

The CAN Transmit block allow to send CAN message containing between 1 and 8 bytes on a CAN Bus. The configuration of the BUS parameters are set using the CAN Configuration block. The two internal buffer of the CAN peripheral are used.

Dialog Box Parameters

CAN Transmit Dialog

Num CAN

Ref to the CAN peripheral being configured (some PIC have two CAN bus)

Wait for the end of Previous Transmission

When unchecked, the CAN Transmit block try to place the CAN Message into one of the two buffer available on the CAN peripheral. If both buffer are not empty, the message is not sent.

When checked, the CAN Transmit block try to place the CAN Message into one of the two buffer available on the CAN peripheral. If both buffer are not empty, the block will wait until one of the two buffer becomes empty (ie, once the message it contains is sent on the CAN bus). The empty buffer is then filled with the CAN Message and the execution of others blocks continue..

Tx Priority

Each message is assigned to a priority. When the two buffer of the CAN Peripheral contains two message, the message with the highest priority is being sent first. Four priority level exist :

  • Highest
  • High
  • Low
  • Lowest

Identifier Length

The message identifier is being code eigher with

  • Standard 11 bits identifier
  • Extended 29 bits identifier

Identifier is a block input

If checked, the Message Identifier is defined throught a block input. If unchecked, the Message Identifer is defined inside the dialog box (An Identifier parameters appears)

Remote Request

The message set the Remote Request bit. (see CAN doccumentation)

Data Length Code Bits

Length of the message you want to send. The message is contain up to 8 bytes. If message length is greater than 1, a vector of the message length is connected to the block input. The simulink bus creator block can be used to build a vector with the desired length.

Error flags

Each of these checkbox output the requested binary error flag.

  • Tx Buffer Full
  • Tx CAN Bus Off
  • Tx CAN Bus Passive
  • Tx CAN Warning

Output CAN BUS Transmit Error Counter

The Transmit Error Counter output the internal CAN Transmit Error Counter. See CAN doccumentation for precision about Error Counter.

Sample Time

Sample time of the block. -1 for inherited

Block Ordering Input / Output

If you want to force the execution order of blocks that are not connected, this option allow to add either an input, an output or both to the block. These virtual connection allow to force the ordering of the blocks.

Info

Information


<comments \>