📄 main.c
字号:
/*************************************************************
程序名称:示波器OSC
功 能:示波器上显示汉字字符(可移动) PS2 串口调试
日 期:2008.7.19
*************************************************************/
#include <at89x51.h>
//#include<reg52.h> //这里调用reg52.h文件PS2无法用 ????
#include"zifu.h"
#include"PS2.h"
//#include"chuankou.h"
#define uint unsigned int
#define uchar unsigned char
#define XDATALINE P1 //0832输出
#define YDATALINE P2
sbit ZLocation = P3^5;
unsigned char Key_code;
//void put_date(unsigned dat);
unsigned char tabx[10];
unsigned char taby[10];
unsigned char Scale = 2;
unsigned char XOffset =0;
unsigned char YOffset =0;
char XAdd=0;
char YAdd=0;
/***********************************************************
函数名称:
函数功能:确定x坐标
入口参数:
出口参数:
备 注: 120x120
***********************************************************/
void XLocation( unsigned char X )
{
XDATALINE = X;
}
/***********************************************************
函数名称:
函数功能:确定y坐标
入口参数:
出口参数:
备 注: 120x120
***********************************************************/
void YLocation( unsigned char Y )
{
YDATALINE = Y;
}
/***********************************************************
函数名称:
函数功能: 延时
入口参数:
出口参数:
备 注:
***********************************************************/
/*void Delay( unsigned int t )
{
while(t--);
}
*/
/***********************************************************
函数名称:
函数功能:绘一个点
入口参数:
出口参数:
备 注:
***********************************************************/
void DisPoint(unsigned char x,unsigned char y)
{
ZLocation = 1;
XLocation(x);
YLocation(y);
ZLocation = 0;
}
/***********************************************************
函数名称:
函数功能: 显示一个8x16的字符
入口参数:
出口参数:
备 注:
***********************************************************/
void Dis8x16Char (unsigned x, unsigned y,unsigned m)
{
unsigned char i,j,k;
switch(flag)
{
case 1:
YAdd=YAdd-4; //上移四个单位
break;
case 2:
YAdd=YAdd+4; //下移四个单位
break;
case 3:
XAdd=XAdd-4; //左移
break;
case 4:
XAdd=XAdd+4; //右移
break;
}
for(k=0;k<2;k++) //K=0 显示在上8列 K=1 显示在下8列
for(i=0;i<8;i++)
for(j=0;j<8;j++)
{
if((ZIMU[m+j+8*k]>>i)&0x01)
{
DisPoint(x+(j*Scale)+XOffset,(y+(8*k+i)*Scale)+YOffset);
}
else
{
ZLocation = 1;
}
}
flag=0;
}
/***********************************************************
函数名称:
函数功能: 显示一个16x16的字符
入口参数:
出口参数:
备 注:
***********************************************************/
void Dis16x16Char(unsigned x,unsigned y,unsigned char *zifu)
{
unsigned char i,j,k;
for(k=0;k<2;k++)
for(i=0;i<8;i++)
for(j=0;j<16;j++)
{
if((zifu[j+16*k]>>i)&0x01)
{
DisPoint(x+(j*Scale)+XOffset,(y+(8*k+i)*Scale)+YOffset);
}
else
{
ZLocation = 1;
}
}
}
/***********************************************************
函数名称:
函数功能:主函数
入口参数:
出口参数:
备 注:
***********************************************************/
void main( void )
{
// uart_rest();
IT0 = 0; //设外部中断0为低电平触发
EA = 1;
EX0 = 1; //开中断
while(1)
{
Dis8x16Char(192+XAdd,128+YAdd,Key_code);
Dis16x16Char(0+64, 128,huan);
Dis16x16Char(32+64,128,ying);
Dis16x16Char(64+64,128,luo);
Dis16x16Char(96+64,128,tao);
Dis8x16Char(192+XAdd,128+YAdd,Key_code);
if (BF)
{
Decode(KeyV);
}
else
EA = 1; //开中断
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -