As an Amazon Associate I earn from qualifying purchases.
After completing the PIC18F2550 USB HID Oscilloscope, I decided to expand upon the project and firmware to include multiple analog inputs and digital i/o. The base firmware for this project is the same as the PIC18F2550 USB HID Oscilloscope‘s; however, more features have been added that allow the user to access the PIC18F2550’s Port B for digital i/o. In addition, the firmware now allows the user to access the AN0-AN4 analog pins for monitoring and data acquisition.
The source and firmware for the circuit can be found at the bottom of the page. Each section of the circuit is labeled in the schematic. All of the sections and their components are described and discussed below. The part numbers for the components are linked to websites for data and more information when available.
The 5 analog inputs are connected to pins A0, A1, A2, A3, and A5, which are configured to be analog inputs. Please note that “The source impedance affects the offset voltage at the analog input (due to pin leakage current). The maximum recommended impedance for analog sources is 2.5 kOhms.” (PIC18F2550, p.260)
The digital inputs and outputs share Port B. Please note that:
Maximum output current sunk by any I/O pin = 25 mA
Maximum output current sourced by any I/O pin = 25 mA
Maximum current sunk by all ports = 200 mA
Maximum current sourced by all ports = 200 mA
The microcontroller used is a Microchip PIC18F2550. I modified the PIC18F2550 Tiny PIC Bootloader assembly file so I could use a 20MHz crystal/resonator at 115,200 baud (the modified bootloader can be found at the bottom of the page). The PIC18F2550 runs at 48MHz using the internal PLL. R1 is a pull-up resistor necessary for operation. C1 is a stabilizing capacitor that is used for the onboard USB voltage regulator, which is used in this project. The component marked ‘RES’ is a 20MHz resonator.
RS232 Level Converter
The microcontroller USART pins need to be connected to a RS-232 Level Converter to connect to a PC for firmware updates using the Tiny PIC Bootloader. Otherwise, after initial programming they can be left disconnected.
The PIC is connected to the computer through a USB port and is bus-powered.
Source and Firmware
The PIC must initially programmed with the ‘SAC_tinybld18F2550usb _20MHz_115200_48MHz’ hex file to program the bootloader on the PIC. Then, using Tiny PIC Bootloader, the hex file can be placed on the chip using the Tiny PIC Bootloader frontend with ’12h 34h 56h 78h 90h’ in the ‘List of codes to send first:’ in the ‘Options’ menu. Please feel free to contact me if you have any problems.
- 18F2550 USB HID CRC IO.c (hex)
- usb_desc_hid 8-byte.h
- Visual Basic example software and source code: PIC18F2550 USB HID IO VB Example.zip
Update (November 15, 2006)
Here is the firmware without the bootloader code:
Update 2 (December 18, 2006)
Here are untested PIC18F4550 firmwares:
Amazon and the Amazon logo are trademarks of Amazon.com, Inc, or its affiliates.