Jump to main content

##

# 2.64.4 MCANx_MessageTransmit Function

## C

    bool MCANx_MessageTransmit(uint8_t bufferNumber, MCAN_TX_BUFFER *txBuffer) // x - Instance of the MCAN peripheral

## Summary

Transmits a message into CAN bus from the specific Tx buffer.

## Description

This routine transmits a message into CAN bus from the specific Tx buffer.

## Precondition

MCANx_Initialize has been called.

## Parameters

Param | Description
--- | ---
bufferNumber | Tx buffer number.
txBuffer | Pointer to Tx buffer

## Returns

Boolean "true" when a message has been transmitted.

## Example

    uint8_t loop_count = 0;
    uint8_t txFiFo[MCAN0_TX_FIFO_BUFFER_SIZE];
    MCAN_TX_BUFFER *txBuffer = (MCAN_TX_BUFFER *)txFiFo;
    memset(txFiFo, 0x00, MCAN0_TX_FIFO_BUFFER_ELEMENT_SIZE);
    txBuffer->id = 0x100000A5;
    txBuffer->dlc = 8;
    txBuffer->xtd = 1;
    txBuffer->fdf = 1;
    txBuffer->brs = 1;
    for (loop_count = 0; loop_count < 8; loop_count++){
        txBuffer->data[loop_count] = loop_count;
    }
    // Transmit message from Tx buffer 0
    MCAN0_MessageTransmit(0, txBuffer);

## Remarks

None.