oscillograph_c51.h

来自「用示波器做系统显示器 最好使用高速单片机」· C头文件 代码 · 共 55 行

H
55
字号
/************************************************************/
/*********         Oscillograph.h s52 driver     *************/
/**********  Written by yinlei---20070825     ****************/
/************************************************************/

/*********************端口定义*******************************/


#define X_POUT P0
#define Y_POUT P2


/*********************外部函数*******************************/

void OscillographDisplay(unsigned char *cftable,unsigned char x,unsigned char y);




/***********************内部函数*****************************/

void CharacterFormerChangerToDot(unsigned char i,unsigned char dat,unsigned char *p_x);
void OscillographDataOut(unsigned char xx,unsigned char yy);



/*********************函数实现*****************************/


void CharacterFormerChangerToDot(unsigned char i,unsigned char dat,unsigned char *p_x)
{
	if(dat&(0x01<<(i%8))) *p_x=i;
	else *p_x=16;		
}
void OscillographDisplay(unsigned char *cftable,unsigned char x,unsigned char y)
{
	unsigned char i,j,temp_x,temp_y;	
	for(temp_y=0;temp_y<15;temp_y++)
		for(i=0;i<2;i++)
			for(j=0;j<8;j++)
			{
				CharacterFormerChangerToDot((i+1)*j,cftable[temp_y*2+i],&temp_x);
				OscillographDataOut(temp_x+x*16,temp_y+y*16);		
			}
}

/**********************底层接口*****************************/

void OscillographDataOut(unsigned char xx,unsigned char yy)
{
	X_POUT=xx;
	Y_POUT=yy;	
}

⌨️ 快捷键说明

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