PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Atmega(8) Testbildgenerator



Andree-HB
05.04.2007, 05:10
Schönes, kleines Projekt :
http://mitglied.lycos.de/polyxos/video.htm

http://mitglied.lycos.de/polyxos/mod8.jpg

flexxo
05.04.2007, 13:07
echt tolles projekt. möchte zur zeit auch ein TV Signal mit nem Atmega erzeugen und bin grad dabei mich mit dem BAS signal etwas vertraut zu machen. hab gestern das erste mal erfolgreich mit WinAVR mein myAVR board programmiert. zuvor benutzte ich nur bascom.

locked
09.04.2007, 19:00
Hallo,
hier ist der Link zum damaligen Kurs 8-[ :

http://www.4freeboard.to/board/thread.php?threadid=26313&page=1&sid=905c97dc6379973ff8834461b7dc4f5d

Ich beschäftige mich zufällig auch Gerade mit der BAS Signal Generierung mittels AVR, jedoch möchte ich das Programm in C realisieren (könnte jedoch fast zu langsam sein)
Auf alle fälle verwirrt mich zurzeit noch die Vertikale Synchronisation.

Mit freundlichen Grüßen

flexxo
10.04.2007, 13:06
Ich habe auch vor es in C zu machen. Im Forum der Elektor HP hat jemand einen C Quelltext reingestellt. Bin noch nicht dazugekommen in zu durchforsten.



#include "sfr_r813.h"

#pragma interrupt Timer_X_int;
#define TIMERVAL 154
#define TIMERVAL_H 77

static volatile unsigned int pal_line_count = 0;
static volatile unsigned char image[700]; //20*35 zeichen
static volatile unsigned int col_counter=0;


//////////////////////////////////////////////////////////////////////////////
void wait(short time)
{
short x;

for(x=0;x<time;x++);

}
//////////////////////////////////////////////////////////////////////////////

void Timer_X_int()
{
if ( ++pal_line_count < 311 ) // 1. Halbbild VSync 311
{
tx=TIMERVAL;

p1=0b00;
wait(1); //4us
p1=0b01;

if (pal_line_count >= 32 && pal_line_count < 292)
{
if(col_counter>=260)
col_counter=0;
col_counter++;
p1=image[col_counter];
}
}


else
{
tx=TIMERVAL_H; //32us


if (pal_line_count < 316) // 1. Halbbild VSync 316
{
p1=0;
wait(1);
p1=1;
}
else if (pal_line_count < 321) // 1. Halbbild VSync 321
{
p1=1;
wait(1);
p1=0;
}
else if (pal_line_count < 325) // 1. Halbbild VSync 325
{
p1=0;
wait(1);
p1=1;
}
else
{
tx=TIMERVAL_H;
p1=0;
wait(1);
p1=1;

pal_line_count = 0;
}
}

}


////////////////////////////////////////////////////////////////////////////
void main(void)
{
unsigned int tmp1,tmp2,tmp3;
/*-----------------------------------------------*/
/* Change on-chip oscillator clock to Main clock */
/*-----------------------------------------------*/
asm("FCLR I");
prc0 = 1; // Protect off
cm13 = 1; // Xin Xout
cm15 = 1; // XCIN-XCOUT drive capacity select bit : HIGH
cm05 = 0; // Xin on
cm16 = 0; // Main clock = No division mode
cm17 = 0;
cm06 = 0; // CM16 and CM17 enable
asm("nop"); // Waiting for stable of oscillation
asm("nop");
asm("nop");
asm("nop");
ocd2 = 0; // Main clock change
prc0=0;
/* On-Chip-Oscillator okay */

prc2 = 1;
pd0 = 0xFF;

pd1 = 0xFF;

asm( "\tFSET I");

txmr = 0x00;

txck0 = 1;
txck1 = 0; //timerfreq auf f/8

prex = 0;
tx=TIMERVAL;

txic = 0x07; //interruptpriorität

//312 bildzeilen "einfärben"
tmp2=0b01;
for(tmp1=0;tmp1<312;tmp1++) //alles schwarz
{
/*if(tmp2==0b01)
tmp2=0b11;
else
tmp2=0b01;*/

image[tmp1]=tmp2;
}
image[7]=0b10; //grau-weiße zeile
image[8]=0b10;
image[9]=0b11;
image[10]=0b11;
image[11]=0b10;
image[12]=0b10;

image[70]=0b10;
image[71]=0b10;
image[72]=0b11;
image[73]=0b11;
image[74]=0b10;
image[75]=0b10;

image[200]=0b10;
image[201]=0b10;
image[202]=0b11;
image[203]=0b11;
image[204]=0b10;
image[205]=0b10;

txs = 1;



while (1);
}

locked
11.04.2007, 13:57
Hallo,

klingt interessant!

vielen Dank für den Hinweis, vielleicht versteh ich jetzt die Vertikalsynchronisation etwas besser ;-)

mfg