Main Loop - Philips PDIUSBD12 Firmware Programming Manual

Hide thumbs Also See for PDIUSBD12:
Table of Contents

Advertisement

Interconnectivity
Firmware Programming Guide for PDIUSBD12

6. Main Loop

Once powered up, MCU will need to initialize all its ports, memory, timer, and interrupt service routine handler.
After that, MCU will reconnect USB, which involves setting the Soft_Connect register to ON. This procedure is
important because it ensures that D12 will not operate before MCU is ready to serve D12.
In the main loop routine, MCU will poll for any activity on the keyboard. If any one of the specific keys is
pressed, the handle key commands will execute the routine and then return to the main loop. This routine is
added for debugging purposes only. A 1mSec timer is programmed to activate the routine to check for any
button pressed on the evaluation board.
When the polling reaches the check Setup packet, it verifies the setup flag set previously by the interrupt service
routine. If the setup flag is set, it will dispatch a device request to the protocol layer for processing. The
flowchart above shows the main program executing on the foreground.
initialize Ports, Memory and Timer
Setup ISR and Program Interrupt Controller
No
Reset Interrupt Controller
Main Loop
Reconnect USB
Loop
Keyboard Pressed?
Yes
No
Timer Signal?
Yes
No
Bus Reset?
Yes
No
Suspend Change?
Yes
No
Setup Packet?
Yes
No
Program Exit?
Yes
Restore ISR vectors
End
Philips Semiconductors - Asia Product Innovation Centre
Visit
http://www.flexiusb.com
Read Key Code
Handle Key Commands
Update Test LEDs and Check Test Keys
On Evaluation Board
Display Bus Reset Event Detected
Read Suspend State
Display Suspend Changed Event
Dispatch Device Request to
Protocol Layer for Processing
Page 14 of 22

Advertisement

Table of Contents
loading

Table of Contents