标题:
常用ST7657的stc8和stc89R52单片机程序
[打印本页]
作者:
hqueeasic
时间:
2025-8-19 17:33
标题:
常用ST7657的stc8和stc89R52单片机程序
常用ST7657的stc8和stc89R52程序,需要修改MCU头文件以及延迟和对比度。
51hei.png
(30.58 KB, 下载次数: 0)
下载附件
2025-8-19 19:46 上传
#include <stdio.h>
#include <pigpio.h>
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
/************************************************************************/
/* Rpi-ST7565 LCD Connection with 40pin RpiB+ or 26pin RpiB */
/************************************************************************/
/*
Rpi Connector ST7565 LCD
------------------------------
3.3v (Pin01) - LCD Back A
GND (Pin09) - LCD Back K
GND (Pin06) - GND
3.3V (Pin17) - VCC
GPIO10(SPI_MOSI) - SID
GPIO11(SPI_CLK) - SCLK
GPIO24 - A0
GPIO25 - nRST
GPIO08(SPI_CE0N) - nCS */
/************************************************************************/
/************************************************************************/
/* Global Variables */
/************************************************************************/
/* Global SPI bus handle */
static int gx_spihandle = -1;
/* Global position storage for the Cursor */
static uint16_t gw_row = 0;
static uint16_t gw_column = 0;
/* Adafruit White LED ST7565 LCD
128 x 64 pixels
- This needs to be enabled if using the Adafruit version
of the LCD. The problem is with the weird page memory locations.
Also the Number of columns is one on excess of 128.
- Comment this out when using the Normal LCD version which does
not have the changeover in the page memory and the additional line.
*/
//#define ADAFRUIT_ST7565_LCD
/************************************************************************/
/* LCD Pins */
/************************************************************************/
#define LCD_SID 10
#define LCD_SCK 11
#define LCD_A0 24
#define LCD_nRST 25
#define LCD_nCS 8
/************************************************************************/
/* Commands */
/************************************************************************/
#define BLACK 1
#define WHITE 0
#define ST7565_LCD_CMD_DISPLAY_OFF 0xAE
#define ST7565_LCD_CMD_DISPLAY_ON 0xAF
#define ST7565_LCD_CMD_SET_DISP_START_LINE 0x40
#define ST7565_LCD_CMD_SET_PAGE 0xB0
#define ST7565_LCD_CMD_SET_COLUMN_UPPER 0x10
#define ST7565_LCD_CMD_SET_COLUMN_LOWER 0x00
#define ST7565_LCD_CMD_SET_ADC_NORMAL 0xA0
#define ST7565_LCD_CMD_SET_ADC_REVERSE 0xA1
#define ST7565_LCD_CMD_SET_DISP_NORMAL 0xA6
#define ST7565_LCD_CMD_SET_DISP_REVERSE 0xA7
#define ST7565_LCD_CMD_SET_ALLPTS_NORMAL 0xA4
#define ST7565_LCD_CMD_SET_ALLPTS_ON 0xA5
#define ST7565_LCD_CMD_SET_BIAS_9 0xA2
#define ST7565_LCD_CMD_SET_BIAS_7 0xA3
#define ST7565_LCD_CMD_RMW 0xE0
#define ST7565_LCD_CMD_RMW_CLEAR 0xEE
#define ST7565_LCD_CMD_INTERNAL_RESET 0xE2
#define ST7565_LCD_CMD_SET_COM_NORMAL 0xC0
#define ST7565_LCD_CMD_SET_COM_REVERSE 0xC8
#define ST7565_LCD_CMD_SET_POWER_CONTROL 0x28
#define ST7565_LCD_CMD_SET_RESISTOR_RATIO 0x20
#define ST7565_LCD_CMD_SET_VOLUME_FIRST 0x81
#define ST7565_LCD_CMD_SET_VOLUME_SECOND 0x0
#define ST7565_LCD_CMD_SET_STATIC_OFF 0xAC
#define ST7565_LCD_CMD_SET_STATIC_ON 0xAD
#define ST7565_LCD_CMD_SET_STATIC_REG 0x0
#define ST7565_LCD_CMD_SET_BOOSTER_FIRST 0xF8
#define ST7565_LCD_CMD_SET_BOOSTER_234 0
#define ST7565_LCD_CMD_SET_BOOSTER_5 1
#define ST7565_LCD_CMD_SET_BOOSTER_6 3
#define ST7565_LCD_CMD_NOP 0xE3
#define ST7565_LCD_CMD_TEST 0xF0
/************************************************************************/
/* Font Definitions */
/************************************************************************/
/**
* 5x7 LCD font 'flipped' for the ST7565 - public domain
* @note This is a 256 character font. Delete glyphs in order to save Flash
*/
/* Controls the definition of the Font array and character spcing */
//#define FULL_FONT
static const uint8_t gca_font[] =
{
#ifdef FULL_FONT
0x0, 0x0, 0x0, 0x0, 0x0, /* ASC(00) */
0x7C, 0xDA, 0xF2, 0xDA, 0x7C, /* ASC(01) */
0x7C, 0xD6, 0xF2, 0xD6, 0x7C, /* ASC(02) */
0x38, 0x7C, 0x3E, 0x7C, 0x38, /* ASC(03) */
0x18, 0x3C, 0x7E, 0x3C, 0x18, /* ASC(04) */
0x38, 0xEA, 0xBE, 0xEA, 0x38, /* ASC(05) */
复制代码
下载:
st7565c51.zip
(146.5 KB, 下载次数: 0)
2025-8-19 17:32 上传
点击文件名下载附件
比较全的文件试一下肯定有可以的
下载积分: 黑币 -5
作者:
joyb
时间:
2025-8-20 08:26
标题ST7657,内容ST7565,一样?
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1