Demo of 4DGL library for the uLCD-144-G2 128 by 128 color display. See https://mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/ for instructions

Dependencies:   4DGL-uLCD-SE mbed

Fork of uVGAII_demo by jim hamblen

The uLCD-144-G2 from 4D Systems is a low-cost ($25 qty. 100) smart color LCD display board with a serial interface. They are also available from Sparkfun. It looks like a nice alternative to the now hard to find Nokia 6100 LCD breakout boards. It has a TTL level serial interface and a reset pin. An optional uSD card inserted in the display module's socket can be used to load fonts, images, and play videos in response to serial commands. It has a built in system font and the driver supports the use of printfs, so it is very easy to use and hookup. Here is the wiring for the demo program:

mbeduLCD HeaderuLCD cable
5V=VU5V5V
GndGndGnd
TX=P9RXTX
RX=P10TXRX
P11ResetReset

/media/uploads/4180_1/ulcdpins.jpg

In the drawing above, the pins are labeled from the LCDs perspective with TX and RX pins. Mbed RX goes to LCD TX and mbed TX goes to LCD RX. So mbed TX goes to the middle pin on the connector which is the uVGA II RX pin. The included cable seen below is plugged into the bottom row of pins and plugged into a breadboard using the male header pins for hookup. Note that on the cable silkscreen seen in the image below RX and TX have been swapped to indicate the connections needed to the microprocessor pins.

/media/uploads/4180_1/150mm_5_way_female-female_jumper_cable_dsc_2303.jpg /media/uploads/4180_1/5_way_male-male_adaptor_dsc_2299.jpg

// uLCD-144-G2 basic text demo program for uLCD-4GL LCD driver library
//
#include "mbed.h"
#include "uLCD_4DGL.h"

uLCD_4DGL uLCD(p9,p10,p11); // serial tx, serial rx, reset pin;

int main()
{
    // basic printf demo = 16 by 18 characters on screen
    uLCD.printf("\nHello uLCD World\n"); //Default Green on black text
    uLCD.printf("\n  Starting Demo...");
    uLCD.text_width(4); //4X size text
    uLCD.text_height(4);
    uLCD.color(RED);
    for (int i=10; i>=0; --i) {
        uLCD.locate(1,2);
        uLCD.printf("%2D",i);
        wait(.5);
    }
}


Video of longer demo code with both text and graphics. A micro SD card on the LCD module is required for the images and videos seen at the end of the video. The display is actually a bit more colorful and clearer than it appears in the video. Demos include text using printfs, basic graphics commands, a simple bouncing ball animation, computing the Mandelbrot set pixel by pixel, a Plasma wave BLIT, a JPEG image, and a *.wmv video clip.

See https://mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/ for complete info, wiring, breadboard hints on avoiding the use of the cable, and how to work with fonts, images, and videos on the uSD card

