DV164126 Microchip Technology, DV164126 Datasheet - Page 25
![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.
EXAMPLE 2-7:
Note that the HID mouse transmits in 3-byte packets. The format of this packet is as
follows:
• This byte is typically used to identify mouse buttons. Since this application does
• The second and third bytes represent horizontal (X) and Vertical (Y)
Compile the project. There should be no errors.
Testing the Application
8. Ensure that the Low Pin Count USB Development Board is configured as in Lab 1.
9. Connect the PICkit 2 Programmer and open the PICkit 2 programming software.
10. Navigate to the .hex file for this lab and download to the PIC18F14K50.
11. Disconnect the PICkit 2 and connect the Low Pin Count USB Demo Board to the
12. The device should enumerate and the LEDs on the board flash in accordance
13. Pressing the pushbutton should start and subsequently stop the mouse pointer
The user is encouraged to experiment with this application by altering the length of time
that the mouse pointer moves until a directional change or altering the values in the
ROM signed char dir_table[]={-4,-4,-4, 0, 4, 4, 4, 0};
not require any mouse clicks, this byte is always zero.
displacements.
if (emulate_mode == TRUE)
else
Host PC port.
with the BlinkUSBStatus() discussed in the self-directed course.
moving in a circle on the Host PC screen.
{
}
{
}
if(HIDTxHandleBusy(lastTransmission) == 0)
{
}
//go 14 times in the same direction before changing
if (movement_length > 14)
{
}//end if (movement_length > 14)
//Send the 3 byte packet over USB to the host.
lastTransmission = HIDTxPacket(HID_EP, (BYTE*)hid_report_in,
0x03);
buffer[0] = 0;
buffer[1] = dir_table[vector & 0x07];
//X-Vector
buffer[2] = dir_table [(vector+2) & 0x07];
//Y-Vector
// go to the next direction in the table vector++;
//reset the counter for when to change again movement_length
//don't move the mouse
buffer[0] = buffer[1] = buffer[2] = 0;
//copy over the data to the HID buffer
hid_report_in[0] = buffer[0];
hid_report_in[1] = buffer[1];
hid_report_in[2] = buffer[2];
//increment the counter to change the data sent
movement_length++;
= 0;
USER DEFINED FUNCTIONAL CODE FOR
EMULATE_MOUSE()
DS41356A-page 21