當前位置:編程學習大全網 - 編程語言 - 數字屏幕編程

數字屏幕編程

8位數碼管動態顯示,單片機直接選片,先顯示201903,再顯示abcdef,再顯示123456,用C語言編程,重復循環,試仿真。

# include & ltreg 51 . h & gt;

#定義uchar無符號字符

//這個表是LED的字體0?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?答?b?c?d?英·法

無符號字符碼LED7Code[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x 71 };

無效延遲(uchar z)

{

uchar i,j;

for(I = 0;我& lt120;i++)

for(j = 0;j & ltz;j++);

}

void main()

{

uchar k;

while(1)

{

for(k = 0;k & lt50;k++)

{

P0 = 0xff

P2 = led 7 code[0];

P0 = 0xfe

延遲(5);

P0 = 0xff

P2 = led 7 code[0];

P0 = 0xfd

延遲(5);

P0 = 0xff

P2 = led 7 code[2];

P0 = 0xfb

延遲(5);

P0 = 0xff

P2 = led 7 code[0];

P0 = 0xf7

延遲(5);

P0 = 0xff

P2 = led 7 code[1];

P0 = 0xef

延遲(5);

P0 = 0xff

P2 = led 7 code[9];

P0 = 0xdf

延遲(5);

P0 = 0xff

P2 = led 7 code[0];

P0 = 0xbf

延遲(5);

P0 = 0xff

P2 = led 7 code[3];

P0 = 0x7f

延遲(5);

}

for(k = 0;k & lt50;k++)

{

P0 = 0xff

P2 = led 7 code[0];

P0 = 0xfe

延遲(5);

P0 = 0xff

P2 = led 7 code[0];

P0 = 0xfd

延遲(5);

P0 = 0xff

P2 = led 7 code[10];

P0 = 0xfb

延遲(5);

P0 = 0xff

P2 = led 7 code[11];

P0 = 0xf7

延遲(5);

P0 = 0xff

P2 = led 7 code[12];

P0 = 0xef

延遲(5);

P0 = 0xff

P2 = led 7 code[13];

P0 = 0xdf

延遲(5);

P0 = 0xff

P2 = led 7 code[14];

P0 = 0xbf

延遲(5);

P0 = 0xff

P2 = led 7 code[15];

P0 = 0x7f

延遲(5);

}

for(k = 0;k & lt50;k++)

{

P0 = 0xff

P2 = led 7 code[0];

P0 = 0xfe

延遲(5);

P0 = 0xff

P2 = led 7 code[0];

P0 = 0xfd

延遲(5);

P0 = 0xff

P2 = led 7 code[1];

P0 = 0xfb

延遲(5);

P0 = 0xff

P2 = led 7 code[2];

P0 = 0xf7

延遲(5);

P0 = 0xff

P2 = led 7 code[3];

P0 = 0xef

延遲(5);

P0 = 0xff

P2 = led 7 code[4];

P0 = 0xdf

延遲(5);

P0 = 0xff

P2 = led 7 code[5];

P0 = 0xbf

延遲(5);

P0 = 0xff

P2 = led 7 code[6];

P0 = 0x7f

延遲(5);

}

}

}?

  • 上一篇:金宇編程
  • 下一篇:為什麽不建議女生學數控
  • copyright 2024編程學習大全網