Pages: [1] 2   Go Down
Author Topic: Secons Microvga dumb terminal.  (Read 1985 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am new to Ardunio and would like some code for a Secons Microvga to display text on a monitor.
« Last Edit: April 01, 2012, 02:39:24 pm by Royal » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 481
Posts: 18742
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 216
Posts: 13676
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 216
Posts: 13676
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am using SPI.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 481
Posts: 18742
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
SPI.begin ();

And then to display stuff:

Code:
 
  // 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.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 481
Posts: 18742
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


0
Offline Offline
Sr. Member
****
Karma: 7
Posts: 476
what?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 481
Posts: 18742
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Wiring:

Code:
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:
// 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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Thanks,

Royal
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 481
Posts: 18742
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Pages: [1] 2   Go Up
Jump to: