初级会员

- 积分
- 53
- 金钱
- 53
- 注册时间
- 2016-8-12
- 在线时间
- 6 小时
|

楼主 |
发表于 2016-8-26 18:32:03
|
显示全部楼层
main函数如下,求高人解答   
#include "stm32f10x.h"
#include "lcd5110.h"
#include "spi_flash.h"
#include "usart.h"
/*
* Function Name : GetGBKCode
* Description : 取GBK内码 数据
* Input : - *c: 输入的GBK内码,如'我'
* Output : - *pBuffer: 存放数据的指针
* Return : None
* Attention : 输入一个GBK内码,取得它的32Byte显示代码并将其存放到一个32byte的显示缓冲pBuffer[]中
*/
void GetGBKCode(unsigned char* pBuffer,unsigned char * c)
{
unsigned char High8bit,Low8bit;
High8bit=*c; /* 取高8位数据 */
Low8bit=*(c+1); /* 取低8位数据 */
//从flash中提取字模并存放到pBuffer中
SPI_FLASH_BufferRead(pBuffer,((High8bit-0xb0)*94+Low8bit-0xa1)*32,32);
}
void write_chinese(unsigned char X, unsigned char Y,uint8_t *str) //uint8_t *str
{
int i;
uint8_t buffer[32];
do
{
GetGBKCode(buffer,str++); /*取字模数据*/
LCD_set_XY(X,Y); //设置字符在LCD屏上显示的位置,X:列 Y:行
for(i = 0;i < 16; i++)
{
LCD_write_byte(buffer[i],1);
}
LCD_set_XY(X,Y+1);
for(i = 16; i < 32; i++)
{
LCD_write_byte(buffer[i],1);
}
X+=16;
}
while(*str!=0);
}
int main(void)
{
uint32_t Writeaddr=0;
uint8_t buffer[32];
USART1_Config();
LCD_GPIO_Configuration();
LCD_init(); //初始化lcd
LCD_clear();//清屏
SPI_FLASH_Init();//初始化SPI_FLASH
write_chinese(0,0,"张宏海");
return 0;
} |
|