Bus Pirate Edu Kit Exercise no.12

From DP

Revision as of 11:49, 17 April 2013 by Arakis (Talk | contribs)
Jump to: navigation , search

BP EK E12 overview2.jpg

Contents

Overview

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.

The Circuit

BP EK E12 schematic2.jpgBP EK E12 circuit3.jpg

Breadboard legend

IC Location Breadboard wiring legend
IC PIN1 (+) PIN2 (-)
74HCT595 E8 E9
Potentiometer J22 J23
Signal name Contact1 Contact2
5V BP_5V BB_+_left
5V BB_+_left BB_+_right
5V BB_+_left LCD pin2
5V BB_+_right J8
5V BB_+_right J14
5V BB_+_right G22
GND BP_GND BB_-_left
GND BB_-_left BB_-_right
GND BB_-_left A15
GND BB_-_left LCD pin1
GND BB_-_right J11
GND BB_-_right G24
Data Input BP_MOSI I10
Data Clock BP_CLK I13
~CS BP_CS I12
Contrast G23 LCD pin3
RS C8 LCD pin4
RW C9 LCD pin5
EN C10 LCD pin6
D4 C11 LCD pin11
D5 C12 LCD pin12
D6 C13 LCD pin13
D7 C14 LCD pin14
  • 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
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>8<<<select the LCD mode
This mode requires an adapter
Ready
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
RESET
Display lines:
1. 1
2. Multiple

(2)>2<<<select multiple lines
INIT

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
CURSOR SET

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
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>1<<<select the HiZ mode
Ready
HiZ>

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.

Not Working?

Taking it further