You are viewing an older revision! See the latest version
uVGAII printf demo

The uVGA II board from 4D Systems
This code acts as a wrapper library for the the UVGAII Board demo http://mbed.org/cookbook/uVGAII by Jim Hamblem. It utilizes this library to implement a basic printf function.
Here is the Code for the library to try out:
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 program:
| mbed | uVGA II |
|---|---|
| 5V | 5V |
| Gnd | Gnd |
| TX | RX |
| RX | TX |
| P11 | Reset |

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 printf any text that you have inputted.
Demo_Graphics_Calls
void myprintf(const char* format, ...) {
char dest[256];
va_list argptr;
va_start(argptr, format);
vsprintf(dest, format, argptr);
va_end(argptr);
for ( int i = 0; i < 256; i++) {
buffer[256*j+i]= dest[i];
}
j++;
int linenum = j;
for (int k = 0; k <256; k++) {
printbuf[k] = buffer[256*(linenum-1)+k];
}
ecran.rectangle(0, 8*outputrow, 639, 8*outputrow+30, BLACK);
ecran.text_string( dest, 0 , outputrow , FONT_8X8, WHITE);
outputrow+= 1;
if(outputrow>58){
outputrow =1;
}
}
Because printing to through the vga is slow, any prints off the screen will wrap around to the top of the screen and override the the existing text on the screen 1 line at a time. Therefore, the user has the ability to print as much as possible.
{{}}
Example of the printf function using a demo that prints 300 lines. The prints wrap around to the start and override what was originally printed.
