標(biāo)題: SSD1306-128x64和SSD1327-128x128 STM32驅(qū)動(dòng)代碼和電路圖 [打印本頁]

作者: dopp    時(shí)間: 2019-3-16 17:10
標(biāo)題: SSD1306-128x64和SSD1327-128x128 STM32驅(qū)動(dòng)代碼和電路圖
本人本月開發(fā)的兩塊屏幕的驅(qū)動(dòng)和電路原理圖;
用了1月
附件中SSD1306和SSD1327的DEMON和原理圖;
用Cadence做的原理圖;
自都是自己原創(chuàng);

STM32單片機(jī)源程序如下:
  1. #include "stm32f10x.h"
  2. #include "delay.h"
  3. #include "InitGPIO.h"
  4. #include "Led.h"
  5. #include "Key.h"
  6. #include "exti.h"
  7. #include "iwdg.h"
  8. #include "timer.h"
  9. #include "usart.h"        
  10. #include "OLED.h"
  11. #include "128_LCD.h"
  12. #include "IIC.h"
  13. #include "SPI.h"

  14. /***********&&&&牢記初始化函數(shù)&&&&***********/
  15. int main(void)
  16. {        
  17.         NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);                                        //搶占優(yōu)先級(jí)設(shè)置(012)不超過三位;
  18.         uart_init(115200);                                        //串口初始化
  19.         
  20.         
  21.         InitGPIO();
  22.   delay_init();
  23.         SPI2_Init();
  24.         SPI2_SetSpeed(SPI_BaudRatePrescaler_2);        
  25.         
  26. //        IIC_Init();

  27. //        OLED_Init();
  28. //        OLED1305_Init();
  29. //        timer2_Init(4999,7199);                //TIM=500ms溢出時(shí)間
  30. //        timer3_Init(287,499);                //TIM=500ms溢出時(shí)間
  31.    LCD_Init();
  32. //        TIM3_PWM_Init(899,0);                                //不分頻,PWM頻率=72000000/900=80KHz
  33.         
  34. //        IWDG_Init(4,625);  //獨(dú)立看門狗 最大溢出時(shí)間為1s
  35. //        EXTIX_Init();                 //外部中斷1
  36. //        delay_ms(500);
  37. // WWDG_Init(0x7f,0x5f,WWDG_Prescaler_8);   //0x5f上窗口,下窗口0x3f固定的,到達(dá)0x4f開啟中斷執(zhí)行;0x7f給定
  38. //        OLCD_Clean();
  39.   u16 i=0;
  40.   while(1)
  41.         {
  42. //                Key_up();
  43. //                Led2 = 0;        
  44.                 OLCD_Drive = 1;
  45.                 OLED_display_string_5x8(0,0,0,"5*7ASCII~!@#$%^&*()-+");
  46.                 delay_ms(10);
  47.     OLED_display_string_5x8(8,0,0,   "abcdefgABCDEFG1234567");
  48.                 delay_ms(10);
  49.                 for(i=0;i<256;i++)
  50.                 {
  51.                         LCD_SetContrast(i);
  52.                         delay_ms(10);
  53.                 }
  54.                
  55. //                SPI2_ReadWriteByte(0x77);
  56.                 Led2 = !Led2;
  57. //   OLED_Clear(0xff);
  58.         }
  59. }

  60. /***************************************
  61.                 //        u16 led0pwmval = 0;
  62.                 //        u8 dir = 1;
  63.                 delay_ms(10);
  64.                 if(dir) led0pwmval++;
  65.                 else led0pwmval--;
  66.                
  67.                 if(led0pwmval>300) dir = 0;
  68.                 if(led0pwmval==0)  dir = 1;
  69.                 TIM_SetCompare2(TIM3,led0pwmval);                        //PWM占空比裝載值
  70. ****************************************/
復(fù)制代碼

所有資料51hei提供下載:
STM32-OLED2x128_12864.7z (1.54 MB, 下載次數(shù): 163)



作者: hilam    時(shí)間: 2019-9-5 23:19
剛好要用,非常感謝!哈哈哈
作者: vikhao    時(shí)間: 2019-9-6 10:40
給我提供了很好地幫助,感謝樓主
作者: vikhao    時(shí)間: 2019-9-6 18:09
下載以后無法開打,是為什么呀




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