uVGAIII

Team Member

Jingyi Zhang, jyzhang@gatech.edu

Jian Yuan, jian.yuan@gatech.edu

Brief Discription

/media/uploads/ivygatech/4d_uvgaiii.jpg

The uVGA-III board from 4D Systems.

The uVGA-III is a compact and cost effective VGA Graphics Engine packed with plenty of features, ready to become the GUI for your target application, and capable of being an interface controller for a number of applications. They are available from Sparkfun.

In Serial mode, uVGA-III can be used as a slave serial graphics controller. This enables the user to use the microcontroller or serial device as the Host. By default, each module shipped from the 4D Systems factory will come pre-programmed ready for use in the Serial mode.

Datasheet

Datasheet of the uVGA-III board.

Datasheet of the PICASO processor.

Hello World!

Here is a uVGA II demo program to try:

Import programuVGAIII_demo

A demo program using uVGAIII board.

Schematic

/media/uploads/ivygatech/scheme.jpg

Wiring

Here is the wiring for the demo program.

mbeduVGA IIIVGA adapter cable
5V=VU5V
GndGnd
TX=P9RX
RX=P10TX
P11Reset
p10(J3)Red line

/media/uploads/ivygatech/uvgapins.jpg

In the drawing above, the pins are labeled from the uVGA-III perspective with TX and RX pins. Mbed RX goes to uVGA-III TX and mbed TX goes to uVGA-III RX. So mbed TX goes to the middle pin on the connector which is the uVGA-III's RX pin. The included cable seen below is plugged into the top row of pins and plugged into a breadboard using the male header pins for hookup. The picture below is a female one. 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/ivygatech/150mm_5_way_female-female_jumper_cable_dsc_2303.jpg

Below is the VGA adapter cable.

/media/uploads/ivygatech/vl-cbr-1007.jpg

For the other part of pins on the uVGA-III board, that is J3, we just use a VGA adapter cable to connect the uVGA-III board to the VGA cable which is connected to the monitor. Note that the red line on the cable should be connected to the p10 of J3 on the uVGA-III board.

Demo

This picture shows what the demo codes implement. The mbed uVGA-III demo program output on a VGA monitor in 800 by 480 mode.

/media/uploads/ivygatech/demo.jpg

Watch the video to see how it works.

Below is the code of the main function to implement the things we watch in the video.

main.cpp

//
// uVGAIII is a class to drive 4D Systems TFT touch screens
//
// Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
//
// uVGAIII is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uVGAIII is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uVGAIII.  If not, see <http://www.gnu.org/licenses/>.

#include "mbed.h"
#include "uVGAIII.h"

#define SIZE_X       480
#define SIZE_Y       800

// overwrite 4DGL library screen size settings in uVGAIII.h

uVGAIII ecran(p9,p10,p11); // serial tx, serial rx, reset pin;

int main() {
    char c;
    
    printf("\n\n-----Starting-----\n\n");

    ecran.baudrate(128000);
    ecran.screen_mode(LANDSCAPE);
    ecran.graphics_parameters(RESOLUTION, 2);  // set screen resolution to 800*480
    ecran.touch_status();
    ecran.background_color(DGREY);
    ecran.cls();

    ecran.circle(120, 160, 80, CYAN);
    ecran.filled_triangle(320, 100, 340, 300, 500, 270, LIME);
    
    ecran.move_cursor(5, 60);
    ecran.char_width('d');
    ecran.char_height('d');
    ecran.text_fgd_color(MAGENTA);
    ecran.text_bgd_color(YELLOW);
    ecran.put_string("This is a test of string!\nHappy Pi Day :-)");
    
    ecran.move_cursor(10, 10);
    ecran.puts("This is a test of puts...\n");
    
    ecran.move_cursor(15, 98);
    ecran.printf("This is a test of printf!\rMew...\nYeah!");
    
    ecran.move_cursor(20,10);
    ecran.printf("Starting real-time display...\n\n");
    ecran.move_cursor(20,78);
    while((c=getchar())!= '~'){            // when type '~', exit the real time display
        ecran.printf("%c",c);
    }
    ecran.printf("\n\nClosing real-time display...\n");

    printf("\n\n-----Completed-----\n\n");
}

