用的單片機型號是P89V51RD2,數(shù)碼管是共陽極的,我的疑惑是這個main函數(shù)沒有循環(huán)啊,為什么單片機開發(fā)板上的數(shù)碼管數(shù)字卻從0到9
,然后又循環(huán)顯示0到9.
#include <reg51.h>
unsigned int n;
unsigned char tab[]={0x03,0x9f,0x25,0x0d,0x99,0x49,0x41,0x1f,0x01,0x19,0x11,0xc1,0x63,0x85,0x61,0x71};
void delay1ms(unsigned int i)
{
unsigned char j;
while(i--)
{
for(j=0;j<125;j++);
}
}
void main()
{
P1=0x10;
for(n=0;n<10;n++)
{ P0=tab[n];
delay1ms(1000);
}
}
for(n=0;n<10;n++)
{ P0=tab[n];
delay1ms(1000);
}
寫的程序是對的啊 你只仿真下試試 開發(fā)板畢竟看不出電路圖
仿真軟件有點問題遇到過
歡迎光臨 (http://www.raoushi.com/bbs/) | Powered by Discuz! X3.1 |