Secons Microvga dumb terminal.

I am new to Ardunio and would like some code for a Secons Microvga to display text on a monitor.

Please edit your post and get rid of the all caps (subject line too).

(Upper case is considered shouting)

Have you searched the homepage of the microVGA? - http://www.microvga.com/ -
There is sample code there, I recall that connecting the shield was less trivial

found this code in my basement, might get you started …

// 
//    FILE: test3.pde
//  AUTHOR: Rob Tillaart
// VERSION: 0.1.00
// PURPOSE: test microVGA 
//
// HISTORY: 
// 0.1.00 - 2011-06-13  initial version
// 
// Released to the public domain
//

#define OFF         "\033[0m"
#define BOLD        "\033[1m"
#define LOWINTENS   "\033[2m"
#define UNDERLINE   "\033[4m"
#define BLINK       "\033[5m"
#define REVERSE     "\033[7m"

#define GOTOXY( x,y) "\033[x;yH"   // Esc[Line;ColumnH

#define CLS          "\033[2J"     // Esc[2J Clear entire screen 

void setup()
{
  Serial.begin(38400);
  Serial.println("START");
  pinMode(13, OUTPUT);
}

void loop()
{

  Serial.print(BOLD);
  Serial.println("bold - Hello World");
  Serial.print(OFF);
  Serial.println("Goodbye");

  Serial.print(LOWINTENS);
  Serial.println("lowintense - Hello World");
  Serial.print(OFF);
  Serial.println("Goodbye");

  Serial.print(UNDERLINE);
  Serial.println("underline - Hello World");
  Serial.print(OFF);
  Serial.println("Goodbye");

  Serial.print(BLINK);
  Serial.println("blink - Hello World");
  Serial.print(OFF);
  Serial.println("Goodbye");

  Serial.print(REVERSE);
  Serial.println("reverse - Hello World");
  Serial.print(OFF);
  Serial.println("Goodbye");

  Serial.print(GOTOXY(3,3));
  Serial.println("gotoxy 3,3 - Hello World");
  Serial.print(OFF);
  Serial.println("Goodbye");  

  Serial.print(CLS);
  Serial.println("Hello World");
  Serial.print(OFF);
  Serial.println("Goodbye"); 

  digitalWrite(13, HIGH);
  delay(2000);
  for (int i =0; i< 100; i++) 
  {
    Serial.println(i,DEC);
  }
  digitalWrite(13, LOW);

  delay(1000);
}

The sample code from the microvga web site works fine but only puts a "U" on the screen. I would like to put text on the screen. I gave your code a try and nothing worked. , Thanks

I connected through the serial interface, not the SPI interface ... Which one are you using?

I am using SPI.

That looks cool. I just ordered one so I might be able to help you further in a week or so, whenever it arrives. Meanwhile, their example sketch looks pretty strange to me. They seem to be using SPI "the hard way".

Read this:

http://www.gammon.com.au/spi

I would be doing (in setup):

SPI.begin ();

And then to display stuff:

  // enable Slave Select
  digitalWrite(SS, LOW);    // SS is pin 10
  
  char c;

  // send test string
  for (const char * p = "Hello world!" ; c = *p; p++)
    SPI.transfer (c);

 // disable Slave Select
 digitalWrite(SS, HIGH);

However, untested until I get my hands on the hardware.

I went to your web site and made a copy of the SPI code for Arduino as master. It worked good with one big problem. The output on the monitor is unreadable. It acts like the baud rate is not right. As I am new at this I do not understand a lot about the workings of SPI.

Thank you,

Royal

Hard to say until mine arrives. Maybe a brief delay after sending each byte? Can you post the code you actually tried?

Hi, it's a long while since i used microvga and when i first started using it i discovered there was a bug in arduino_uvga.c have a look here http://arduino.cc/forum/index.php/topic,27554.0.html a few people had the same problem with uVGA not working. I allways found spi mode to work best

I did get it to work. I am not good at programming and would like some sample code that I could experiment with.

Thanks,

Royal

