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.
Code:#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); }







Zitieren

Lesezeichen