picspalsandgals

University of Washington Electrical Engineering Blog

Category Archives: PIC

PIC 18F Hello World with LCD!

This is just a quick post to give an idea of how easy hello world with an LCD can be done.  The main.c code file will be posted in the code section as well.  This demo (see picture below) uses a PIC18F4455 with a standard 16×2 LCD to display text.  The crystal oscillator used is a 20 MHz crystal and other than that, the rest of the circuit is fairly trivial: give it power, hook up the oscillator and attach the 8 data pins for the LCD to PORT D on the PIC in the same numerical order (RD0->D0, etc) and the R/S, R/W and E lines for the LCD are attached to PORT C.  The code was compiled using Hi-Tech PIC C18 and the LCD code is fairly generic code that was included with PIC C.  If we get time, a schematic will be posted as well.

Here is the circuit in action:

PIC18F4455 Hello World LCD

And here is the schematic (this has a temperature sensor on it as well…see next post for how to use that!):

PIC18F4455 LCD and Temperature Sensor

Hello World in C

Using two compilers, we were able to complete the Hello World tutorial and get a LED to blink on pin 20. Here a picture of said project with LED on and off.  The code page has been updated as well.

USB!

And that is a USB win!  We have accomplished computer controlled LED blinking. We are going to have to find a camera for video, but by following the USB tutorial on the links page we were able to turn a LED on and off with a click of a mouse. It was extremely cool. Next step is to flush out the example program to control more pins and take input from other sensors.

USB Tutorial

We are now working on the USB tutorial for the 18F4550. This is proving to be much more difficult than the blinking LED. Our main problem is the C compiler for Mplab. However here is the schematic that we are following. It was obtained the from website linked to in the links section: USB tutorial.

Also, here is the female USB-Type B wiring diagram.

Platforms

These are the three platforms we will be using(linked to mouser).

PIC (18f4550)

MSP430 Launchpad

EZ430-RF2500

Jumping into PIC’s

Here is the setup for our basic foray into PIC’s. We found this project on a tutorial page for 18F PIC’s called http://www.pic18f.com.  All of these tutorials are based on the 18F4550. Since we are using the PicKit3 programmer here is the pin out.