hallo, die helligkeit des balken wird
durch den widerstand bestimmt der vor dem antenneneingang liegt.
die graustufen/schwarz/weiss werden von 0,3v bis 1v geregelt.
je nachdem über welchen pin die daten geschickt werden kann man verschiedene
grautöne erzeugen, es kommt auch auf die einstellung des fernsehers an.
bei 0v bis 0,2v wird der elektrodenstrahl dunkel, für den rücklauf (sync-pin).
ich habe jetzt mal alle herausgenommen (weiss/schwarz), trotzdem erscheint der balken
unverändert.
mfg pebisoft
Code:
//video gen
//D.5 is sync:1000 ohm + diode to 75 ohm resistor
//D.6 is video:330 ohm + diode to 75 ohm resistor
#include <inttypes.h>
#include <stdio.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
// cycles = 63.625 * 8 Note NTSC is 63.55
// but this line duration makes each frame exactly 1/60 sec
// which is nice for keeping a realtime clock
#define lineTime 509 // Timer1 Match Value (8 MHz /1 --> 0.000000125 s/cyc
// * 509 ---> 0,000063625 s
//#define ScreenTop 30 // first visible line
//#define ScreenBot 230 // last visible line
#define ScreenTop 100 // first BAR line
#define ScreenBot 150 // last BAR line
//NOTE that the first line of CHARs must be in registers!
char syncON, syncOFF;
//char v1, v2, v3, v4, v5, v6, v7, v8;
register unsigned char v1 asm ("r3");
register unsigned char v2 asm ("r4");
register unsigned char v3 asm ("r5");
register unsigned char v4 asm ("r6");
register unsigned char v5 asm ("r7");
register unsigned char v6 asm ("r8");
register unsigned char v7 asm ("r9");
register unsigned char v8 asm ("r10");
unsigned char bMask;
int i,LineCount, time;
char screen[800], t, ts[10], temp;
// ---------------------------------------------------------------------
//This is the sync generator. It MUST be entered from
//sleep mode to get accurate timing of the sync pulses
//At 8 MHz, all of the sync logic fits in the 5 uSec sync
//pulse
//interrupt [TIM1_COMPA] void t1_cmpA(void)
// ---------------------------------------------------------------------
//SIGNAL (SIG_OVERFLOW1)
SIGNAL (SIG_OUTPUT_COMPARE1A)
{
PORTD = syncON; //start the Horizontal sync pulse
TCNT0 = 0; //count timer 0 at 1/usec
LineCount++ ; //update the curent scanline number
switch (LineCount)
{
// case 295: //inverted (Vertical) synch after line 247 NTSC
case 160: //inverted (Vertical) synch after line 295 PAL
syncON = 0b00100000;
syncOFF = 0;
break;
// case 299: //back to regular sync after line 250 NTSC
case 314: //back to regular sync after line 299 PAL
syncON = 0;
syncOFF = 0b00100000;
break;
// case 313: //start new frame after line 262 NTSC
case 348: //start new frame after line 313 PAL
LineCount = 1;
break;
default: break;
}
PORTD = syncOFF; // sync pulse
}
// ---------------------------------------------------------------------
// set up the ports and timers M A I N
// ---------------------------------------------------------------------
int main(void)
{
//init timer 1 to generate sync
OCR1A = lineTime; //One NTSC line (509)
TCCR1B = 9; //full speed; clear-on-match MEGA163
TCCR1A = 0x00; //turn off pwm and oc lines
TIMSK = 0x10; //enable interrupt T1 cmp
//init ports
DDRD = 0xf0; //video out and switches
//D.5 is sync:1000 ohm + diode to 75 ohm resistor
//D.6 is video:330 ohm + diode to 75 ohm resistor
//init timer 0 to 1/uSec 1 MHZ
TCCR0 = 2;
//initialize synch constants
LineCount = 1;
syncON = 0b00000000;
syncOFF = 0b00100000;
//init software timer
t = 0;
time = 0;
//enable sleep mode
MCUCR = 0b10000000;
//#asm ("sei");
sei();
//The following loop executes once/video line during lines
//1-230, then does all of the frame } processing
while(1)
{
// stall here until next line starts
// sleep enable; mode=idle
// use sleep to make entry into sync ISR uniform time
asm volatile ("sleep");
if ((LineCount < ScreenBot) && (LineCount > ScreenTop))
{
//Balken zeichnen
}
} //while
return(0);
} //main
mfg pebisoft
Lesezeichen