A demo program for the uVGAII board using the mbed cookbook 4DGL library in 640 by 480 VGA mode

Dependencies:   4DGL mbed

/media/uploads/4180_1/uvgaii.jpg
The uVGA II board from 4D Systems

The uVGA II from 4D Systems is a low-cost VGA controller on a breakout board. The existing mbed cookbook 4D SGC library can be used with a couple minor patches for 640 by 480 resolution. They are also available from Sparkfun. They were recently updated/replaced with the newer uVGA III board.

Here is a uVGA II demo program to try:

Import programuVGAII_demo

A demo program for the uVGAII board using the mbed cookbook 4DGL library in 640 by 480 VGA mode


Here is the wiring for the demo program:

mbeduVGA II
5V=VU5V
GndGnd
TX=P9RX
RX=P10TX
P11Reset

uVGAIIpins

In the drawing above, the pins are labeled from the mbed's perspective with TX and RX pins already swapped. So mbed TX goes to the middle pin on the connector which is the uVGA II RX pin.

Just plug in any VGA monitor to the DB15 connector and watch the display.

/media/uploads/4180_1/uvgaii_demo.jpg
mbed uVGA II demo program output on a VGA monitor in 640 by 480 mode.


Use the demo code as an initial starting point to develop your own display code. The module starts in 320 by 240 graphics mode and a special display command in main.cpp, “ecran.display_control(0x0c, 0x01);” is sent to switch to 640 by 480 mode in the demo code before sending any text and graphics data to the display. The 4DGL library *.h file, TFT_4GL.h, has a SIZE_X and SIZE_Y #define that should be edited and set to the number of pixels in the display, after you have a copy of the library in your local directory. The demo code segment for the text and graphics calls is shown below:

Demo_Graphics_Calls

    ecran.background_color(DGREY);
    ecran.circle(120, 160, 80, 0xFF00FF);
    ecran.triangle(120, 100, 40, 300, 200, 270, 0x0000FF);
    ecran.line(0, 0, 239, 319, 0xFF0000);
    ecran.rectangle(50, 50, 200, 90, 0x00FF00);
    ecran.ellipse(100, 250, 80, 30, 0xFFFF00);
    ecran.pixel(120, 160, BLACK);
    ecran.read_pixel(120, 170);
    ecran.screen_copy(50, 50, 200, 200, 100, 100);
    ecran.pen_size(WIREFRAME);
    ecran.circle(120, 160, 60, BLACK);
    ecran.set_font(FONT_8X8);
    ecran.text_mode(TRANSPARENT);
    ecran.text_char('B', 9, 8, BLACK);
    ecran.text_char('I',10, 8, BLACK);
    ecran.text_char('G',11, 8, BLACK);
    ecran.graphic_char('G', 120, 120, BLACK, 4, 4);
    ecran.text_string("This is a test of string", 2, 12, FONT_8X8, WHITE);
    ecran.graphic_string("This is a test of graphic string", 20, 200, FONT_8X8, WHITE, 2, 2);
    ecran.text_button("OK", UP, 40, 260, 0xFF0000, FONT_8X8, BLACK, 2, 2);



Just about any VGA monitor will work. If you don't have a second monitor, you might have another input source on your PC monitor that you could use. If you plan to buy a monitor, there are a number of nice small VGA monitors (7 to 12 inch) with a touch screen that are sold in the car aftermarket for use in in-car PCs that should work well with this VGA board on mbed projects.

Xenarc
A 7 inch VGA monitor with USB touch input and speakers.

mp3Car has a large assortment of small touch screen LCDs such as this 7 inch LED LCD model 705TSV from Xenarc seen above. A number of them have standard VGA inputs and even internal speakers. This Xenarc monitor runs around $225. Touch input still costs a bit extra, but it is nice to have. The touch screen data typically is sent out over a USB port, so that would take some additional work to use with mbed. At least they seem to have some info on it in this manual. These monitors are so small that they probably need to be attached to something to use the touch input or they move. The uVGA II module does not include code to read a touch screen input, so an mbed interface and driver software would be needed to support touch

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Fri Feb 25 01:59:37 2011 +0000
Parent:
0:cfcf73272647
Commit message:

Changed in this revision

4DGL.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
uVGAII_4DGL.lib Show diff for this revision Revisions of this file
diff -r cfcf73272647 -r 38ef731c7bdf 4DGL.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/4DGL.lib	Fri Feb 25 01:59:37 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Kerpower/code/4DGL/#6063b076187b
diff -r cfcf73272647 -r 38ef731c7bdf main.cpp
--- a/main.cpp	Thu Feb 24 15:15:39 2011 +0000
+++ b/main.cpp	Fri Feb 25 01:59:37 2011 +0000
@@ -19,18 +19,21 @@
 #include "mbed.h"
 #include "TFT_4DGL.h"
 
+// overwrite 4DGL library screen size settings in TFT_4DGL.h
+#define SIZE_X  479
+#define SIZE_Y  639
+//
+
 TFT_4DGL ecran(p9,p10,p11); // serial tx, serial rx, reset pin;
 
 int main() {
-    char s[500];
-    int x = 0, y = 0, status, xc = 0, yc = 0;
-    
- 
+//    char s[500];
+//    int x = 0, y = 0, status, xc = 0, yc = 0;
+
     ecran.baudrate(115200);
-// new code to set resolution to 640 by 480
-// also changed max size_x and size_y in TFT_4DGL_graphics.h
-// Screen_res command is 12 decimal and not 12hex as listed in manual
-    ecran.display_control(SCREEN_RES, char(1));
+// added - Set Display to 640 by 480 mode
+    ecran.display_control(0x0c, 0x01);
+//
     ecran.background_color(DGREY);
     ecran.circle(120, 160, 80, 0xFF00FF);
     ecran.triangle(120, 100, 40, 300, 200, 270, 0x0000FF);
@@ -51,7 +54,7 @@
     ecran.text_string("This is a test of string", 2, 12, FONT_8X8, WHITE);
     ecran.graphic_string("This is a test of graphic string", 20, 200, FONT_8X8, WHITE, 2, 2);
     ecran.text_button("OK", UP, 40, 260, 0xFF0000, FONT_8X8, BLACK, 2, 2);
-// demo code deleted here for touch screen - no touch screen on uVGA II
 
- 
+  // delete touch screen demo - no touch on uVGA II
+
 }
\ No newline at end of file
diff -r cfcf73272647 -r 38ef731c7bdf mbed.bld
--- a/mbed.bld	Thu Feb 24 15:15:39 2011 +0000
+++ b/mbed.bld	Fri Feb 25 01:59:37 2011 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
+http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da
diff -r cfcf73272647 -r 38ef731c7bdf uVGAII_4DGL.lib
--- a/uVGAII_4DGL.lib	Thu Feb 24 15:15:39 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/4180_1/code/uVGAII_4DGL/#e25ba425dc7b