- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
LCD.c
资源名称:str711USB.rar [点击查看]
上传用户:yyyd609
上传日期:2022-07-18
资源大小:183k
文件大小:1k
源码类别:
微处理器开发
开发平台:
C/C++
- #include <stdio.h>
- #include <stdarg.h>
- #include "LCD.h"
- static void Delay(void)
- {
- int i;
- for(i = 0; i < 0x180; i++);
- }
- void LCD_Init(void)
- {
- static const u8 LCD_InitCmd[4]= {0x38, 0x0C, 0x06, 0x01};
- int i;
- GPIO_Config(GPIO2, 0x000F, GPIO_AF_PP);
- EMI_Config(3, EMI_ENABLE | EMI_WAITSTATE(15) | EMI_SIZE_8);
- for(i = 0; i < 4; i++)
- {
- *(vu16*)&LCD_CMD_PORT = LCD_InitCmd[i] << 8 | LCD_InitCmd[i];
- Delay();
- }
- for(i = 0; i < 40; i++)
- Delay();
- }
- void LCD_Goto(int line, int col)
- {
- unsigned cmd = 0x80 | line << 6 | col;
- *(vu16*)&LCD_CMD_PORT = cmd << 8 | cmd;
- Delay();
- }
- void LCD_Putc(char c)
- {
- *(vu16*)&LCD_DAT_PORT = (u8)c << 8 | (u8)c;
- Delay();
- }
- void LCD_Puts(const char *s)
- {
- while(*s)
- {
- *(vu16*)&LCD_DAT_PORT = *s << 8 | *s;
- s++;
- Delay();
- }
- }
- void LCD_Printf(const char *format, ...)
- {
- static char buf[256];
- va_list args;
- va_start(args, format);
- vsprintf(buf, format, args);
- va_end(args);
- LCD_Puts(buf);
- }