📄 vx1828_au.c
字号:
//#pragma SRC#include <intrins.h>#include <reg51.h>#include <78e65.H>#include "config.h"#include "pindef.h"#include "osd_VX1828.h"#include "func_shi.h"#include "inVX1828.h"#include "osd.h"#include "globl.h"#include "MENU.H"#include "timer.h"#if _debug#include <stdio.h>#endif#include "ir.h"#include "tda7440d.h"sbit S_PWRON=P4^2; void Time_counter(void);void uart_init();void cpu_init();void open_5v();void init_s35390();//extern void isp_prog();//----------------------------------------------//char data channel=0,last_channel=0;//****************************************************************************unsigned int idata osd_timer=0;unsigned char idata modestatus =0x9c,tempmode=0x9c;char idata temp_data[0x06]={0,0,0,0,0,0};//*****************************************************************************bit XIE_Power = 0;//***********************************************************************************void OSAUX_RAM_EN(char data temp){ if(temp==1){ CHPENR=0x87; CHPENR=0x59; CHPCON=0x10; CHPENR=0x00; } else{ }}//====================================================//===================================================//===================================================void main(){ //unsigned int idata timerdelay1, timerdelay2,timerdelay3; //unsigned int idata checkmtime=0; char tmp=0; #if _debug char tmp1;/// #endif cpu_init(); SP=0X80; #if _debug uart_init(); printf("main begin\n"); #endif OSAUX_RAM_EN(1); LED_R=0; DelayXms(0x10); // waiting ..... sda = 1; scl = 1; DelayXms(0x10); /////////////////////////////////////////////////////////////////// tmp=0x00;//zl.d1.26 shi_sub_write1(0x62, 0x00, &tmp);//timer int1,int2 pin high /////////////////////////////////////////////////////////////////// #if _debug tmp=0x09; shi_sub_write(EEPROM, 0xc0, 00, &tmp); DelayXms(0x30); shi_sub_read(EEPROM,0xc0,00,&tmp1); printf("test dot \n"); if(tmp==tmp1) { printf("The value eeprom 0xc0= %bx ,means that IIC is OK. \n",tmp1); } else{ printf("The IIC isn't OK for eeprom 0xc0=%bx.Stop!!!\n",tmp1); while(1); } #endifRestart2: #if LG printf("the panal is LG.\n"); #endif #if AU printf("the panal is AU.\n"); #endif if (pcc) { #if _debug printf("The program jump Restart2 \n"); #endif // Set initial address of OSD block ,The initial address of Title Block is default 0x00 osd_madr(content,0x30); // Set the initial address of Content Block osd_madr(bottom,0xD0); // Set the initial address of Bottom Block osd_clearall(); osd_hbsection(title,bl,0x00,0x00,0x00,0x00); osd_hbsection(content,bl,0x00,0x00,0x00,0x00); osd_hbsection(bottom,bl,0x00,0x00,0x00,0x00); osd_hbsection(title,hl,0x00,0x00,0x00,0x00); osd_hbsection(content,hl,0x00,0x00,0x00,0x00); osd_hbsection(bottom,hl,0x00,0x00,0x00,0x00); // Set size of block osd_size(title,0x2F,0x01); // Set Title block size osd_size(content,0,0); // Set Content block size adjust by cswu. // Set position of block //osd_pos(title,180,7); // Set Title block position osd_pos(content,0x80,12); // Set Content block position // Select Block Color osd_switch(0x00); // Turn the OSD T/C/B block off osd_blink(0x0f); // Set the OSD blinking rate osd_alpha(0x0d); // Set the OSD transparent #if _debug printf("The program jump Restart.\n"); #endif Reloadsetting(); VX1828ctrl = 1; DelayXms(0x10); BSTctrl = 0; DelayXms(0x20); signal_sel=0; top_sel = 1; pcc = 0; EA=1; #if _debug printf("EA = 1 \n"); TI=0; #endif TR0 = 1; #if _debug printf("open timer0\n");TI=0; #endif top_sel=1; time_sel=1; topmenu_flag = 0; timemenu_flag=0; timeshow_flag=0; britmenu_flag = 0; timemenu_flag=0; //resetreg_flag = 0; //savereg_flag = 0; volshow_flag = 0; } while(1) { timer_on_off();//zl.d 1.5 //timer_on_off();//========================================================= if(!XIE_Power) // run only one time . { #if _debug printf("XIE_Power \n"); #endif XIE_Power = 1; irpower_flag = 0; power_flag = ~power_flag; LED_R=0; #if _debug printf("LED_R on. in if\n");TI=0; #endif if (power_flag) { open_5v(); #if _debug printf("open 5v\n"); #endif tmp=0x5a; shi_sub_write(vx1828, 0x01, 00, &tmp); Init_VX1828();aisel_func(0x86);DelayXms(0x10); // Initial VX1818 init_audio(); init_audio(); init_s35390();//zl.d #if _debug printf("init audio\n"); #endif //BSTctrl = 0; DelayXms(0x30); modestatus=0; pcc = 1; goto Restart2; } else // POWER OFF { open_5v(); VX1828ctrl = 0; DelayXms(0x10); BSTctrl = 1; DelayXms(0x10); set_audio_switch(IN4); LED_R=0; #if _debug printf("LED_R on.in else\n"); #endif #if _debug printf("open 5v\n"); #endif //Clear all menu flag power_flag=0; topmenu_flag = 0; britmenu_flag = 0; volshow_flag = 0; mute_flag = 0; TR0 = 0; EA=1; #if _debug printf("EA = 1 \n"); #endif ir_server(); #if _debug printf("ir_server run\n");TI=0; #endif DelayXms(0xff); // Avoid error repress } #if _debug printf("test dot 2\n");TI=0; #endif } //========================================================== ir_server(); //=========================================================== #if 1 // Check Video mode // check_video_mode(); if (power_flag) { //get status |NOISE |PHALT |IS443 |VPRES |MODE[1:0] |FINEAGC|MVVALID|. DelayXms(0x40); EA=0; shi_sub_read(VX1828,0xD3,0x00,&temp_data[0]);//DelayXms(0x10); //printf("the video_format =%bx\n",video_format); temp_data[0] >>= 2; tempmode= temp_data[0] & 0x03; //get the mode . //EA=1; if (modestatus!=tempmode) { switch(tempmode) { case 0: // PAL N #if _debug printf("the video is PAL-N \n"); #endif //temp_data[0] = hposPN_sel; // Address 0x3c //temp_data[1] = vposPN_sel; // Address 0x3d //temp_data[2] = 0x30; // Address 0x3e //temp_data[3] = 0x1A; // Address 0x3f //temp_data[4] = 0x32; // Address 0x40 //temp_data[5] = 0x7E; // Address 0x41 DelayXms(0x80); //force bule panle . #if LG temp_data[0] = 0x16; shi_sub_write(VX1828,0xC2,0x00,&temp_data[0]);// set TC6 |-| STV_ON | temp_data[0] = 0x79; shi_sub_write(VX1828,0xa6,0x00,&temp_data[0]); temp_data[0] = 0x00; shi_sub_write(VX1828,0xa5,0x00,&temp_data[0]); temp_data[0] = 0x02; shi_sub_write(VX1828,0xC7,0x00,&temp_data[0]);// set TC5 | OEV_MODE[3:0]|-|-|ZOOM_MODE[1:0]| temp_data[0] =0xCD; shi_sub_write(VX1828,0x3c,0x00,&temp_data[0]);// set OS9 | HSHIFT | temp_data[0] =0x03; shi_sub_write(VX1828,0x3d,0x00,&temp_data[0]);// set OS9 | HSHIFT | temp_data[0] =0x0c; shi_sub_write(VX1828,0xc0,0x00,&temp_data[0]);// set OS9 | HSHIFT | #endif #if AU temp_data[0] = 0x02; shi_sub_write(VX1828,0xC7,0x00,&temp_data[0]); #endif #if 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -