標(biāo)題: 51單片機(jī)模擬太極八卦陣顯示 點(diǎn)陣屏+LED程序與Proteus仿真圖 [打印本頁(yè)]

作者: ytctrfcxer    時(shí)間: 2022-8-5 00:41
標(biāo)題: 51單片機(jī)模擬太極八卦陣顯示 點(diǎn)陣屏+LED程序與Proteus仿真圖
stc89c52制作的八卦陣計(jì)時(shí)程序,包含仿真和源代碼
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)



單片機(jī)源程序如下:
  1. #include <REGX51.H>
  2. #include <intrins.h>
  3. #define uint unsigned int
  4. #define uchar unsigned char

  5. sbit Elock=P2^0;                                                                //控制眼鎖存
  6. sbit Llock=P2^1;                                                                //控制陰陽(yáng)鎖存
  7. uchar code yang[8]={0x87,0x0f,0x1e,0x3c,0x78,0xf0,0xe1,0xc3};
  8. uchar code eye[8]={0xa5,0x4b,0x96,0x2d,0x5a,0xb4,0x69,0xd2};
  9. uchar i=1;
  10. void delay(unsigned int num)                //延時(shí)函數(shù)
  11. {
  12.         unsigned x, y;
  13.         for(x=num;x>0;x--)
  14.                 for(y=120;y>0;y--);
  15. }

  16. void circle()
  17. {
  18.         Llock=1;                                                                                //鎖存器八個(gè)管腳控制16個(gè)燈
  19.         P1=yang[i];
  20.         Llock=0;
  21.         Elock=1;
  22.         P1=eye[i];
  23.         Elock=0;
  24.         i++;
  25.         if(i==8)                                                                                //數(shù)組循環(huán),陰陽(yáng)相濟(jì)
  26.                 i=0;
  27. }

  28. void main(void)
  29. {
  30.         P1 = 0xff;

  31.         P1=eye[2];
  32.         Elock=1;
  33.         Elock=0;
  34.         P1=yang[2];
  35.         Llock=1;
  36.         Llock=0;

  37.         while(1)
  38.         {
  39.                 circle();
  40.                 delay(999);
  41.         }
  42. }
復(fù)制代碼

所有資料51hei附件下載:
仿真程序.7z (198.21 KB, 下載次數(shù): 40)

作者: lyMarvin    時(shí)間: 2022-8-5 10:46
漂亮,有創(chuàng)意!
作者: myemcu    時(shí)間: 2022-8-5 13:14
這應(yīng)該是先天八卦。。
作者: mengsiu    時(shí)間: 2022-8-5 16:59
看不懂
作者: gaozhaohong    時(shí)間: 2022-8-5 18:09
既有創(chuàng)意,又特別新穎!




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1