
Software Development
FLEX System Software
FLEX Alphanumeric Chip MC68175 Interface 3-9
In the second stage, the host software periodically calls the FLEX One-Way Stack
function to read data out of the circular queue. FLEX One-Way Stack then analyzes and
assembles the original FLEX page and returns it to the host software.
Two pointers (index variables) are used to manage the circular queue, gPackWrite and
gPackRead. The gPackWrite variable points to the next available byte in the queue for data
storage. The pointer gPackWrite advances for every byte of data that the FLEX
Alphanumeric Chip SPI interrupt handler receives. The gPackRead variable points to the
next byte of data in the queue to be read and processed. The pointer gPackRead advances
every time FLEX One-Way Stack reads a byte out of the queue for processing. Product
developers can manage the size of the circular queue. However, the size of the queue (in
bytes) must be a multiple of four to avoid splitting of packets (1 packet = 32 bits = 4
bytes). The circular queue is defined as shown in Example 3-1
Figure 3-5 Circular Queue for Data Storage
The host software can either poll the two pointers or use a timer interrupt to check them
for new data in the circular queue, shown in Figure 3-5. If the FLEX One-Way Stack
finishes assembling the original page (meaning that no other fragment of the page is
expected), FLEX One-Way Stack notifies the host software by calling the function
FStkNotifyNewMsg(). Product engineers can implement FStkNotifyNewMsg () in
accordance with the individual features of each product, such as alerting the user or
retrieving and displaying the message on the LCD.
Example 3-1 Circular Queue Definition
unsigned char gPacketQ[PAKQ_SIZE];
gPackRead
gPackWritegPackRead
Queue with No Data (Empty)
Queue after Interrupt Handler
Receives Data from FLEX
Queue after FLEX One-Way
Stack Processes Data
1230
gPackWrite
Alphanumeric Chip
AA1426
1230
gPackWritegPackRead
Frees
cale Semiconductor,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...
Comentários a estes Manuais