Using PIC18F2550 for connecting 16x2 LCD module to USB port . Included Visual Basic 6 code, VS2005 C# code based on Microchip code, PIC C code and a circuit diagram. The circuit is powered
by the USB. The interface to the PC is HID class.
There are several makes of the LCD module that are interchangeable, the one I used is UC-16207. The LCD module has a 14 way connector, 8 pins are used for data, 2 for supply, register select(RS), read/write, enable (E) and contrast adjust. The R/W input must be connected to earth to make sure that data lines are in input mode. The VB application has only basic functions, it can be changed to interface the display for a variety of inputs.
When USB is plugged it verifies the connection with the host and then initialize the LCD. On typing a character the USB updates all the 32 characters. HID class (human interface device) is a class of
devices like the mouse and the keyboard, the data transfer rate
is limited to 64KB/S. The PC already has a driver for HID USB. VB6 code includes guidance to setting up the PC.
The PC register the PID and VID (product ID) of the USB device when
it's plugged, the VB code uses these ID's to communicate with the
device. For commercial VID it is needed to buy it from USB-IF, but in your lab you can use any number. The source code is derived from freeware from these sources: http://janaxelson.com/usb.htm , http://openprog.altervista.org/USB_firm_eng.html
Code was written on MPLAB 8x and compiled with C18 ver 3.30. PIC18F2550 was programmed using Velleman K8076.
Software includes PIC code and VB6 code. You are free to use the circuit diagram and the VB software with no
Pin 14 is 3.3V internal supply for the USB transceiver. 0.22uF is
required for regulation.
Pins 21 to 28 are port B outputs.
Pins 15,16 are the data lines to the USB connector on the PC.
Pin 20 is the PC 5V powering the PIC and the LCD module. It is limited to 100mA by
the PC. 0.47uF is for decoupling.
For USB wiring info: http://www.interfacebus.com/Design_Connector_USB.html
20K trimmer is needed to adjust the contrast voltage which vary with different batches of LCD.
Pins 7 to 14 are data inputs D0 to D7. Pin 6 is clock input, enables LCD module to read the data.
Pin 4 is Register Select input, it is used for 16 bits instruction.
Pin 5 must be connected to earth to insure that data lines are always inputs.
05.12.2014 - 07:38 Name: tharindu Comment: moty i need asm file
but it not found
give me please
25.10.2011 - 18:06 Name: jirka Comment: Hi
I need something of you yet,when this is no problem.I wrote you on your email,but I got no answer,so I write here again. I tried to make this setting,but I have a few problem.I wanted to setting in MPLAB IDE, but there is for example BOR enabled only or enable with software ( SBOREN)
and BORV is with max or min besides 3.
CCP2MX input/outpu besides OFF or ON
STVREN stack full/underflow besides on or of
And to setting DEBUG isnīt here.
When this is possible,so send me the HEX ,which includes the setting.
I beginn with pic,and I programmed a few PIC. At old species PIC (for example PIC16F84) this is easy to make setting,because there is only four choos. But when I opened setting window at MPLAB IDE for PIC18F2550,so I was very surprise, how many it includes.
Thank you for your answer
17.10.2011 - 18:47 Name: Moty Comment: Hi Jirka,
The config. settings in main.c are:
#pragma config PLLDIV=1, CPUDIV=OSC3_PLL4, USBDIV=2, FOSC=XTPLL_XT
#pragma config IESO=OFF, PWRT=OFF, BOR=ON_ACTIVE, BORV=3, VREGEN=ON, WDT=OFF
#pragma config MCLRE=OFF, PBADEN=OFF, CCP2MX=OFF, STVREN=ON, LVP=OFF, XINST=OFF, DEBUG=OFF
If the USB device is detected but there is nothing displayed try to increase the clock and 2ms delay by a factor of 5. Some LCD's need lower frequencies.
17.10.2011 - 17:17 Name: jirka Comment: good morning
I have one question about LCD 16x2 on USB. The file for PIC18F2550 is without setting MCLR,Crystal,wdt......... When this is possible,so write me that. I tried to make setting but it doesnīt work. Thank you for your answer