|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
包括点、线、圆、矩形、反显、任意位置的读写、汉字字符的写,内容丰富,很有用 ,在产品中已经应用
5 @- |. n5 o8 n# X 0 ^3 H3 T7 B" D: Y
- #include "STM32f10x.h"
- #include "lcd.h"
- #include "delay.h"
- #include "wdg.h"
- //////////////////////////////////////////////////////////////////////////////////
- // STM32F103RB控制LCD19264
- // LCD数据接口 DB0-DB7 PA0--PA7 写:推挽输出,读:上拉输入
- // LCD_CS1 PC9 CS1 CS2:00:左1/3屏,01:中1/3,10:右1/3 推挽输出
- /// LCD_CS2 PB11 推挽输出
- // LCD_E PB0 推挽输出
- // LCD_RW PB1 推挽输出
- // LCD_RS PB10 推挽输出
- //////////////////////////////////////////////////////////////////////////////////
- GPIO_InitTypeDef GPIO_InitStructure;
- /*****************************************************************
- 字库函数
- *******************************************************************/
- void SPI_init(void) // SPI初始化
- {
- SPI_InitTypeDef SPI_InitStructure;
- RCC_APB2PeriphclockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO,ENABLE);
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
- //初始化CS
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- //初始化SCK 推挽复用输出
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- //初始化MISO 输入 上拉输入
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- //初始化MOSI 输出 推挽复用输出
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- 约约约约约
- \ I5 @9 C. R
) ~& j2 {0 a4 J6 N |
|