DV164126 Microchip Technology, DV164126 Datasheet - Page 23

KIT DEVELOPMENT USB W/PICKIT 2

DV164126

Manufacturer Part Number
DV164126
Description
KIT DEVELOPMENT USB W/PICKIT 2
Manufacturer
Microchip Technology
Datasheets

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
Part Number:
DV164126
Manufacturer:
Microchip Technology
Quantity:
135
© 2009 Microchip Technology Inc.
2.5.2
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 push button 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-4.
FIGURE 2-4:
In the flowchart of Figure 2-4, 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 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
Overview of the HID Mouse Firmware
Clear directional data
NO
emulate_mode
NO
FLOWCHART FOR THE EMULATE_MOUSE()
= TRUE
PIC18F14K50
own the SIE
YES
FALSE = 0
TRUE = 1
YES
movement_length
NO
Keep directional
data as before
> 14?
Transmit directional
data along USB
YES
Change directional
data to next vector
DS41356B-page 19
return

Related parts for DV164126