
3-14 FLEX Alphanumeric Chip MC68175 Interface
Software Development
Porting FLEX One-Way Stack to the MC68328 MPU
Example 3-3 Function storeData
/************************************************************************
* FUNCTION NAME: storeData() *
* Date created: 07/26/96 *
* *
* DESCRIPTIONS: *
* This function stores packets of information in the circular *
* queue for later processing. These Packets are received *
* from the FLEXchip IC via the interrupt service routine *
* *
* INPUT: 32-bit of data in 2 16-bit variables *
* data1: First 16-bit data *
* data2:Second 16-bit data *
* OUTPUT: None *
* GLOBAL VARIABLES: *
* gPacketQ[]:Array used as a circular queue for *
* data storage *
* gPackWrite:index in the circular queue to keep *
* keep track of the next available storage *
* location in the queue. *
***********************************************************************/
void storeData(UVAR16 data1, UVAR16 data2)
{
volatile UCHAR *ptr;
/* Store the first word (16-bit data) in the queue */
ptr = (UCHAR*) &data1;
gPacketQ[gPackWrite++] = (UCHAR) *ptr++;
gPacketQ[gPackWrite++] = (UCHAR) *ptr;
/* Store the second word (16-bit data) in the queue */
ptr = (UCHAR*) &data2;
gPacketQ[gPackWrite++] = (UCHAR) *ptr++;
gPacketQ[gPackWrite++] = (UCHAR) *ptr;
/* If the index gPackWrite points to the end of the queue,
"circulate" it to the beginning of the queue */
gPackWrite &= (PAKQ_SIZE - 1);/* Assuming PAKQ_SIZE is 128 */
}
Frees
cale Semiconductor,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...
Comentários a estes Manuais