📄 sndslcd.c
字号:
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* sndsLcd.c s3c4510 : version 1.0 */
/* */
/* COMPONENT */
/* */
/* */
/* DESCRIPTION */
/* */
/* */
/* AUTHOR */
/* */
/* */
/* DATA STRUCTURES */
/* */
/* */
/* FUNCTIONS */
/* */
/* LCD Test Program for SNDS100 Board */
/* */
/* DEPENDENCIES */
/* */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* hbahn 09-15-1998 Created initial version 1.0 */
/* in4maker 12-18-1998 Some function added & updated. */
/*************************************************************************/
/*#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "snds.h"
#include "uart.h"
#include "pollio.h"
#include "system.h"
#include "s3c4510.h"
*/
#include "copyright_wrs.h"
#include "stdio.h"
#include "sndsLcd.h"
#include "snds100.h"
#include "vxWorks.h"
#include "ioLib.h"
/*volatile U32 LCD_Addr_Base ;*/
/*
* Function : LCDTest
* Description : LCD Test
*/
void LCDTest(void)
{
Print("-- Waiting Key in ..\n ") ;
Print("Received Data : \n") ;
sndsLCDInit();
/*get_key() ;*/
/*put_byte(get_key()) ;*/
Print("\r >> LCD Test <<") ;
LcdUsrModeSet() ;
LTestPutString("snds100 s3c4510");
Mv2LcdLine();
LTestPutString("snds100 s3c4510");
/* //lPut_byte(get_byte()) ;
Print("\r >> Press Any Key to Quit LCD Test ") ;
do
{
LTestPutString("+- KS32C5000 SNDS Demo Board ..... ") ;
}while( !kbd_hit() ) ;
Print("\r >> LCD Test Finished") ;
LCDInit() ;
lPrint("LCD Test End..") ;
*/
}
void LTestPutString(char *ptr)
{
while(*ptr )
{
lPut_byte(*ptr++ );
WaitLcd(5000);
}
}
/*
* Function : LCDInit
* Description : Initialize LCD
*/
void sndsLCDInit(void)
{
/* Initialize EXTDBWTH : 8Byte Operation
Initialize EXTACON0*/
EXTDBWTH &= 0xFFCFFFFF ;
EXTDBWTH |= DSX0 ;
EXTACON0 = LTCOS0 | LTACS0 | LTCOH0 | LTACC0 ;
/*IT HAS BEEN INITIAL IN BSP*/
/* Initialize*/
WaitLcd(200) ;
/* ---
* Function Set
* Interface Data Length is : 8 bit
* Display Numer of Line is 2
* --- */
LInstRegWrite((UINT8)0x38) ;
WaitLcd(100) ;
/* ---
* Display On/Off Control
* Display On
* NO Cursor Display
* Cursor Blink
* --- */
LInstRegWrite((UINT8)0x0D) ;
WaitLcd(100) ;
/* ---
* Clear Display
* --- */
LInstRegWrite((UINT8)0x01) ;
WaitLcd(100) ;
/* ---
* Cursor or Display Shift
* Shift Left
* --- */
LInstRegWrite((UINT8)0x18) ;
WaitLcd(100) ;
/* ---
* Entry Mode Set
* Increment DD Ram Address
* --- */
LInstRegWrite((UINT8)0x06) ;
WaitLcd(100) ;
ClearLcdDisplay() ;
}
void LcdFill(void)
{
LInstRegWrite((UINT8)0x01) ;
WaitLcd(100) ;
lPrint("AbCdEfGh12345678");
Mv2LcdLine();
lPrint("!@#$%^&*<>,.?/:;");
}
void RegRead(void)
{
UINT8 ReadData ;
ReadData = (UINT8)LINSTRD ;
printf("The Value is: %d\n",ReadData);
}
/*
* Function : LInstRegWrite
* Description : LCD Control Register Write
*/
void LInstRegWrite(UINT8 DATA)
{
UINT8 *LcdInstWrAddr ;
LcdInstWrAddr = (UINT8 *)LINSTWR ;
*LcdInstWrAddr= DATA ;
}
/*
* Function : LInstRegRead, LDataRegRead
* Description : LCD Control Register Write
*/
UINT8 LInstRegRead(void)
{
UINT8 ReadData ;
ReadData = (UINT8)LINSTRD ;
return ReadData ;
}
UINT8 LDataRegRead(void)
{
UINT8 ReadData ;
ReadData = (UINT8)LDATARD ;
return ReadData ;
}
/*
* Function : WaitLcd
* Description : LCD Control Register Write
*/
void WaitLcd(int milisec)
{
int second ;
if (!0) second = milisec * 80 ;/*CACHE_ENABLED 40 by sting*/
while(second--) ;
}
/*
* Function : LcdBusyCheck
* Description : Wait Until LCD Busy Flag is Cleared
*/
void LcdBusyCheck(void)
{
UINT32 ReadData ;
do{
ReadData &= 0x80;
} /*sting 02-7-4 22:45*/
while (!ReadData);
}
/*
* Function : Mv2LcdLine
* Description : Move Second LCD Line
*/
void Mv2LcdLine(void)
{
/*Set DD Ram Address to */
LInstRegWrite((UINT8)0xC0) ; WaitLcd(100) ; /*0xa8 by sting*/
}
/*
* Function : ClearLcdDisplay
* Description : Clear LCD Displayed Character
*/
void ClearLcdDisplay(void)
{
LInstRegWrite((UINT8)0x01) ; WaitLcd(100) ;
lPrint(" <S3C4510 SNDS>") ;
/* Mv2LcdLine() ; /* Change LCD Line to 2'th Line*/
}
/*
* Function : lPut_byte
* Description : LCD Byte Data Write
*/
void lPut_byte(UINT8 DATA)
{
UINT8 *LcdDataWrAddr ;
LcdDataWrAddr = (UINT8 *)LDATAWR ;
/* LcdBusyCheck; */ /*sting 02-7-4 22:35*/
*LcdDataWrAddr= DATA ;
WaitLcd(15) ;
}
/*
* Function : lPrint
* Description : Wait Until LCD Busy Flag is Cleared
*/
void lPrint(char *ptr )
{
while(*ptr )
{
lPut_byte(*ptr++ );
WaitLcd(15) ;
}
}
void l1Print(char *prt)
{
LInstRegWrite((UINT8)0x01) ; WaitLcd(100) ;
lPrint(prt);
Mv2LcdLine() ; /* Change LCD Line to 2'th Line*/
}
void l2Print(char *L1,char *L2)
{
LInstRegWrite((UINT8)0x01) ; WaitLcd(100) ;
lPrint(L1) ;
Mv2LcdLine() ; /* Change LCD Line to 2'th Line*/
lPrint(L2) ;
}
/*
void lfPrint(char *L2,char *fmt,...)
{
va_list argptr;
char temp_buf[LCD_DIGIT_NO];
va_start(argptr, fmt);
vsprintf(temp_buf, fmt, argptr);
LInstRegWrite((UINT8)0x01) ; WaitLcd(100) ;
l2Print(temp_buf,L2);
va_end(argptr);
}
by sting02-7-4 21:57*/
/*
* Function : LcdUsrModeSet
* Description : User Mode LCD Display
* Shifted Display
*/
void LcdUsrModeSet()
{
LInstRegWrite((UINT8)0x30) ; WaitLcd(100) ;
LInstRegWrite((UINT8)0x01) ; WaitLcd(100) ; /* Clear*/
LInstRegWrite((UINT8)0x8F) ; WaitLcd(100) ;
/* ---
* Entry Mode Set
* Increment DD Ram Address
* Shift Character
* --- */
LInstRegWrite((UINT8)0x07) ; WaitLcd(100) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -