
HTEB1
User manual
Issue 0.2
Page 36
07/2002
3.2 LCD
One of the highlights of the HTEB1 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.
/*------------------------------------------------------------------
** LCDDemo shows some funcions of the LCD on the TinyEvalBoard
** Please refer to LCD datasheet for further details
**-----------------------------------------------------------------*/
#include "mydefs.h"
// find further includes there!
void wait(u16 wastetime)
// local LCD port delay
{
while(wastetime--);
}
/*
LCD-Port / Bits on TinyEvalBoard
RS
= P75,
R/W
= P74,
EN
= P20,
DATA = P5
*/
// some defines for easy access
#define CLEAR_LCD_RS
(PDR7 &= ~0x20)
#define SET_LCD_RS
(PDR7 |= 0x20)
#define CLEAR_LCD_RW
(PDR7 &= ~0x10)
#define SET_LCD_RW
(PDR7 |= 0x10)
#define CLEAR_LCD_EN
(PDR2 &= ~0x01)
#define SET_LCD_EN
(PDR2 |= 0x01)
#define LCD_DATA_PORT (PDR5)
#define LCD_DATA_CTRL (PCR5)
#define LCD_OUT
0xff
#define LCD_IN 0x00
#define LCD_WAIT
{wait(100);}
void LCDWriteCmd(u8 cmd)
// write cmd to LCD port
{
CLEAR_LCD_RS;
CLEAR_LCD_RW;
SET_LCD_EN;
LCD_DATA_PORT = cmd;
LCD_WAIT;
CLEAR_LCD_EN;
LCD_WAIT;
}
void LCDWriteData(u8 data)
// write data to LCD port
{
SET_LCD_RS;
CLEAR_LCD_RW;
SET_LCD_EN;
LCD_DATA_PORT = data;
LCD_WAIT;
CLEAR_LCD_EN;
LCD_WAIT;
}
Summary of Contents for H8/Tiny 3664F
Page 26: ...HTEB1 User manual Issue 0 2 Page 26 07 2002 ...
Page 27: ...HTEB1 User manual Issue 0 2 Page 27 07 2002 ...
Page 31: ...HTEB1 User manual Issue 0 2 Page 31 07 2002 2 3 Workflow ...
Page 52: ...HTEB1 User manual Issue 0 2 Page 52 07 2002 Appendix B Schematic ...
Page 53: ...HTEB1 User manual Issue 0 2 Page 53 07 2002 Appendix C Board layout ...
Page 54: ...HTEB1 User manual Issue 0 2 Page 54 07 2002 NOTES ...
Page 55: ...HTEB1 User manual Issue 0 2 Page 55 07 2002 NOTES ...