[PIC®/AVR®/dsPIC®产品] MCC做I2C硬件太难了,一直没动静,还好我会IO模拟的

[复制链接]
996|3
 楼主| zhuomuniao110 发表于 2023-10-21 15:48 | 显示全部楼层 |阅读模式

  1. #include "mcc_generated_files/system/system.h"
  2. #include "oled/oled.h"
  3. #include "oled/oledpic.h"
  4. /*
  5.     Main application
  6. */

  7. int main(void)
  8. {
  9.     float numberfu=12.5;
  10.     SYSTEM_Initialize();

  11.     // If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts
  12.     // If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global Interrupts
  13.     // Use the following macros to:

  14.     // Enable the Global Interrupts
  15.     INTERRUPT_GlobalInterruptEnable();

  16.     // Disable the Global Interrupts
  17.     //INTERRUPT_GlobalInterruptDisable();
  18.     OLED_Init();
  19.     OLED_Allfill();
  20.     OLED_Clear();
  21.     OLED_ShowPic(90,0,122,4,BMP1);
  22.     OLED_ShowHzbig(0,0,0);
  23.         OLED_ShowStr(33,0,"Hello",16);
  24.         HAL_Delay(1000);
  25.         OLED_Clear();

  26.         OLED_ShowFloat(50,0,numberfu,3,16);
  27.         OLED_ShowHanzi(50,2,0);
  28.         OLED_ShowHanzi(34,2,1);
  29.             for(uint32_t number=500;number<600;number++)
  30.         {
  31.                 OLED_ShowNum(80,2,number,4,16);
  32.                 HAL_Delay(10);
  33.         }
  34.         OLED_ShowChar(4,0,'H',16);
  35.         OLED_ShowChar(4,2,'M',16);
  36.         HAL_Delay(2100);
  37.     while(1)
  38.     {
  39.     }   
  40. }


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
598330983 发表于 2023-10-21 19:54 | 显示全部楼层
https://bbs.21ic.com/icview-3334816-1-1.html
参靠你的文件,修改了下,好了。
dongnanxibei 发表于 2023-10-23 17:28 | 显示全部楼层
IO模拟的没硬件的省心啊。
dongnanxibei 发表于 2023-10-23 17:28 | 显示全部楼层
不过IO模拟的更加通用。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

233

主题

3529

帖子

11

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