PIC18 Microcontroller USB Bus Interface
Some of the PIC18 microcontrollers support USB interface directly. For example, the PIC18F4550 microcontroller contains a full-speed and low-speed compatible USB interface that allows communication between a host PC and the microcontroller. In the USB projects in this chapter we will use the PIC18F4550 microcontroller.
Figure 8.8 is an overview of the USB section of the PIC18F4550 microcontroller. PORTC pins RC4 (pin 23) and RC5 (pin 24) are used for USB interface. RC4 is the USB data D- pin, and RC5 is the USB data Dþ pin. Internal pull-up resistors are provided which can be disabled (setting UPUEN ¼ 0) if desired and external pull-up resistors can be used instead. For full-speed operation an internal or external resistor should be connected to data pin Dþ, and for low-speed operation an internal or external resistor should be connected to data pin D-.
Operation of the USB module is configured using three control registers, and a total of twenty-two registers are used to manage the actual USB transactions. Configuration
of these registers is a highly complex task and is not covered in this book. Interested readers should refer to the PIC18F4550 data sheet and to books on USB internals.
In this chapter we are using the mikroC language USB library functions to implement USB transactions. The details of these functions are given in the next section.