Pages: 1 2 3 [4]   Go Down
Author Topic: VGA output  (Read 22476 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Graynomad Yes, it runs BASIC, a very limited version from the obfuscated C contests!

I was coding away on a bit more advanced version, parallel with a simple emulator running on windows but I got on to other things, so that is stalled at the moment. Don't know where to host that code, can send by mail or something if you like!

All inspired by the VGA lib thanks to @stimmer, great work! Just tried the PAL version on a little car DVD panel with medium succes. It shows very nice stable black and white, but lots of color fringe. I suspect my soldering, will try that again soon.
Also, doesn't composite video need a 75 ohm resistor to ground?

edit: Got the color working with an R 2R ladder made of 68 and 150 ohm resistors, looks much better now.
« Last Edit: April 28, 2013, 02:31:38 am by bensom » Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Composite video only needs the 75 ohm load resistor if the input to the TV is high impedance. Almost all TVs have a 75 ohm input impedance already so the load resistor isn't needed - the TV is the load smiley

According to the data sheet there is a slight output resistance on the digital outs, you may find 82 ohm resistors work better than 68. Try it, it will either look better or worse. I did write a sketch to test how monotonic the DAC is - put a 75 ohm load resistor in place for this (doesn't have to be exactly 75 ohms) and connect the output to analog in 0:
Code:
// array runs lsb to msb, you can add/remove
// values according to the number of resistors
// in your DAC
char pins[]={34,35,36,37,38,39,40,41};

void writeval(int v){
  for(int i=0;i<sizeof(pins);i++){
    digitalWrite(pins[i],v&1);
    v>>=1;
  }
}

void setup() {
  Serial.begin(115200);
  analogReadResolution(12);
  for(int i=0;i<sizeof(pins);i++)
    pinMode(pins[i],OUTPUT);
}

void loop() {
  int l=0;
  for(int i=0;i<(1<<(sizeof(pins)));i++){
    writeval(i);
    delay(10);
    int m=analogRead(0);
    printf("%d : %d  d=%d\n",i,m,m-l);
    if(m<l)printf("!!!!!!ERROR!!!!!!!!!! non-monotonic\n");
    l=m;
  }
  delay(2000);
}

Because of the number of technical compromises that have to be made to get a colour composite signal at all, there will always be a lot of colour fringe. The output signal is way off spec in a number of areas. I aimed low with that project, the goal was VHS quality rather than broadcast quality smiley-wink
Logged


nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8530
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
a very limited version from the obfuscated C contests!
I hope you didn't have to work with the obfuscated source code.

I'm not personally interested in BASIC but it is very popular with many people and might be a way to convert Picaxe and Maximite users to Arduino.

The Maximite has a pretty good interpreter that was/is open source, maybe it's worth porting that across. For that matter there has to be 100s of interpreters around.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Rob, actually, I did de-obfuscate that interpreter, only to find the deobfuscated version when I was done, oh well. A sunday well spent. BASIC on the Due sure made my Apple][ days come back to me!
And yes, there are lots of BASIC interpreters to be found, sure one should fit the arduino due pretty well. I might continue on what I have, if it rains a lot this summer.

Stimmer, I did something similar, but looked at it with the scope, seems decently linear.
Code:
void setup() {
    pinMode(36,OUTPUT);    pinMode(37,OUTPUT);
    pinMode(38,OUTPUT);    pinMode(39,OUTPUT);
    pinMode(40,OUTPUT);    pinMode(41,OUTPUT);
    REG_PIOC_OWER = 0xFFFF;
}
int i=0;
void loop() { // C.4 - C.9
    REG_PIOC_ODSR = i<<4;
    if (++i>64) i=0;
}

I really like the VHS quality on this, 40 columns of text and all that! That space-age, Z80/6502 look smiley
Will try with 82 ohm resistors, but unloaded the voltages seems pretty spot on, according to the composite video wiki page.
Logged

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

Hi everyone,

I have an idea but I not sure if it is possible. Let me to tell you... I imagine that on Arduino Due.

If I am using digital pin to control access to a RAM (address, data, ES and W/R pins ).
I could easier store data in this RAM.

With the VGA lib (modified) I'll enough time to get data from the RAM to built my bitmap or it's just a dream ?

Eddy

Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8530
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Your first problem is that the Due doesn't really support the external memory function because they didn't break out all the pins. You can kludge something up but it's just that, a kludge, and I can't remember what (if any) limitations there are with that approach.

One of the guys has a thread about it on the forum here.

As for the timing I'm not sure, but as you can see it's working with internal RAM, external will be slower but I would think still fast enough.

One question is what will you do with all that RAM, it's not required for a text display or even a lo-res graphic display.

______
Rob


Logged

Rob Gray aka the GRAYnomad www.robgray.com

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

tks about your answer Graynomad,

Of course external RAM will be slower but may be enough to be just a bitmap.
If it's the case we could display a resolution better with more colors.
If you have a RAM you make a kind of double buffering.

About pins I read that Arduino Due have 54 digital I/O pin.
I don't know very well this product but I'm imaging :
10 pins for vga
8 pins for data RAM
and others for addressing RAM and control.



Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8530
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
8 pins for data RAM
and others for addressing RAM and control.

That's sort of correct BUT you have to have the right pins if you want real XM access, and the Arduino team did not see fit to provide them so you will have to dick with the board and solder wires in place.

You can of course bit bang the interface using any old pins but that will be incredibly slow in this context.

As I said though external RAM has been implemented by someone but I can't remember by who or where the post is.

IMO the Due as it stands is not an appropriate platform for hi-res VGA, but if you can properly implement XM it might be OK.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

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

ok tks

I found that

http://arduino.cc/forum/index.php/topic,20025.0.html
« Last Edit: April 29, 2013, 07:12:55 pm by beddy » Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8530
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That thread is about the Mega, an entirely different processor and as such of little use to you with a Due.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino Maker! Introduced at World Maker Faire 2012 'arLCD' the First Dual CPU Arduino Compatible. The 3.5" Color TFT Touchscreen arLCD combining an atMEGA configured like Arduino UNO and a 16 bit CPU running the LCD and a complete GUI widget library.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Stimmer,

Hats off for a job well done. I have a really cool sunlight readable Sharp 6.5" NTSC on my site at EarthMake for $69. It has an RGB input and NTSC timing. This means it should take a lot less bandwidth out of the due because ntsc is only 1.4318 MHz versus 25 MHz for vga. Check it out here:
http://earthmake.com/product/amt-002/
If it's something you want to play with email me at randy at earthlcd com and I'll get you one.

Randy

Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at the VGA library thread (in my sig). NTSC is supported, but the bandwidth for NTSC is actually nearer 6MHz, so needs a sample frequency over 12MHz to generate (I use 14MHz). And as the VGA colour mode is half-resolution I use 14MHz for that too. So the bandwidth is the same, but as NTSC is a more complex signal it actually takes much more out of the Due, not less. (VGA can be done with DMA alone, but NTSC requires processing as well to do the mathematics).
Logged


Pages: 1 2 3 [4]   Go Up
Jump to: