Hardware Reference
In-Depth Information
Table 4-3. The clear display instruction in four-bit mode
Data Bit
DB7
DB6
DB5
DB4
Binary
0
0
0
0
Timing
200-ms wait
Data Bit
DB7
DB6
DB5
DB4
Binary
0
0
0
1
You can see now that you need to set up timing in between each set of bits also before and after each data write.
Note that the timing will not matter for you as the software I will be using will take care of that for you.
Now you are going to need to find something that has a minimum of four data lines. I bet if you take a look at
any newer PC or your laptop you would be hard-pressed to find anything that has more than four separate data lines.
This was not always the case. Back when LCDs were all the rage pretty much every PC came with a parallel port.
The parallel port was perfect for driving the LCD. It could easily support all the data lines needed and was simple to
interface with. Given the ease of programming in eight-bit mode and the abundance of parallel ports it's easy to see
why this method of interfacing was selected by PC hobbyists.
Preparing the Hardware
Hang on: the Raspberry Pi has no parallel port! No, but it has GPIO: remember that all you need are data lines and a
few control lines. So how are you going to connect this magic little LCD to the Raspberry Pi? That's what I am going to
show you in this section. First, let's prep the LCD so it's easy to work with.
LCD Prep Work
If you take a look at your LCD you'll see the little holes and solder pads. While it's possible to solder and desolder
wires to the LCD more than once you do risk the potential of damaging the solder pads if you do this. They are not
designed to be heated up all the time. If you did heat the solder pad too much, you may cause the pad to lift from the
PCB. If this happens you can no longer use the solder pad and you may not be able to use the LCD. You can repair a
broken pad but it's neither simple nor easy. It's much better if you just respect the solder pad to start with and ensure
that you don't break it. Given this, you need a way to easily connect the LCD to any board you may have. By looking
at the LCD the first thing that may come to mind is soldering some wire to the LCD solder pads and leaving them
hanging. This is fine and would work without any issues. Unfortunately it has some downsides. You may want to
remove or add data lines in the future. For example, if you move from eight-bit mode to four-bit mode you need to add
or remove four wires. This once again brings us back to the solder pad issue. Also, having a bunch of wires hanging off
your LCD looks messy for a nonpermanent installation. So now what? If you look closely at the solder pads you may
notice that each pad has the same spacing between each pad (in this case 2 mm).
In electronics there are normally three standards of spacing for headers:
The most common spacing you will find is 2.54 mm.
The next most common is 2 mm.
Lastly there is 1.27-mm spacing. I have yet to see anything that uses the 1.27-mm spacing but
I am sure they are out there.
 
 
Search WWH ::




Custom Search