STC8H8K64U

[复制链接]
 楼主| 34af9uc 发表于 2025-7-9 00:13 | 显示全部楼层 |阅读模式
  1. /****************STC8H8K64U,12MHZ******************/
  2. /**************************************************/
  3. /****************ID:共同学习FPGA********************
  4. /****************20250709*************************/
  5. //          ________   ________
  6. //   led_0-|1  P0.0 \_/ P4.5 40|-
  7. //   led_1-|2  P0.1     P2.7 39|-
  8. //   led_2-|3  P0.2     P2.6 38|-
  9. //   led_3-|4  P0.3     P2.5 37|-
  10. //   led_4-|5  P0.4  S  P2.4 36|-
  11. //        -|6  P0.5  T  P2.3 35|-
  12. //        -|7  P0.6  C  P2.2 24|-
  13. //        -|8  P0.7  8  P2.1 33|-
  14. //        -|9  P1.0  H  P2.0 32|-
  15. //        -|10 P1.1  8  P4.4 31|-
  16. //        -|11 P1.4  K  P4.2 30|-
  17. //        -|12 P1.5  6  P4.1 29|-
  18. //        -|13 P1.6  4  P3.7 28|-
  19. //        -|14 P1.7  U  P3.6 27|-
  20. //        -|15 P1.3     P3.5 26|-
  21. //        -|16 UCPA     P3.4 25|-
  22. //        -|17 P5.4     P3.3 24|-
  23. //        -|18 VCC      P3.2 23|-
  24. //        -|19 VREF     P3.1 22|-
  25. //        -|20 GND______P3.0 21|-
  26. /**************************************************/
  27. #include<STC8H.H>
  28. sbit                led_0                                =P0^0;
  29. sbit                led_1                                =P0^1;
  30. sbit                led_2                                =P0^2;
  31. sbit                led_3                                =P0^3;
  32. sbit                led_4                                =P0^4;
  33. /**************************************************/
  34. void                yanshi();                //延时
  35. /**************************************************/
  36. void main()
  37. {
  38. //P2M0,P2M1                0,0准双向;
  39. //P2M0,P2M1                1,0推挽;
  40. //P2M0,P2M1                0,1高阻;
  41. P0M0                |= ((1<<0)+(1<<1)+(1<<2)+(1<<3)+(1<<4));
  42. P0M1                &=~((1<<0)+(1<<1)+(1<<2)+(1<<3)+(1<<4));
  43. while(1)
  44. {
  45. led_0                =1;
  46. led_1                =1;
  47. led_2                =1;
  48. led_3                =1;
  49. led_4                =1;
  50. while(1)
  51.         {
  52.         led_0                =1;
  53.        
  54.         yanshi();
  55.         led_0                =0;
  56.        
  57.         yanshi();
  58.         }



  59. }


  60. }
  61. /**************************************************/
  62. void                yanshi()                //延时;
  63. {
  64. unsigned char x1,x2,x3;
  65. for(x1 =100; x1 >0; x1 --)
  66.         for(x2 =120; x2 >0; x2 --)
  67.                 for(x3 =120; x3 >0; x3 --);
  68. }
  69. /**************************************************/
复制代码


319

主题

487

帖子

63

粉丝
快速回复 在线客服 返回列表 返回顶部