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_with_printf
Wrappper for VGAII demo by Jim Hamblem that includes a printf function that can print infinitely.
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]; if (j>80) { j=0; } 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++; linenum = j; ecran.rectangle(0, 8*outputrow, 639, 8*outputrow+31, BLACK); ecran.text_string( dest, 0 , outputrow , FONT_8X8, WHITE); outputrow+= 4; 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.