欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 四位數秒器陳序及電路圖,有點簡陋 [打印本頁]

作者: 醉孤辰    時間: 2017-4-25 20:03
標題: 四位數秒器陳序及電路圖,有點簡陋


  1. #include<reg52.h>
  2. #define uchar unsigned char
  3. #define uint unsigned int
  4. uchar code SegCode[]=
  5. {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
  6. uchar code BitCode[]={0xfe,0xfd,0xfb,0xf7};
  7. uchar DispBuf[4];
  8. uint Count;
  9. void DelayMs(uchar n)
  10. {
  11. uchar j;
  12. while(n--)
  13. {
  14. for(j=0;j<113;j++);
  15. }}
  16. void NumToBuf(void)
  17. {
  18. DispBuf[3]=Count/1000;
  19. DispBuf[2]=Count/100%10;
  20. DispBuf[1]=Count/10%10;
  21. DispBuf[0]=Count%10;
  22. }
  23. void BufToSeg(void)
  24. {
  25. uchar i;
  26. for(i=0;i<4;i++)
  27. {
  28. P0=SegCode[DispBuf[i]];
  29. P2=BitCode[i];
  30. DelayMs(2);
  31. P2|=0x0F;
  32. }}
  33. void main(void)
  34. {
  35. uint k;
  36. while(1)
  37. {
  38. if(++k==220)
  39. {
  40. k=0;
  41. if(++Count==10000)Count=0;
  42. }
  43. NumToBuf();
  44. BufToSeg();
  45. }}
復制代碼





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