Microchip Technology DV164139 Fiche De Données

Page de 54
Low Pin Count USB Development Kit User’s Guide
DS41356B-page 20
© 2009 Microchip Technology Inc.
2.5.3
Procedure
This lab expands on the descriptor code developed in Lab 1.
1.
Create a new project “Project Lab 2”, and build the framework as per procedure 
steps 1-15 in the previous lab, only this time use the source files found in
C:\LPCUSBDK_Labs\Lab2_files
2.
Ensure that the Project Build Options are configured as was done in Lab 1 steps 
11 through 15.
3.
In the Project window open the mouse.c source file.
4.
Scroll down to find the variable definitions and uncomment the variables and 
arrays that will be used by the user defined function under the section of the 
source file:
/**VARIABLES*****************************/
a) BYTE old_sw2,old_sw3;
b) BOOL emulate_mode;
c)
BYTE movement_length;
d) BYTE vector = 0;
e) char buffer[3];
f)
USB_HANDLE lastTransmission;
g) ROM signed char dir_table[]={-4,-4,-4, 0, 4, 4, 4, 0};
5.
Scroll down to the private prototype section and uncomment the user function 
prototype
 void Emulate_Mouse(void);
6.
Scroll down to the UserInit(). It is here that all components pertinent to the 
application at hand are initialized. Note the variables and function calls that are 
initialized. Locate the // emulate_mode = TRUE; and uncomment the flag 
initialization.
7.
Scroll down to the ProcessIO() function. Note the push button check that 
toggles the emulate_mode flag. Uncomment the code:
//emulate_mode = !emulate_mode;
8.
Finally, scroll down to the Emulate_Mouse function and insert the code in 
Example 2-7 between the curly brackets in the section marked:
//ADD EMULATE MOUSE CODE HERE