📄 main.c
字号:
/*************************************************************************/
/*版权所有(C) : 北京机械工业学院,北京市机电测控重点实验室 */
/*说明 : ch452键盘与数码管 */
/*文件名 : MAIN.C */
/*处理器 : STC89C58 */
/*版本 : V1.0 */
/*作者 : 谷玉海 */
/*修改 : 谷玉海 */
/*修改日期 : 2006年7月9日 */
/*************************************************************************/
#include "STC89C58.h"
#include "ch452.h"
#include "pin.h"
sbit LED=P1^6;
sbit dat=P1^1;
sbit clk=P1^0;
void delay_50ms(unsigned int t)
{
unsigned int j;
for(;t>0;t--)
for(j=6245;j>0;j--);
}
main()
{
while(1)
{
EA=1;
EX0=1;
IT0=1;
CH452_Write(CH452_SYSON2W); //
CH452_Write(CH452_BCD); // BCD译码,8个数码管
CH452_Write(CH452_DIG0 | 0x1); // 显示字符8
delay_50ms(20);
CH452_Write(CH452_DIG0 | 0x10);
CH452_Write(CH452_DIG1 | 0x2);
delay_50ms(20);
CH452_Write(CH452_DIG1 | 0x10);
CH452_Write(CH452_DIG2 | 0x3);
delay_50ms(20);
CH452_Write(CH452_DIG2 | 0x10);
CH452_Write(CH452_DIG3 | 0x4);
delay_50ms(20);
CH452_Write(CH452_DIG3 | 0x10);
delay_50ms(20);
CH452_Write(CH452_DIG3 | 0x4);
delay_50ms(20);
CH452_Write(CH452_DIG3 | 0x10);
CH452_Write(CH452_DIG2 | 0x3);
delay_50ms(20);
CH452_Write(CH452_DIG2 | 0x10);
CH452_Write(CH452_DIG1 | 0x2);
delay_50ms(20);
CH452_Write(CH452_DIG1 | 0x10);
CH452_Write(CH452_DIG0 | 0x1);
delay_50ms(20);
CH452_Write(CH452_DIG0 | 0x10);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -