Bus Pirate Edu Kit Exercise no.12
This is the final exercise we designed for the Bus Pirate Educational Kit. It uses the '595 shift registrar IC and a potentiometer to emulate the Bus Pirate LCD adapter board v3 [link].
Conected to the bread board is a 2x16 character LCD. In this exercise we will learn how to write text we want displayed on the LCD.
The potentiometer is needed to provide the contrast voltage setting. Once the LCD is initialized, and you've sent the first text to it, turn the potentiometer knob until you are satisfied with the contrast level on the LCD.
The HD44780 LCD controller located on the LCD itself, can be interfaced with using 7 pins RS (Reset), EN (Enable), and RW (read write), and 4 data pins. The data pins are used to send 2 consecutive 4bit values that make up a single byte together.
Since the Bus Pirate doesn't have 7 pins to control the LCD directly, we use the 595 shift register, previously used in the 2nd exercise to control 8 LEDs, to extend it's reach.
|IC Location||Breadboard wiring legend|
- The (+) and (-) next to PIN1 and PIN2 are intended for devices such as LEDs, where PIN1 should be the anode and connected to a higher potential then PIN2.
Bus Pirate Terminal
HiZ>m<<<the menu command
x. exit(without change)
(1)>8<<<select the LCD mode
This mode requires an adapter
LCD>W<<<turn on the power supplies
POWER SUPPLIES ON
We start the exercise by entering the menu command 'm', and selecting the menu option LCD (8), which enters the Bus Pirate into the LCD mode. This mode is intended for the Bus Pirate LCD adapter v3 board. Since this exercise emulates the LCD adapter board, the mode is perfect for it.
LCD>(2)<<<send the LCD initialization macro
(2)>2<<<select multiple lines
Next we need to initialize the LCD, by entering the LCD init macro '(2)', and selecting multiple lines, since the LCD in the exercise has two lines of 16 characters.
LCD>"Bus Pirate"<<<write "Bus Pirate" in the first line
WRITE: "Bus Pirate"
Once initialized the LCD is ready to display the text we send to it. To send text to the display you simply enter a sting you want displayed between quotation marks (""). Make sure the text is not longer then 16 characters, as every character over 16 will no be shown.
LCD>(4)0x40<<<move the cursor to the beginning of the next line
If you want to write in the next line, you need to move the cursor to the 2nd line beginning, which on our LCD is addressed as 0x40 (0x0 is the beginning of the first line). To do this we use the 'move cursor macro (4)' followed by the position address (0x40).
LCD>"Edu Kit"<<<write "Edu Kit" in the next line
WRITE: "Edu Kit"
Once the cursor is positioned at the beginning of the next line, simply type in the 16 character text you want show there, again between the quotation marks("").
LCD>m<<<the menu command
x. exit(without change)
(1)>1<<<select the HiZ mode
Once you're done with this exercise simply enter the menu command 'm' and select the HiZ mode ('1') to shut down the Bus Pirate.