Committer:
4180_1
Date:
Fri Feb 25 01:59:37 2011 +0000
Revision:
1:38ef731c7bdf
Parent:
0:cfcf73272647
Child:
2:75727e89a717

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 0:cfcf73272647 1 //
4180_1 0:cfcf73272647 2 // TFT_4DGL is a class to drive 4D Systems TFT touch screens
4180_1 0:cfcf73272647 3 //
4180_1 0:cfcf73272647 4 // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
4180_1 0:cfcf73272647 5 //
4180_1 0:cfcf73272647 6 // TFT_4DGL is free software: you can redistribute it and/or modify
4180_1 0:cfcf73272647 7 // it under the terms of the GNU General Public License as published by
4180_1 0:cfcf73272647 8 // the Free Software Foundation, either version 3 of the License, or
4180_1 0:cfcf73272647 9 // (at your option) any later version.
4180_1 0:cfcf73272647 10 //
4180_1 0:cfcf73272647 11 // TFT_4DGL is distributed in the hope that it will be useful,
4180_1 0:cfcf73272647 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
4180_1 0:cfcf73272647 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4180_1 0:cfcf73272647 14 // GNU General Public License for more details.
4180_1 0:cfcf73272647 15 //
4180_1 0:cfcf73272647 16 // You should have received a copy of the GNU General Public License
4180_1 0:cfcf73272647 17 // along with TFT_4DGL. If not, see <http://www.gnu.org/licenses/>.
4180_1 0:cfcf73272647 18
4180_1 0:cfcf73272647 19 #include "mbed.h"
4180_1 0:cfcf73272647 20 #include "TFT_4DGL.h"
4180_1 0:cfcf73272647 21
4180_1 1:38ef731c7bdf 22 // overwrite 4DGL library screen size settings in TFT_4DGL.h
4180_1 1:38ef731c7bdf 23 #define SIZE_X 479
4180_1 1:38ef731c7bdf 24 #define SIZE_Y 639
4180_1 1:38ef731c7bdf 25 //
4180_1 1:38ef731c7bdf 26
4180_1 0:cfcf73272647 27 TFT_4DGL ecran(p9,p10,p11); // serial tx, serial rx, reset pin;
4180_1 0:cfcf73272647 28
4180_1 0:cfcf73272647 29 int main() {
4180_1 1:38ef731c7bdf 30 // char s[500];
4180_1 1:38ef731c7bdf 31 // int x = 0, y = 0, status, xc = 0, yc = 0;
4180_1 1:38ef731c7bdf 32
4180_1 0:cfcf73272647 33 ecran.baudrate(115200);
4180_1 1:38ef731c7bdf 34 // added - Set Display to 640 by 480 mode
4180_1 1:38ef731c7bdf 35 ecran.display_control(0x0c, 0x01);
4180_1 1:38ef731c7bdf 36 //
4180_1 0:cfcf73272647 37 ecran.background_color(DGREY);
4180_1 0:cfcf73272647 38 ecran.circle(120, 160, 80, 0xFF00FF);
4180_1 0:cfcf73272647 39 ecran.triangle(120, 100, 40, 300, 200, 270, 0x0000FF);
4180_1 0:cfcf73272647 40 ecran.line(0, 0, 239, 319, 0xFF0000);
4180_1 0:cfcf73272647 41 ecran.rectangle(50, 50, 200, 90, 0x00FF00);
4180_1 0:cfcf73272647 42 ecran.ellipse(100, 250, 80, 30, 0xFFFF00);
4180_1 0:cfcf73272647 43 ecran.pixel(120, 160, BLACK);
4180_1 0:cfcf73272647 44 ecran.read_pixel(120, 170);
4180_1 0:cfcf73272647 45 ecran.screen_copy(50, 50, 200, 200, 100, 100);
4180_1 0:cfcf73272647 46 ecran.pen_size(WIREFRAME);
4180_1 0:cfcf73272647 47 ecran.circle(120, 160, 60, BLACK);
4180_1 0:cfcf73272647 48 ecran.set_font(FONT_8X8);
4180_1 0:cfcf73272647 49 ecran.text_mode(TRANSPARENT);
4180_1 0:cfcf73272647 50 ecran.text_char('B', 9, 8, BLACK);
4180_1 0:cfcf73272647 51 ecran.text_char('I',10, 8, BLACK);
4180_1 0:cfcf73272647 52 ecran.text_char('G',11, 8, BLACK);
4180_1 0:cfcf73272647 53 ecran.graphic_char('G', 120, 120, BLACK, 4, 4);
4180_1 0:cfcf73272647 54 ecran.text_string("This is a test of string", 2, 12, FONT_8X8, WHITE);
4180_1 0:cfcf73272647 55 ecran.graphic_string("This is a test of graphic string", 20, 200, FONT_8X8, WHITE, 2, 2);
4180_1 0:cfcf73272647 56 ecran.text_button("OK", UP, 40, 260, 0xFF0000, FONT_8X8, BLACK, 2, 2);
4180_1 0:cfcf73272647 57
4180_1 1:38ef731c7bdf 58 // delete touch screen demo - no touch on uVGA II
4180_1 1:38ef731c7bdf 59
4180_1 0:cfcf73272647 60 }