AN2283 Freescale Semiconductor / Motorola, AN2283 Datasheet - Page 12

no-image

AN2283

Manufacturer Part Number
AN2283
Description
Scalable Controller Area Network (MSCAN)
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2283/D
12
//Check to see if Transmit Buffer 1 is Empty
else if(ctflg.TXE1 == 1){
//Check to see if Transmit Buffer 2 is Empty
else if(ctflg.TXE2 == 1){
//Load the priority into the transmit buffer.
//Load the priority into the transmit buffer.
ctcrr.TXEIE0 = 1; //Enable the transmit interrupt for this buffer
ctcr.TXEIE1 = 0; //Disable the transmit interrupt that caused the interrupt
tx_buffer1.ID0 = Tx_Table[index].ID; //Load the message’s ID from the Transmit Table into the Transmit Buffer
length = tx_buffer1.DLC; //Store the Data Length of the message into a variable to used in the next step
// 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;}
tx_buffer1.Priority = index;
CTFLG = 0x02;
//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.
ctcrr.TXEIE1 = 1; //Enable the transmit interrupt for this buffer
length = tx_buffer2.DLC; //Store the Data Length of the message into a variable to used in the next step
// 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;}
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.
tx_buffer1.DLC = Tx_Table[index].DLC;
ctcr.TXEIE2 = 0;
tx_buffer2.ID0 = Tx_Table[index].ID; //Load the message’s ID from the Transmit Table into the Transmit Buffer
tx_buffer2.DLC = Tx_Table[index].DLC; // Load the message’s DLC from the Transit Table into the Transmit Buffer
/*
#asm
#endasm
*/
/*
#asm
#endasm
*/
/*
#asm
*/
LDAA #0x01;
STAA $0x106;
LDAA #0x02;
STAA $0x106;
LDAA #0x04;
STAA $0x106;
#endasm
//Clear the TXE flag in the CTFLG register to indicate this buffer is full
//Clear the TXE flag in the CTFLG register to indicate this buffer is full
} // End of if (ctflg.TXE0 == 1)
//Disable the transmit interrupt that caused the interrupt
Motorola Scalable Controller Area Network (MSCAN) Interrupts
} // End of if (ctflg.TXE1 ==
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
// Load the message’s DLC from the Transit Table into the Transmit Buffer
The priority is the index value to the message in the Transmit Table.
The priority is the index value to the message in the Transmit Table.
1)
DO NOT USE THE BSET Instructions.
DO NOT USE THE BSET Instructions.
MOTOROLA

Related parts for AN2283