Here is my code for the working LCD Crystal ball exercise. properly the most fiddly project so far this used a lot of what was learnt in previous chapters, for example it has a poteniometer attached to change the contrast of the LCD, as shown below:
The LCD has 9 outputs in this project.
.Output 1 = Vss pin is grounded along with Output 16 (LED -)
Output 2 = Vcc connects directly to the 5v power along with Output
Output 3 = vO went to the centre pin of the pontentiometer to change the contrast of the screen.
Output 4 = RS goes to pin digital pin 12 of the board. this controls where the characters will appear on screen.
Output 5 = R/W to ground, puts the screen in read or write mode.
Output 6 = E Digital pin 11 of the board. (Enable) tells the lcd that it will be receiving a command.
Output 11 = D4 to digital pin 5
Output 12 = D5 to digital pin 4
Output 13= D6 to digital pin 3
Output 14 = D7 to digital pin 2
Output 15 = LED+ to 5v power through a 220ohm resistor.
Pins D0-7 are used to send character data to the screen. As you can see we used D4-D7
(More how they work soon).