Library

Import libraryuVGAIII

Library for uVGAIII

API

Import library

Public Member Functions

void cls ()
Clear the entire screen using the current background colour.
void reset ()
Reset screen.
void baudrate (int speed)
Set serial Baud rate (both sides : screen and mbed)
void set_volume (char value)
Set internal speaker to specified value.
void screen_mode (char mode)
Set the graphics orientation.
void background_color (int color)
Set background color of the screen.
void circle (int x, int y, int radius, int color)
Draw a circle.
void filled_circle (int x, int y, int radius, int color)
Draw a filled circle.
void triangle (int x1, int y1, int x2, int y2, int x3, int y3, int color)
Draw a triangle.
void filled_triangle (int x1, int y1, int x2, int y2, int x3, int y3, int color)
Draw a filled triangle.
void line (int x1, int y1, int x2, int y2, int color)
Draw a line.
void rectangle (int x1, int y1, int x2, int y2, int color)
Draw a rectangle.
void filled_rectangle (int, int, int, int, int)
Draw a filled rectangle.
void ellipse (int x, int y, int radius_x, int radius_y, int color)
Draw a ellipse.
void filled_ellipse (int x, int y, int radius_x, int radius_y, int color)
Draw a filled ellipse.
void button (int state, int x, int y, int buttoncolor, int txtcolor, int font, int txtWidth, int txtHeight, char *text)
Draw a button.
void panel (int state, int x, int y, int Width, int Height, int color)
Draw a panel.
void slider (char mode, int x1, int y1, int x2, int y2, int color, int scale, int value)
Draw a slider.
void put_pixel (int x, int y, int color)
Draw a pixel.
int read_pixel (int x, int y)
Read the color value of the pixel.
void screen_copy (int xs, int ys, int xd, int yd, int width, int height)
Copy an area of a screen.
void clipping (char value)
Enable or disable the ability for Clipping to be used.
void set_clipping_win (int x1, int y1, int x2, int y2)
Specifiy the clipping window region on the screen.
void extend_clip_region ()
Force the clip region to the extent of the last text.
void change_color (int oldColor, int newColor)
Change all old color pixels to new color within the clipping window area.
void move_origin (int xpos, int ypos)
Move the origin to a new position.
void line_pattern (int pattern)
Set the line pattern.
void outline_color (int color)
Set the outline color for rectangles and circles.
void transparency (char mode)
Set whether to enable the transparency.
void transparent_color (int color)
Set the color to be transparent.
void graphics_parameters (int function, int value)
Set graphics parameters.
void set_font (char mode)
Set font mode.
void move_cursor (int line, int column)
Move teh text cursor to a screen postion.
void text_opacity (char mode)
Set whether or not the 'background' pixels are drawn.
void text_width (int multiplier)
Set the text width multiplier between 1 and 16.
void text_height (int multiplier)
Set the text height multiplier between 1 and 16.
void text_x_gap (int pixelcount)
Set the pixel gap between characters(x-axis)
void text_y_gap (int pixelcount)
Set the pixel gap between characters(y-axis)
void text_bold (char mode)
Set the bold attribute for the text.
void text_inverse (char mode)
Inverse the background and foreground color of the text.
void text_italic (char mode)
Set the text to italic.
void text_underline (char mode)
Set the text to underlined.
void text_attributes (int value)
Control several functions grouped, Text Bold, Text Italic, Text Inverse, Text Underlined.
void put_char (char c)
Print a single character on the display.
void put_string (char *s)
Print a string on the display.
void text_fgd_color (int color)
Set the text foreground color.
void text_bgd_color (int color)
Set the text background color.
void char_width (char c)
calculate the width in pixel units for a character
void char_height (char c)
calculate the height in pixel units for a character
void putc (char c)
place char at current cursor position used by virtual printf function _putc
void puts (char *s)
place string at current cursor position
void detect_touch_region (int x1, int y1, int x2, int y2)
Specify a new touch detect region on the screen.
void touch_get_x (int *x)
Get X coordinates of the touch.
void touch_get_y (int *y)
Get Y coordinates of the touch.
void touch_set (char mode)
Set various touch screen related parameters.
int touch_status (void)
Get the status of the screen.


Please log in to post comments.