Go Down

Topic: Secons Microvga dumb terminal. (Read 2266 times) previous topic - next topic

Royal

Apr 01, 2012, 01:57 am Last Edit: Apr 01, 2012, 09:39 pm by Royal Reason: 1
I am new to Ardunio and would like some code for a Secons Microvga to display text on a monitor.

Nick Gammon

Please edit your post and get rid of the all caps (subject line too).
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

robtillaart

(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 ...
Code: [Select]

//
//    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);
}

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Royal

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

robtillaart


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

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Nick Gammon

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):

Code: [Select]
SPI.begin ();

And then to display stuff:

Code: [Select]
 
  // 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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Royal

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

Nick Gammon

Hard to say until mine arrives. Maybe a brief delay after sending each byte? Can you post the code you actually tried?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

P18F4550

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

Royal

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

Nick Gammon

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

Wiring:

Code: [Select]
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

Code: [Select]

// 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


Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Royal

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

Thanks,

Royal

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

Nick Gammon

Glad it works. I'm trying to get the keyboard working, with only partial success. I'll let you know.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up