8segled8loop.~c

来自「单片机开发资料光盘-双龙-686M.zip」· ~C 代码 · 共 38 行

~C
38
字号
#include <io8515.h>          
#define uchar unsigned char  
#define uint unsigned int
void delay(uint t)
{
 uint i;
 for (i=0;i<t;i++)
    ;
}
void init_disp(void)         
{
DDRB=0xff;
DDRD=0xff;
PORTB=0x7f;                  
}
void scan(void)              
{
 uchar i,j;
 for (i=0;i<6;i++)            
   {
    j=150;
    do
      {
       PORTD=~(0x01<<i);
       delay(150);                
       PORTD=0xff;
       delay(2100);                
       }
    while(--j);
   }
}
void main(void)                  
{
 init_disp();                   
 for(;;)
 scan();                         
}

⌨️ 快捷键说明

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