/*------------------------------------------------------------------------------
upsd3300_lcd.c
Version:
November 30, 2004 - 2.0 - Initial Release.
Dependencies:
English font loaded into flash mapped into XDATA space at: ENGLISH_FONT_PAGE,
FONT_BASE_ADDRESS
Chinese font loaded into flash mapped into XDATA space at:
CHINESE_FONT_PAGE, FONT_BASE_ADDRESS
Note: The Chinese font only needs to be loaded into flash if the option
ENGLISH_CHINESE_FONT is specified.
Description:
The uPSD3300 Enhanced LCD (ELCD) device driver is intended to provide functions
to initialize the ELCD (GXM12232-1SL) and to display English ASCII characters
only or also Chinese characters. The default compile option is for English
only, but defining "ENGLISH_CHINESE_FONT" results in code compiled to support
English characters and Chinese characters.
The font bit maps for English ASCII characters (0 to 127) are stored in flash
memory and is accessed via a standard lookup. The font bit maps for user
defined Chinese characters are accessed via a special lookup operation.
Note: The lcd_init() function checks the first couple of bytes in the appropriate
location in flash memory to determine if the English font (and Chinese font, if
ENGLISH_CHINESE_FONT is defined) is loaded. If it is not, the message "no font"
is displayed on the LCD and the program execution loops forever in the lcd_init()
function. In this case, the English font file (and the Chinese font file, if
ENGLISH_CHINESE_FONT is defined) should be specified for placement in the
appropriate flash sector in the PSDsoft project under "Merge MCU / DSP Firmware
with PSD". For messages to be displayed on the LCD, the appropriate font files
must be programmed into the flash for use by the printfLCD() function.
Copyright (c) 2004 STMicroelectronics Inc.
This example demo code is provided as is and has no warranty,
implied or otherwise. You are free to use/modify any of the provided
code at your own risk in your applications with the expressed limitation
of liability (see below) so long as your product using the code contains
at least one uPSD product (device).
LIMITATION OF LIABILITY: NEITHER STMicroelectronics NOR ITS VENDORS OR
AGENTS SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
------------------------------------------------------------------------------*/
#include "upsd3300.h"
#include "upsd3300_hardware.h"
#include "stdarg.h"
//#define ENGLISH_CHINESE_FONT // This should be defined if the English/Chinese font
// is supported. If this is not defined, then the
// default is English only support.
//#define ST_LOGO_SUPPORT // This should be defined if the ST logo will be
// displayed on the LCD.
//#define FONT_BASE_ADDRESS 0x8000L
#define FONT_BASE_ADDRESS 0xE000L
#define E_FONT_DETECT_BYTE_0 0x1F //English font
#define E_FONT_DETECT_BYTE_1 0xE0
#define C_FONT_DETECT_BYTE_0 0x80 //Chinese font
#define C_FONT_DETECT_BYTE_1 0x00
//#define ENGLISH_FONT_PAGE 5
#define ENGLISH_FONT_PAGE 0
#define CHINESE_FONT_PAGE 6
xdata unsigned char wm_data _at_ LCD_BASE_ADDR + 0x02; //write data address
xdata unsigned char rm_status _at_ LCD_BASE_ADDR + 0x01; //read command status address
xdata unsigned char wm_command _at_ LCD_BASE_ADDR + 0x00; //write command address
xdata unsigned char ws_data _at_ LCD_BASE_ADDR + 0x06; //write data address
xdata unsigned char rs_status _at_ LCD_BASE_ADDR + 0x05; //read command status address
xdata unsigned char ws_command _at_ LCD_BASE_ADDR + 0x04; //write command address
#ifndef ENGLISH_CHINESE_FONT
unsigned char dot_buffer[14];
#else
unsigned char dot_buffer[32];
#endif
unsigned char ucol = 0; //ucol is a global variable,this point is very important.
unsigned char ulayer = 0; //ulayer is also a global variable,this point is very important.
unsigned char mode = 0; //set the positive or negative display here
#ifdef ST_LOGO_SUPPORT
code unsigned char STlogo[32] = {0x03,0x40,0xc3,0x40,0xe3,0x41,0x33,0x43,0x33,0x46,0x33,0x6c,0x33,0x38,0x33,0x00,0x33,
0x60,0x33,0x7c,0x33,0x1f,0xf3,0x03,0xf3,0x00,0x33,0x00,0x33,0x00,0x33,0x00};
#endif
// Define the bitmaps for letters used to display "no font" if the font is not detected in memory.
code unsigned char nn[14] = {0x80,0x10,0x80,0x1f,0x00,0x11,0x80,0x00,0x80,0x10,0x00,0x1f,0x00,0x10}; // n
code unsigned char oo[14] = {0x00,0x00,0x00,0x0f,0x80,0x10,0x80,0x10,0x80,0x10,0x00,0x0f,0x00,0x00}; // o
code unsigned char ff[14] = {0x00,0x00,0x80,0x10,0xc0,0x1f,0xa0,0x10,0xa0,0x10,0xa0,0x10,0x00,0x00}; // f
code unsigned char tt[14] = {0x00,0x00,0x80,0x00,0xc0,0x0f,0x80,0x10,0x80,0x10,0x80,0x10,0x00,0x08}; // t
#ifdef ENGLISH_CHINESE_FONT
code unsigned char index[159]={//0xB1 & 0xB0 is the internal code of the Chinese character "备" which is the first one in the user self-defined lib
0xB1, 0xB8, 0x00, 0xB1, 0xCF, 0x01, 0xB1, 0xE0, 0x02, 0xB2, 0xE9, 0x03, 0xB4, 0xA2, 0x04, 0xB4, 0xA5, 0x05, 0xB4, 0xD3, 0x06, 0xB4, 0xE6, 0x07, //备毕编查储触从存
0xB5, 0xBD, 0x08, 0xB5, 0xDA, 0x09, 0xB5, 0xF7, 0x0a, 0xB6, 0xAF, 0x0b, 0xB7, 0xA2, 0x0c, 0xB9, 0xAB, 0x0d, 0xB9, 0xB2, 0x0e, 0xBA, 0xCD, 0x0f, //到第调动发公共和
0xBA, 0xCF, 0x10, 0xBB, 0xBB, 0x11, 0xBB, 0xD8, 0x12, 0xBB, 0xF9, 0x13, 0xBC, 0xC7, 0x14, 0xBC, 0xE4, 0x15, 0xBC, 0xFE, 0x16, 0xBE, 0xAD, 0x17, //合换回基记间件经
0xBF, 0xB4, 0x18, 0xC1, 0xEE, 0x19, 0xC2, 0xBC, 0x1a, 0xC2, 0xEB, 0x1b, 0xC3, 0xC7, 0x1c, 0xC6, 0xDA, 0x1d, 0xC6, 0xF7, 0x1e, 0xC7, 0xD0, 0x1f, //看令录码们期器切
0xC7, 0xF8, 0x20, 0xC8, 0xD5, 0x21, 0xC9, 0xBE, 0x22, 0xC9, 0xE8, 0x23, 0xCA, 0xB1, 0x24, 0xCA, 0xBE, 0x25, 0xCA, 0xC2, 0x26, 0xCD, 0xEA, 0x27, //区日删设时示事完
0xCE, 0xC4, 0x28, 0xCE, 0xD2, 0x29, 0xCF, 0xD6, 0x2a, 0xD0, 0xC2, 0x2b, 0xD1, 0xDD, 0x2c, 0xD2, 0xD1, 0x2d, 0xD4, 0xDA, 0x2e, 0xD6, 0xB8, 0x2f, //文我现新演已在指
0xD6, 0xC3, 0x30, 0xD6, 0xD0, 0x31, 0xD7, 0xAA, 0x32, 0xD7, 0xBC, 0x33, 0xD7, 0xE9, 0x34 //置中转准组
};
#endif
//-----------------------------------------------------FOR LCD68------------------------------
/*---------------------------------------------------------------------------------------
Function:
check whether master LCD is busy or not .
Parameters:
none
Note:
none
----------------------------------------------------------------------------------------*/
void BusyCheck(void) // wait until BF is cleared
{
while ((rm_status & 0X80));
}
/*---------------------------------------------------------------------------------------
Function:
check whether slave LCD is busy or not .
Parameters:
none
Note:
none
----------------------------------------------------------------------------------------*/
void BusyCheckSlave(void) // wait until BF is cleared
{
while ((rs_status & 0X80));
}
/*---------------------------------------------------------------------------------------
Function:
send one byte command to master LCD.
Parameters:
i is the user expected command to send to master LCD.
Note:
none
----------------------------------------------------------------------------------------*/
void OutMasterCom( unsigned char i ) // write master command
{
BusyCheck();
wm_command = i;
}
/*---------------------------------------------------------------------------------------
Function:
send one byte command to slave LCD.
Parameters:
i is the user expected command to send to slave LCD.
Note:
none
-----------------------------------------------
SPI.rar_51_51 keil_51 s_spi 51_spi代码
版权申诉
20 浏览量
2022-09-20
15:02:12
上传
评论
收藏 110KB RAR 举报
weixin_42653672
- 粉丝: 93
- 资源: 1万+
最新资源
- GDAL-3.4.3-cp310-cp310-win-amd64.whl
- 基于matlab实现鸡群算法,群体智能算法的一种,立足鸡群的集合特征建立优化过程,与蜂群算法、蛙群算法有相似之处.rar
- 基于matlab实现很好的一个蜂群算法 基于matlab的源程序 从作者那要过来的.rar
- 基于matlab实现多目标优化NSGA3代码.rar
- 基于matlab实现多目标遗传算法(NSGA-III)matlab源代码.rar
- 基于matlab实现多尺度小波分析,用于分析时间多尺度周期
- vscode配置c/c 环境教程
- vscode配置c/c 环境教程
- 基于matlab实现电磁优化计算功能,进行线型规划优化电磁设计.rar
- 基于matlab实现带精英策略的非支配排序遗传算法matlab 源码.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