第10节:一个用来学习C语言的模板程序
dig_hc595_ds_dr=0;
dig_hc595_sh_dr=0;
delay_short(1);
dig_hc595_sh_dr=1;
delay_short(1);
ucTempData=ucTempData<1;
}
dig_hc595_st_dr=0;
delay_short(1);
dig_hc595_st_dr=1;
delay_short(1);
dig_hc595_sh_dr=0;
dig_hc595_st_dr=0;
dig_hc595_ds_dr=0;
}
void hc595_drive(unsigned char ucLedStatusTemp16_09,unsigned char ucLedStatusTemp08_01)
{
unsigned char i;
unsigned char ucTempData;
hc595_sh_dr=0;
hc595_st_dr=0;
ucTempData=ucLedStatusTemp16_09;
for(i=0;i<8;i++)
{
if(ucTempData>=0x80)hc595_ds_dr=1;
else hc595_ds_dr=0;
hc595_sh_dr=0;
delay_short(1);
hc595_sh_dr=1;
delay_short(1);
ucTempData=ucTempData<1;
}
ucTempData=ucLedStatusTemp08_01;
for(i=0;i<8;i++)
{
if(ucTempData>=0x80)hc595_ds_dr=1;
else hc595_ds_dr=0;
hc595_sh_dr=0;
delay_short(1);
hc595_sh_dr=1;
delay_short(1);
ucTempData=ucTempData<1;
}
hc595_st_dr=0;
delay_short(1);
hc595_st_dr=1;
delay_short(1);
hc595_sh_dr=0;
hc595_st_dr=0;
hc595_ds_dr=0;
}
void T0_time(void) interrupt 1
{
TF0=0;
TR0=0;
if(1==GucVoiceStart)
{
if(GuiVoiceCnt!=0)
{
GuiVoiceCnt--;
beep_dr=0;
}
else
{
beep_dr=1;
GucVoiceStart=0;
}
}
key_scan();
display_drive();
TH0=0xfe;
TL0=0x0b;
TR0=1;
}
void delay_short(unsigned int uiDelayShort)
{
static unsigned int i;
for(i=0;i
}
void initial(void)
{
static unsigned char SucInitialLock=0;
if(0==SucInitialLock)
{
SucInitialLock=1;
key_gnd_dr=0;
led_dr=0;
beep_dr=1;
TMOD=0x01;
TH0=0xfe;
TL0=0x0b;
EA=1;
ET0=1;
TR0=1;
}
}
下节预告:三种类型变量的定义与赋值语句。
C语言模板程序单片 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)