16灰阶LCM 270X160分辨率FSTN液晶显示屏LCD,ST7586S驱动,6800接口,单块屏3.5英寸,7寸LCM单色屏,可以黑白,4灰阶,16灰阶
外形尺寸:170mmx62mm
玻璃尺寸:167mmx60mm
FPC软排线长度:23mm
单块玻璃尺寸:83.3mmx60mm
两块玻璃对角线尺寸:178mm
7寸LCM单色屏,FSTN屏,双屏显示,单块屏3.5英寸,3.5寸 LCD,270*160分辨率FSTN显示屏,ST7586S驱动,6800接口 10800个
LCD4310021001185001DED ,D18110008,14966-LED-C-A173-20181106 ROHS
GWMS14966 CSM14966D CSM14966D(R)汕头超声液晶显示屏 LCD LCM
3.5寸液晶显示屏,270160 LCD 270X160 LCM 270*160显示屏 3.5英寸屏幕
270X160 高点阵,大尺寸液晶显示屏,双屏显示,单个屏幕3.5英寸,ST7586S,COG液晶模块 LCM LCD 单色屏 STN 6800接口
STM32单片机源程序如下:- #include "S6B0724_i68.h"
- //#include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- #include "delay.h"
- #include "picture.h"
- #include "font5x8.h"
- #define LCD_WIDTH 270
- #define LCD_PAGE 20
- //#define LCD_PORT GPIOB
- #define CS1_CLR GPIO_ResetBits(GPIOC, GPIO_Pin_6)
- #define CS1_SET GPIO_SetBits(GPIOC, GPIO_Pin_6)
- #define DC1_CLR GPIO_ResetBits(GPIOC, GPIO_Pin_7)
- #define DC1_SET GPIO_SetBits(GPIOC, GPIO_Pin_7)
- #define RW1_CLR GPIO_ResetBits(GPIOC, GPIO_Pin_8)
- #define RW1_SET GPIO_SetBits(GPIOC, GPIO_Pin_8)
- #define EN1_CLR GPIO_ResetBits(GPIOC, GPIO_Pin_9)
- #define EN1_SET GPIO_SetBits(GPIOC, GPIO_Pin_9)
- #define RST1_CLR GPIO_ResetBits(GPIOC, GPIO_Pin_10)
- #define RST1_SET GPIO_SetBits(GPIOC, GPIO_Pin_10)
- #define CS2_CLR GPIO_ResetBits(GPIOA, GPIO_Pin_2)
- #define CS2_SET GPIO_SetBits(GPIOA, GPIO_Pin_2)
- #define DC2_CLR GPIO_ResetBits(GPIOA, GPIO_Pin_4)
- #define DC2_SET GPIO_SetBits(GPIOA, GPIO_Pin_4)
- #define RW2_CLR GPIO_ResetBits(GPIOA, GPIO_Pin_5)
- #define RW2_SET GPIO_SetBits(GPIOA, GPIO_Pin_5)
- #define EN2_CLR GPIO_ResetBits(GPIOA, GPIO_Pin_6)
- #define EN2_SET GPIO_SetBits(GPIOA, GPIO_Pin_6)
- #define RST2_CLR GPIO_ResetBits(GPIOA, GPIO_Pin_3)
- #define RST2_SET GPIO_SetBits(GPIOA, GPIO_Pin_3)
- uint8_t buffer[270*20];
- void lcd_gpio_config(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
-
- RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE );
- GPIO_PinRemapConfig( GPIO_Remap_SWJ_JTAGDisable, ENABLE );
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10;
- GPIO_Init(GPIOC, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- }
- void lcd_send_cmd1(unsigned int cmd)
- {
- CS1_CLR;
- DC1_CLR;
- RW1_CLR;
-
- GPIOB->ODR= (GPIOB->ODR & 0xFF) | ((cmd & 0xFF) << 8);
- EN1_SET;
- EN1_CLR;
- CS1_SET;
- }
- void lcd_send_data1(unsigned int dat)
- {
- CS1_CLR;
- DC1_SET;
- RW1_CLR;
-
- GPIOB->ODR= (GPIOB->ODR & 0xFF) | ((dat & 0xFF) << 8);
- EN1_SET;
- EN1_CLR;
- CS1_SET;
- }
- void lcd_reset1(void)
- {
- RST1_CLR;
- delay_ms(10); //keep low, min 1ms
- RST1_SET;
- delay_ms(120); //keep high, min 5ms
- }
- void lcd_send_cmd2(unsigned int cmd)
- {
- CS2_CLR;
- DC2_CLR;
- RW2_CLR;
-
- GPIOB->ODR= (GPIOB->ODR & 0xFF00) | (cmd & 0xFF);
- EN2_SET;
- EN2_CLR;
- CS2_SET;
- }
- void lcd_send_data2(unsigned int dat)
- {
- CS2_CLR;
- DC2_SET;
- RW2_CLR;
-
- GPIOB->ODR= (GPIOB->ODR & 0xFF00) | (dat & 0xFF);
- EN2_SET;
- EN2_CLR;
- CS2_SET;
- }
- void lcd_reset2(void)
- {
- RST2_CLR;
- delay_ms(10); //keep low, min 1ms
- RST2_SET;
- delay_ms(120); //keep high, min 5ms
- }
- void lcd_send_cmd(unsigned int cmd)
- {
- lcd_send_cmd1(cmd);
- lcd_send_cmd2(cmd);
- }
- void lcd_send_data(unsigned int dat)
- {
- lcd_send_data1(dat);
- lcd_send_data2(dat);
- }
- void lcd_reset(void)
- {
- lcd_reset1(); lcd_reset2();
- }
- void lcd_init_registers(void)
- {
- //lcd_send_cmd(0x01); //soft reset
- //delay_ms(120);
- lcd_send_cmd(0x11); //sleep out
- lcd_send_cmd(0x28); //display off
- delay_ms(25);
-
- lcd_send_cmd(0xC0);
- lcd_send_data(0x50);
- lcd_send_data(0x01);
-
- lcd_send_cmd(0xC3);
- lcd_send_data(0x00);
-
- lcd_send_cmd(0xC4);
- lcd_send_data(0x07);
-
- lcd_send_cmd(0xD0);
- lcd_send_data(0x1D);
-
- lcd_send_cmd(0xB3);
- lcd_send_data(0x00);
-
- lcd_send_cmd(0xB5);
- lcd_send_data(0x00);
-
- lcd_send_cmd(0x39); //mono mode
-
- lcd_send_cmd(0x3A);
- lcd_send_data(0x02);
-
- lcd_send_cmd(0x36);
- lcd_send_data(0x00); // COM:C159->C0 SEG: SEG383->SEG0
-
- lcd_send_cmd(0xB1);
- lcd_send_data(0x00);
-
- lcd_send_cmd(0xB0); //duty
- lcd_send_data(0x9F);
- lcd_send_cmd(0x20);
- lcd_send_cmd(0x2A); // Column Address Setting
- lcd_send_data(0x00); // COL0 -> COL127
- lcd_send_data(0x13); //
- lcd_send_data(0x00); //
- lcd_send_data(0x6C); // 80*3=240 pixels
- lcd_send_cmd(0x2B); // Row Address Setting
- lcd_send_data(0x00); // ROW0 -> ROW159
- lcd_send_data(0x00); //
- lcd_send_data(0x00); //
- lcd_send_data(0x9F); // 160 pixels
-
- lcd_send_cmd(0x29);
- }
- uint8_t offsets[] = {6, 3, 0};
- void lcd_update(void)
- {
- lcd_send_cmd(0x2A); // Column Address Setting
- lcd_send_data(0x00);
- lcd_send_data(0x13);
- lcd_send_data(0x00);
- lcd_send_data(0x6C);
-
- lcd_send_cmd(0x2B); // Row Address Setting
- lcd_send_data(0x00);
- lcd_send_data(0x00);
- lcd_send_data(0x00);
- lcd_send_data(0x9F);
-
- lcd_send_cmd(0x2C);
-
- uint8_t temp;
-
- for(uint16_t j=0; j< 160; j++)
- {
- for(uint16_t i=0; i< 90; i++)
- {
- temp = 0x00;
- for(uint16_t z=0; z< 3; z++)
- {
- temp |= ((buffer[j/8 * 270 + i*3 + z] >> (j % 8) & 0x01) ? 0x03 : 0x00) << offsets[z];
- }
-
- lcd_send_data(temp);
- }
- }
- }
- void lcd_write_buffer(int x, int p, int cx, int pc, const uint8_t *data)
- {
- for(int j=0; j< pc; j++)
- {
- for(int i = 0; i< cx; i++)
- {
- buffer[(p + j)*270 + x + i] = data[j*cx + i];
- }
- }
- }
- void lcd_set_buffer(int x, int p, uint8_t data)
- {
- buffer[p*270 + x] = data;
- }
- void lcd_init(void)
- {
- lcd_gpio_config();
- lcd_reset();
- lcd_init_registers();
-
- memset(buffer, 0x00, sizeof buffer);
- }
- void lcd_graphic_test(void)
- {
- int i, j;
-
- //display chess pattern
- for(j=0; j< LCD_PAGE; j++)
- {
- for(i=0; i< LCD_WIDTH; i++)
- {
- lcd_set_buffer(i, j, (i/4)%2 ? 0xF0 : 0x0F);
- }
- }
- lcd_update();
- delay_ms(1000);
-
- //all black.
- for(j=0; j< LCD_PAGE; j++)
- {
- for(i=0; i< LCD_WIDTH; i++)
- {
- lcd_set_buffer(i, j, 0xFF);
- }
- }
- lcd_update();
- delay_ms(1000);
-
- //all white.
- for(j=0; j< LCD_PAGE; j++)
- {
- for(i=0; i< LCD_WIDTH; i++)
- {
- lcd_set_buffer(i, j, 0x00);
- }
- }
- lcd_update();
- delay_ms(1000);
- int nCharIndex = 0;
- for(int i=0; i< 20; i++)
- {
- for(int j=0; j< 270; j++)
- {
- nCharIndex = (i*45 + j/6) % 96;
- buffer[i*270 + j] = (j%6 != 5) ? FONT5x8[nCharIndex][j%6] : 0x00;
- }
- }
- lcd_update();
- delay_ms(1000);
-
- memset(buffer, 0x00, sizeof buffer);
- lcd_write_buffer(20, 0, 228, 20, DEMO);
- lcd_update();
- delay_ms(1000);
-
- memset(buffer, 0x00, sizeof buffer);
- lcd_write_buffer(10, 1, 64, 8, Doraemon);
- lcd_update();
- delay_ms(1000);
- }
复制代码 下载:
STM32单片机LCD270160代码与英文pdf.7z
(865.37 KB, 下载次数: 20)
|