DV164126 Microchip Technology, DV164126 Datasheet - Page 23
![KIT DEVELOPMENT USB W/PICKIT 2](/photos/9/4/90430/dv164126_sml.jpg)
DV164126
Manufacturer Part Number
DV164126
Description
KIT DEVELOPMENT USB W/PICKIT 2
Manufacturer
Microchip Technology
Specifications of DV164126
Main Purpose
Interface, USB 2.0 Slave
Embedded
Yes, MCU, 8-Bit
Utilized Ic / Part
PIC18F13K50, PIC18F14K50
Primary Attributes
Full Speed (12Mbps), MCU Based
Secondary Attributes
4 Labs: Enumeration, HID Mouse, HID Keyboard, CDC Serial Emulator
Silicon Manufacturer
Microchip
Silicon Core Number
PIC18F14K50, PIC18F13K50
Core Architecture
PIC
Core Sub-architecture
PIC18
Silicon Family Name
Piccolo
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Lead free / RoHS Compliant
Available stocks
Company
Part Number
Manufacturer
Quantity
Price
Company:
Part Number:
DV164126
Manufacturer:
Microchip Technology
Quantity:
135
© 2008 Microchip Technology Inc.
Overview of the HID Mouse Firmware
As with most of the Framework applications, the user defined source code is called
from the ProcessIO() function in the <application>.c file. The user defined firm-
ware will manipulate the Host PC mouse pointer to move in a single direction for 14
times through the main loop. After 14 times, the mouse pointer changes direction ulti-
mately moving in a complete circle. A bit flag is initialized named emulate_mode that
will toggle HIGH/LOW whenever the pushbutton on the Low Pin Count USB Develop-
ment Board is pressed. The status of this flag will start or stop pointer movement on the
screen by not calling the user defined function, emulate_mouse(), which handles the
mouse movement routines.
The flowchart for the user defined function is shown in Figure 2-3.
FIGURE 2-3:
In the flowchart of Figure 2-3, it can be seen that if the emulate_mode flag is ‘0’, the
directional data transmitted along the USB is cleared. Note that data is transmitted from
the PIC18F14K50 regardless of whether or not the flag is set. Data is transmitted only
when the SIE is capable of transmitting it. This check is implemented in code by using
the if(HIDTxHandleBusy(lastTransmission) == 0) conditional statement.
The lastTransmission is loaded at the time of transmission and processed by the
HIDTxHandleBusy macro in the conditional ‘if’ statement.
If the emulate_mode flag is set, the function enters into the mouse pointer movement
algorithm. This is accomplished by keeping track of a counter variable,
movement_length. When this variable exceeds 14, a buffer array is loaded with new
directional data as supplied by the dir_table array defined at the top of the mouse.c
file. Each element of the array is accessed by incrementing the vector variable counter.
The buffer array is then loaded into a hid_report_in[] buffer array that is used by
the HIDTxPacket macro to transmit the data along the USB to the Host PC.
Emulate_Mouse ()
return
Clear directional data
NO
emulate_mode
NO
FLOWCHART FOR THE EMULATE_MOUSE()
= TRUE
PIC18F14K50
own the SIE
YES
YES
movement_length
NO
Keep directional
data as before
> 14?
Transmit directional
data along USB
YES
Change directional
data to next vector
DS41356A-page 19
return