⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comm.c

📁 CRT显示器的运行程序
💻 C
字号:
#include <reg52.h>
#include "mtv212mn32.h"
#include "comm.h"
#include <intrins.h>


unsigned int Get_hfre_count(void);
unsigned int Get_vfre_count(void);
unsigned char Get_hv_pol(void);
unsigned int  Hex_Hfr_Change(void);
unsigned int Hex_Vfr_Change(void);


unsigned char idata CurrentModel=0;

unsigned int  Get_hfre_count(void)
{   
    unsigned char data a1=0;
    unsigned char data a2=0;  
    a1=XFR_HCNTH;
    a1=a1&0x3f;
    DPH=a1;    
    a2=XFR_HCNTL;
    DPL=a2;
    return(DPTR);
}

unsigned int Get_vfre_count(void)
{
    unsigned char data a3=0;
    unsigned char data a4=0;
    a3=0;
    a3=XFR_VCNTH;
    a3=a3&0x0f;
    DPH=a3;
    a4=XFR_VCNTL;
    DPL=a4;
    return(DPTR);
}

unsigned char Get_hv_pol(void)  
{   	
    unsigned char data a5=0;
    register unsigned char hvpol;
    a5=XFR_HVSTUS;
	a5 &= 0x30;
	if (a5==0x00) hvpol=0x00;
    if (a5==0x20) hvpol=0xf0;
    if (a5==0x10) hvpol=0x0f;
	if (a5==0x30) hvpol=0xff;
    return (a5);
}

/*unsigned int Hex_Hfr_Change(void)
{unsigned int x1,x2,x3;
  unsigned int y1,y2,y3,z;
  //unsigned float Hfreq;
  x1=XFR_HCNTL&0x0f;
  x2=_cror_(XFR_HCNTL,1)&0x0f;
  x3=XFR_HCNTH&0x0f;
  if(x1==0x00)  y1=0;
  else if(x1==0x01) y1=1;
  else if(x1==0x02) y1=2;
  else if(x1==0x03) y1=3;
  else if(x1==0x04) y1=4;
  else if(x1==0x05) y1=5;
  else if(x1==0x06) y1=6;
  else if(x1==0x07) y1=7;
  else if(x1==0x08) y1=8;
  else if(x1==0x09) y1=9;
  else if(x1==0x0a) y1=10;
  else if(x1==0x0b) y1=11;
  else if(x1==0x0c) y1=12;
  else if(x1==0x0d) y1=13;
  else if(x1==0x0e) y1=14;
  else if(x1==0x0f) y1=15;

  if(x2==0x00)  y1=0;
  else if(x2==0x01) y2=1;
  else if(x2==0x02) y2=2;
  else if(x2==0x03) y2=3;
  else if(x2==0x04) y2=4;
  else if(x2==0x05) y2=5;
  else if(x2==0x06) y2=6;
  else if(x2==0x07) y2=7;
  else if(x2==0x08) y2=8;
  else if(x2==0x09) y2=9;
  else if(x2==0x0a) y2=10;
  else if(x2==0x0b) y2=11;
  else if(x2==0x0c) y2=12;
  else if(x2==0x0d) y2=13;
  else if(x2==0x0e) y2=14;
  else if(x2==0x0f) y2=15;
  
  if(x3==0x00)  y1=0;
  else if(x3==0x01) y3=1;
  else if(x3==0x02) y3=2;
  else if(x3==0x03) y3=3;
  else if(x3==0x04) y3=4;
  else if(x3==0x05) y3=5;
  else if(x3==0x06) y3=6;
  else if(x3==0x07) y3=7;
  else if(x3==0x08) y3=8;
  else if(x3==0x09) y3=9;
  else if(x3==0x0a) y3=10;
  else if(x3==0x0b) y3=11;
  else if(x3==0x0c) y3=12;
  else if(x3==0x0d) y3=13;
  else if(x3==0x0e) y3=14;
  else if(x3==0x0f) y3=15;
  z=y1+y2*16+y3*256;
 // Hfreq=128000/(z+1);
  return(z);
}

unsigned int Hex_Vfr_Change(void)
{unsigned int  x1,x2,x3;
  unsigned int y1,y2,y3,z;
  //unsigned float Hfreq;
  x1=old_vfre_count&0x0f;
  x2=_cror_(old_vfre_count,1)&0x0f;
  x3=_cror_(old_vfre_count,2)&0x0f;
  if(x1==0x00)  y1=0;
  else if(x1==0x01) y1=1;
  else if(x1==0x02) y1=2;
  else if(x1==0x03) y1=3;
  else if(x1==0x04) y1=4;
  else if(x1==0x05) y1=5;
  else if(x1==0x06) y1=6;
  else if(x1==0x07) y1=7;
  else if(x1==0x08) y1=8;
  else if(x1==0x09) y1=9;
  else if(x1==0x0a) y1=10;
  else if(x1==0x0b) y1=11;
  else if(x1==0x0c) y1=12;
  else if(x1==0x0d) y1=13;
  else if(x1==0x0e) y1=14;
  else if(x1==0x0f) y1=15;

  if(x2==0x00)  y1=0;
  else if(x2==0x01) y2=1;
  else if(x2==0x02) y2=2;
  else if(x2==0x03) y2=3;
  else if(x2==0x04) y2=4;
  else if(x2==0x05) y2=5;
  else if(x2==0x06) y2=6;
  else if(x2==0x07) y2=7;
  else if(x2==0x08) y2=8;
  else if(x2==0x09) y2=9;
  else if(x2==0x0a) y2=10;
  else if(x2==0x0b) y2=11;
  else if(x2==0x0c) y2=12;
  else if(x2==0x0d) y2=13;
  else if(x2==0x0e) y2=14;
  else if(x2==0x0f) y2=15;
  
  if(x3==0x00)  y1=0;
  else if(x3==0x01) y3=1;
  else if(x3==0x02) y3=2;
  else if(x3==0x03) y3=3;
  else if(x3==0x04) y3=4;
  else if(x3==0x05) y3=5;
  else if(x3==0x06) y3=6;
  else if(x3==0x07) y3=7;
  else if(x3==0x08) y3=8;
  else if(x3==0x09) y3=9;
  else if(x3==0x0a) y3=10;
  else if(x3==0x0b) y3=11;
  else if(x3==0x0c) y3=12;
  else if(x3==0x0d) y3=13;
  else if(x3==0x0e) y3=14;
  else if(x3==0x0f) y3=15;
  z=y1+y2*16+y3*256;
 // Hfreq=128000/(z+1);
  return(z);
}*/

  
/*void Get_Mode_Num(void)
{
  if (hfre_count==old_hfre&&
}
*/


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -