AN2283 Freescale Semiconductor / Motorola, AN2283 Datasheet - Page 13

no-image

AN2283

Manufacturer Part Number
AN2283
Description
Scalable Controller Area Network (MSCAN)
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Abort Process Overview
MOTOROLA
else if(ctflg. TXE2 = = 1){
} // End of Transmit Interrupt
ctcr.TXEIE2 = 1; //Enable the transmit interrupt for this buffer
//Check to see if Transmit Buffer 2 is Empty
//Go to the address pointed to by the message’s *Data_Pointer from the Transmit TAble and load in the data
//The number of data bytes in the message is loaded which is determined by length
for(k=0; k<length; ++k) {tx_buffer0.data[k] = *Tx_Table[index].Data + k;}
//Load the priority into the transmit buffer. The priority is the index value to the message in the Transmit Table
tx_buffer2.Priority = index;
CTFLG = 0x04;
//The following is another method to clear the TXE flag to indicate this buffer is full in assembly language
//Notice that the LDA and STA instructions are used. DO NOT USE THE BSET Instructions.
ctcr.TXEIE2 = 1;
ctcr.TXEIE2 = 0; //Disable the transmit interrupt that caused the interrupt
tx_buffer2.IDO = Tx_Table[index].ID;
tx_buffer2.DLC = Tx_Table[index].DLC,
length = tx_buffer2.DLC;
/*
#asm
#endasm
*/
LDAA #0x04;
STAA $0x106;
} //End of if(ctflg.TXE2 == 1)
NOTE:
//Clear the TXE flag in the CTFLG register to indicate this buffer is full
// End of if (ctflg.TXE2 ==
//Enable the transmit interrupt for this buffer
Motorola Scalable Controller Area Network (MSCAN) Interrupts
As seen in the code, using the transmit header table allows an efficient method
to load the identifier/DLC data from the table to the transmit buffers one for one.
The *Data_Pointer in the table references message signals that are stored in
data structures that map to the MSCAN transmit buffers Data Field. This type
of data storage improves driver efficiency and execution time.
The transmit interrupt routine is short, just a couple steps. This is very important
to achieve code/time efficiency.
The MSCAN has the capability to abort a message that is in the transmission
pending state. There are two registers that are used to abort messages in
transmission:
//Store the Data Length of the message into a variable to use in the next step
Freescale Semiconductor, Inc.
For More Information On This Product,
MSCAN Transmitter Flag Register (CTFLG)
MSCAN Transmitter Control Register (CTCR)
//Load the message’s ID from the Transmit Table into the Transmit Buffer
Go to: www.freescale.com
//Load the message’s DLC from the Transmit Table into the Transmit Buffer
1)
Abort Process Overview
AN2283/D
13

Related parts for AN2283