HTEB1

User manual

SET_LCD_RW;

LCD_DATA_CTRL = LCD_IN; SET_LCD_EN;

status = LCD_DATA_PORT; CLEAR_LCD_EN; LCD_DATA_CTRL = LCD_OUT; return status;

}

 

void LCDInit(void)

// inits the LCD

{

 

u16 cnt=0;

 

CLEAR_LCD_RS;

 

CLEAR_LCD_RW;

 

CLEAR_LCD_EN;

 

PCR7 = 0x30;

// Set RS+RW = Output

PCR2 = 0x01;

// Set EN = Output

LCD_DATA_CTRL = LCD_OUT;

// Set DDR to Output

//required 3 times pls. ref. data sheet LCDWriteCmd(0x38); // 8Bit-IF, 2 Lines, 5x7 character font while(--cnt);

LCDWriteCmd(0x38); // 8Bit-IF, 2 Lines, 5x7 character font while(--cnt);

LCDWriteCmd(0x38); // 8Bit-IF, 2 Lines, 5x7 character font while(--cnt);

LCDWriteCmd(0x38); // 8Bit-IF, 2 Lines, 5x7 character font while(--cnt);

LCDWriteCmd(0x0c); // DisplayOn, CursorOff, BlinkingOff LCDReadStatus();

LCDWriteCmd(0x06); // Enter Mode, AutoIncrement LCDReadStatus();

LCDWriteCmd(0x14); // MoveCursor right LCDReadStatus();

LCDWriteCmd(0x80); // Set DD RAM Address = 0x00 LCDReadStatus();

}

//writesomedata from 1st position in #line (0/1) void LCDWriteLine(u8 line, u8 *data)

{

LCDWriteCmd(0x80 + line*0x40);

// select line

while (*data)

 

 

 

 

{

 

 

 

 

LCDWriteData(*data);

 

 

 

data++;

 

 

 

 

}

 

 

 

 

}

 

 

 

 

#define cKEYCLK

 

0x40

 

// P16 (IRQ_2)

#define cKEYDATA

0x80

 

// P17

 

#define cKeyBufSize 16

 

 

// input keycode buffsize

u16 KeyCodeBuf[cKeyBufSize];

// input code buffer

u8 keyWriteIndex,keyReadIndex;

// buffer write/read index

u16 outval;

 

 

 

 

u8 outact;

 

 

 

 

// check for odd parity and stopbit

 

 

u8 OddParStopCheck(u16 data)

 

 

 

{

 

 

 

 

u8 pcnt=0;

 

 

 

 

u16 mask=0x0080;

 

 

 

 

if (!(data & 0x0200)) return FALSE;

// check for stopbit

while (mask)

 

 

 

 

{

 

 

 

 

Issue 0.2

Page 45

07/2002

Page 45
Image 45
IBM H8 user manual Setlcdrw Lcddatactrl = Lcdin Setlcden