The following two lines for product ID and vendor ID numbers. ![]() #define USB_CONFIG_HID_RX_SIZE 16 // Receive packet size (bytes) #define USB_CONFIG_HID_TX_SIZE 16 // Transmit packet size (bytes) The sizes can be changed with the following two lines: The program can send and receive a maximum of 16 bytes. NOMCLR : Master Clear pin used for I/O (MCLR pin function disabled) USBDIV : USB clock source comes from PLL divide by 2 PLL2 : Divide by 2 (8MHz oscillator input) ![]() HSPLL : high speed oscillator is used with PLL enabled #fuses HSPLL PLL2 CPUDIV1 USBDIV VREGEN NOMCLR PIC18F4550 microcontroller always needs an external oscillator to run its USB module. ![]() In this project the an external oscillator (8MHz) is used to run the microcontroller as well as the USB module. The C code below was tested with CCS C compiler version 5.051. The LCD is used to display the data received by the microcontroller and after 1 second the microcontroller sends the same data back to the PC which will appear in the HID terminal software. If we want to send data to the microcontroller just tape the text and click on Send. After plugging the USB cable which comes from the microcontroller, the device will appear in the HID devices list which named USB HID Example. Baud Rate Maximum cable length 56000 2.6m (8.5ft) 38400 3.7m (12ft) 19200 7.6m (25ft) 9600 15m (50ft) 4800 30m (98ft) 2400 60m (196ft) Table 2: Recommended distances Interfacing between TTL level UART and RS-232 From the above discussions, we know that microcontrollers use TTL level UART (5V for logic 1 and 0V for logic 0) while the PC serial.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |