Книга: Advanced PIC Microcontroller Projects in C

PROJECT 8.1 — USB-Based Microcontroller Output Port

This project describes the design of a USB-based microcontroller output port. A PIC18F4550 microcontroller is interfaced to a PC through a USB cable. A Visual Basic program runs on the PC and sends commands to the microcontroller through the USB bus, asking the microcontroller to set/reset the I/O bits of its PORTB.

The block diagram of the project is shown in Figure 8.10. The circuit diagram is given in Figure 8.11. The USB lines of the PIC18F4550 microcontroller are connected to a USB connector. The microcontroller is powered from the USB line (i.e., no external power supply is required). This makes the design of USB-based products relatively cheap and very attractive in applications where the total power consumption is below 100mA. The microcontroller is operated from an 8MHz crystal.


Figure 8.10: Block diagram of the project


Figure 8.11: Circuit diagram of the project

The PORTB pins of the microcontroller are connected to LEDs so we can see the state changes as commands are sent from the PC. This makes testing the project very easy. Note that a capacitor (about 200nF) should be connected between the VUSB pin (pin 18) of the microcontroller and the ground for stability.

The project software consists of two parts: the PC software, and the microcontroller software. Both are described in this section.

Оглавление книги


Генерация: 1.338. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз