Download H8-Tiny SDK+

Transcript
MSC-TEB1
User manual
3.2 LCD
One of the highlights of the MSC-TEB1 is the 2*16 character LCD with
backlight. Simple functions are provided here to demonstrate the usage of
the LCD. Please refer to the LCD manual for further information (e.g.
commands, other character sets etc.).
The demo source contains some definitions to reset and initialise the
display. Then we make some simple write outs.
/***********************************************************************/
/*
*/
/* FILE
:LCDDemo.c
*/
/* DATE
:Sun, Jun 16, 2002
*/
/* DESCRIPTION :Main Program
*/
/* CPU TYPE
:H8/3664F
*/
/*
*/
/* This file is generated by Hitachi Project Generator (Ver.2.1).
*/
/*
*/
/***********************************************************************/
#include "..\mydefs.h"
#include "iodefine.h"
#ifdef __cplusplus
extern "C" {
#endif
void abort(void);
#ifdef __cplusplus
}
#endif
/*-----------------------------------------------------------------** LCDDemo shows some funcions of the LCD on the TinyEvalBoard
** Please refer to LCD datasheet for further details
**-----------------------------------------------------------------*/
void wait(u16 wastetime)
{
while(wastetime--);
}
// local LCD port delay
/*
LCD-Port / Bits on TinyEvalBoard
RS = P75, R/W
= P74, EN
= P20, DATA = P5
*/
// some
#define
#define
#define
#define
#define
#define
defines for easy access
CLEAR_LCD_RS (IO.PDR7.BIT.B5
SET_LCD_RS
(IO.PDR7.BIT.B5
CLEAR_LCD_RW (IO.PDR7.BIT.B4
SET_LCD_RW
(IO.PDR7.BIT.B4
CLEAR_LCD_EN (IO.PDR2.BIT.B0
SET_LCD_EN
(IO.PDR2.BIT.B0
=
=
=
=
=
=
0)
1)
0)
1)
0)
1)
#define LCD_DATA_PORT (IO.PDR5.BYTE)
#define LCD_DATA_CTRL (IO.PCR5)
#define LCD_OUT
#define LCD_IN 0x00
0xff
#define LCD_WAIT
{wait(100);}
void LCDWriteCmd(u8 cmd)
{
Issue 0.2
// write cmd to LCD port
Page 37
05/2002