PCD8544 Driver for an LCD with an PCD8544 controller (Nokia 3310).

Dependencies:   mbed pcd8544_drv

Committer:
carlosftm
Date:
Sun Jan 02 12:08:07 2011 +0000
Revision:
0:0673b827d555
Text support only

Who changed what in which revision?

UserRevisionLine numberNew contents of line
carlosftm 0:0673b827d555 1 /* ********************************************
carlosftm 0:0673b827d555 2 * PCD8544 Driver
carlosftm 0:0673b827d555 3 * This is a sample program to interface the
carlosftm 0:0673b827d555 4 * mbed microcontroller to an LCD with an PCD8544
carlosftm 0:0673b827d555 5 * driver using the pcd8544_drv library.
carlosftm 0:0673b827d555 6 *
carlosftm 0:0673b827d555 7 * Created on: 12/31/2010 at 19:48
carlosftm 0:0673b827d555 8 * Created by: CarlosFTM
carlosftm 0:0673b827d555 9 ********************************************** */
carlosftm 0:0673b827d555 10
carlosftm 0:0673b827d555 11
carlosftm 0:0673b827d555 12 #include "mbed.h"
carlosftm 0:0673b827d555 13 #include "pcd8544_drv.hpp"
carlosftm 0:0673b827d555 14
carlosftm 0:0673b827d555 15 DigitalOut myled(LED1);
carlosftm 0:0673b827d555 16
carlosftm 0:0673b827d555 17 int main()
carlosftm 0:0673b827d555 18 {
carlosftm 0:0673b827d555 19 /* Create a LCD interface*/
carlosftm 0:0673b827d555 20 pcd8544 lcd(p21, p22, p23, p24, p27);
carlosftm 0:0673b827d555 21
carlosftm 0:0673b827d555 22 /* Initialize LCD & Clear screen*/
carlosftm 0:0673b827d555 23 lcd.resetLCD();
carlosftm 0:0673b827d555 24 lcd.initLCD();
carlosftm 0:0673b827d555 25 lcd.clearLCD();
carlosftm 0:0673b827d555 26 wait(0.5);
carlosftm 0:0673b827d555 27
carlosftm 0:0673b827d555 28 /* Fill the screen with a single character (14 * 6 = 84 characters) */
carlosftm 0:0673b827d555 29 char count;
carlosftm 0:0673b827d555 30 for (count = 0; count < (MAX_CHAR_X * MAX_CHAR_Y); count++)
carlosftm 0:0673b827d555 31 {
carlosftm 0:0673b827d555 32 lcd.writeChar('#');
carlosftm 0:0673b827d555 33 }
carlosftm 0:0673b827d555 34
carlosftm 0:0673b827d555 35 /* Locate the cursor on line 3 and print a char string */
carlosftm 0:0673b827d555 36 char message[] = ">PCD8544 LCD>"; // Define message string
carlosftm 0:0673b827d555 37 char* message_p = message; // Create a pointer
carlosftm 0:0673b827d555 38
carlosftm 0:0673b827d555 39 lcd.setCursorXY(1,2); // Locate the cursor on line 3
carlosftm 0:0673b827d555 40 // (Line/Column count starts at 0)
carlosftm 0:0673b827d555 41
carlosftm 0:0673b827d555 42 lcd.writeString(message_p); // Write the string on the LCD
carlosftm 0:0673b827d555 43
carlosftm 0:0673b827d555 44 /* Flash LED
carlosftm 0:0673b827d555 45 * in infinite loop
carlosftm 0:0673b827d555 46 */
carlosftm 0:0673b827d555 47 while(1)
carlosftm 0:0673b827d555 48 {
carlosftm 0:0673b827d555 49 myled = !myled;
carlosftm 0:0673b827d555 50 wait(0.05);
carlosftm 0:0673b827d555 51 myled = !myled;
carlosftm 0:0673b827d555 52 wait(0.5);
carlosftm 0:0673b827d555 53 }
carlosftm 0:0673b827d555 54 }