📄 led.c
字号:
/**************************************************************************
By ZhuTao
***************************************************************************/
#include "adc0809.c"
#define LED_Data P2
sbit LED1=P3^0;
sbit LED2=P3^1;
sbit LED3=P3^2;
sbit LED4=P3^3;
#define LED_slect P3
static uchar dispdata[4];
void decodenum(float adv)
{
uint temp;
temp=(uint)(adv*10);
dispdata[0]=temp/10;
dispdata[1]=temp%10;
dispdata[2]=10;
dispdata[3]=11;
}
void select(uchar LED)
{
switch(LED)
{
case 0:LED1=0;break;
case 1:LED2=0;break;
case 2:LED3=0;break;
case 3:LED4=0;break;
default: LED_slect=0xff;
}
}
void dispone(uchar LED,uchar number) //,number 0--9
{
select(LED);
LED_Data=num[number]|0x80;
delayus(300);
LED_slect=0xff;
}
void disp()
{
uchar i;
for(i=0;i<4;i++)
{
dispone(i,dispdata[i]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -