本人本月开发的两块屏幕的驱动和电路原理图;
用了1月
附件中SSD1306和SSD1327的DEMON和原理图;
用Cadence做的原理图;
自都是自己原创;
STM32单片机源程序如下:
- #include "stm32f10x.h"
- #include "delay.h"
- #include "InitGPIO.h"
- #include "Led.h"
- #include "Key.h"
- #include "exti.h"
- #include "iwdg.h"
- #include "timer.h"
- #include "usart.h"
- #include "OLED.h"
- #include "128_LCD.h"
- #include "IIC.h"
- #include "SPI.h"
- /***********&&&&牢记初始化函数&&&&***********/
- int main(void)
- {
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //抢占优先级设置(012)不超过三位;
- uart_init(115200); //串口初始化
-
-
- InitGPIO();
- delay_init();
- SPI2_Init();
- SPI2_SetSpeed(SPI_BaudRatePrescaler_2);
-
- // IIC_Init();
- // OLED_Init();
- // OLED1305_Init();
- // timer2_Init(4999,7199); //TIM=500ms溢出时间
- // timer3_Init(287,499); //TIM=500ms溢出时间
- LCD_Init();
- // TIM3_PWM_Init(899,0); //不分频,PWM频率=72000000/900=80KHz
-
- // IWDG_Init(4,625); //独立看门狗 最大溢出时间为1s
- // EXTIX_Init(); //外部中断1
- // delay_ms(500);
- // WWDG_Init(0x7f,0x5f,WWDG_Prescaler_8); //0x5f上窗口,下窗口0x3f固定的,到达0x4f开启中断执行;0x7f给定
- // OLCD_Clean();
- u16 i=0;
- while(1)
- {
- // Key_up();
- // Led2 = 0;
- OLCD_Drive = 1;
- OLED_display_string_5x8(0,0,0,"5*7ASCII~!@#$%^&*()-+");
- delay_ms(10);
- OLED_display_string_5x8(8,0,0, "abcdefgABCDEFG1234567");
- delay_ms(10);
- for(i=0;i<256;i++)
- {
- LCD_SetContrast(i);
- delay_ms(10);
- }
-
- // SPI2_ReadWriteByte(0x77);
- Led2 = !Led2;
- // OLED_Clear(0xff);
- }
- }
- /***************************************
- // u16 led0pwmval = 0;
- // u8 dir = 1;
- delay_ms(10);
- if(dir) led0pwmval++;
- else led0pwmval--;
-
- if(led0pwmval>300) dir = 0;
- if(led0pwmval==0) dir = 1;
- TIM_SetCompare2(TIM3,led0pwmval); //PWM占空比装载值
- ****************************************/
复制代码
所有资料51hei提供下载:
STM32-OLED2x128_12864.7z
(1.54 MB, 下载次数: 160)
|