I got my MicroVGA in the mail today. After quite a lot of mucking around I got it to work.

Wiring:

uVGA
Pin
1 GND     Arduino GND
2 +5V     Arduino +5V
3 +3V3 output NOT CONNECTED
4 /SS     Arduino Digital 10
5 SCK     Arduino Digital 13
6 /RDY    Arduino Digital 9
7 MISO    Arduino Digital 12
8 MOSI    Arduino Digital 11

Switch to SPI mode

Plug in a PS2 keyboard (it only goes into one socket), power up the device, and short the “setup” pad (on the edge near the keyboard socket) with a screwdriver. It should enter “setup” mode.

  • Select “Communication → SPI Mode”
  • Hit Enter
  • (Note, if you go back in 1000000 baud is still selected, that is the default, not the current mode)
  • Select “Save settings”
  • Wait for confirmation
  • Power device off (unplug Arduino from power)

Sketch

// MicroVGA demo
// Author: Nick Gammon
// Date: 16th April 2012
// Licence: Released into the public domain.

#include <SPI.h>
const byte readyPin = 9;
const byte ssPin = 10;

void setup()  
{                
  SPI.begin ();
  pinMode (ssPin, OUTPUT);
  SPI.setDataMode (SPI_MODE1); 
}  // end of setup

// send a byte to the uVGA
void sendByte (const byte c)
  {
  // wait till device ready
  while (digitalRead (readyPin) == HIGH)
    {}  
  SPI.transfer (c); 
  }  // end of sendByte
  
// send a null-terminated string to the uVGA
void sendString (const char * str)
  {
char c;
  digitalWrite (ssPin, LOW);   // select device
  for (const char * p = str; c = *p; p++)
    sendByte (c);
  digitalWrite (ssPin, HIGH);  // deselect 
  }  // end of sendString
  
const char messageStr [] = "Hello, world!\r\n";

void loop()                     
{
  sendString (messageStr);

  char buf [30];
  sprintf (buf, "Time elapsed: %ld\r\n", millis ());
  sendString (buf);
  
  delay (200);
}  // end of loop

Tricky aspects:

  • The device samples the SPI signal on high-to-low transition of SCK which is SPI mode 1.
  • You must check the “ready” pin before sending or data will be lost

Thanks for your code sample. I will try it asap.

Thanks,

Royal

I gave your code a try and it worked great. Thank you so much. This will be of great help to me. I can experiment with the code and see what I can learn.

Thanks,

Royal

Glad it works. I'm trying to get the keyboard working, with only partial success. I'll let you know.

For new library see:

http://arduino.cc/forum/index.php/topic,101698

I think this is the code I used to get the keyboard to work. This in not the proper code for it but it worked. It needs to be changed so it will not repeat.

/* http://www.MicroVGA.com/arduino

This sketch is very basic test of the MicroVGA.

Before running it, please make sure the MicroVGA is connected properly to the arduino and it is configured for SPI mode using built-in setup tool.

*/

int pin_cs = 8; int pin_sck = 13; int pin_rdy = 9; int pin_mosi = 12; int pin_miso = 11;

// The setup() method runs once, when the sketch starts

void setup() { // initialize the digital pins used for the MicroVGA pinMode(pin_cs, OUTPUT); pinMode(pin_sck, OUTPUT); pinMode(pin_mosi, OUTPUT); pinMode(pin_miso, INPUT); }

// the loop() method runs over and over again, // as long as the Arduino has power

void loop() { int i;

digitalWrite(pin_cs, LOW);

// wait for a second // this is required to make sure the MicroVGA is idle // normally there would be loop, but to keep this // sketch simple, we have replaced it with delay delay(1000);

{ digitalWrite(pin_mosi, i&1 ? LOW : HIGH); delay(10); // wait for a while digitalWrite(pin_sck, LOW); delay(10); // wait for a while digitalWrite(pin_sck, HIGH); delay(10); // wait for a while digitalWrite(pin_sck, LOW); } }

The library I developed (link above) handles keyboard input. It also handles backspace and echoing what you type to the screen.