立即注册 登录
返回首页

uid:370934的个人空间

日志

大神帮我看看里下的小程序,依次显示1——8;但是怎么都不行?

已有 583 次阅读2018-7-18 10:10

#include "SH79F166A.h"
#define uchar unsigned char 
#define unit unsigned int
#define fosc12
uchar code TAB[10]={     //
         0xC0,0xF9,0xA4,0xB0,0x99,   //0-4
            0x92,0x82,0xF8,0x80,0x90,   //5-9 
}; 
void delay_ms(uchar ms)
{
    uchar i,j;
 for(i=0;i<ms;i++)
 {
    for(j=0;j<164;j++);
    for(j=0;j<164;j++);
 }
}
void display()
{
    P1=TAB[1];
 P3_7= 0;
 delay_ms(1);
 P3_7=1;
    
 P1=TAB[2];
 P3_6=0;
 delay_ms(1);
 P3_6=1;
 
 P1=TAB[3];
 P3_5=0;
 delay_ms(1);
 P3_5=1;
 
 P1=TAB[4];
 P3_4=0;
 delay_ms(1);
 P3_4=1;
 
 P1=TAB[5];
 P3_3=0;
 delay_ms(1);
 P3_3=1;
 
 P1=TAB[6];
 P3_2=0;
 delay_ms(1);
 P3_2=1;
 
 P1=TAB[7];
 P3_1=0;
 delay_ms(1);
 P3_1=1;
 
 P1=TAB[8];
 P3_0=0;
 delay_ms(1);
 P3_0=1; 

}
main()

   P3SS=0x00;
   P1SS=0x00;
   P1CR=0xFF;
   P3CR=0xFF;
   P1=0xFF;
   P3=0xFF;
   while(1)
   {
     display();
   }     
}


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

返回顶部