Hitachi Network Adapter H8 User Manual page 47

Lowcost evaluation board
Table of Contents

Advertisement

HTEB1
User manual
keyReadIndex++;
if (keyReadIndex >= cKeyBufSize) keyReadIndex = 0;
return KeyCode;
}
u8 buffer[17] = " KeyCode : 0000 \0";
// convert int to ASCII-HEX
void ShowCode(u16 code)
{
u8 *data, c;
data = &buffer[14];
while (code)
{
*data = '0';
c = code & 0x000f;
if (c)
{
if (c < 10) *data = '0'+c;
else *data = 'A'+c-10;
}
data--;
code >>= 4;
}
LCDWriteLine(1,buffer);
}
void KeyTest(void)
{
u8 c;
u16 KeyCode;
PMR1 |= cKEYCLK;
PMR1 &= ~cKEYDATA;
IEGR1 &= ~0x04;
IENR1 |= 0x04;
set_interrupt_mask(0);
LCDWriteLine(0, "PC-Keyboard-Test");
LCDWriteLine(1, "press any key...");
while (1)
{
if (kbhit())
{
KeyCode = GetKey();
ShowCode(KeyCode);
}
}
}
void main(void)
{
LCDInit();
KeyTest();
}
Issue 0.2
// msg buffer
// last digit = start address
// default = '0'
// check digit
// if > 0 chk for value
// 0..9
// a..f
// next digit
// show result
// P16 irq-input
// P17 i/o-pin
// IRQ_2 on falling edge
// enable IRQ_2
// enable all interrupts
// if new key ...
// get codes
// display code
// init ports and LCD
// go to keyboard test
Page 47
07/2002

Advertisement

Table of Contents
loading

This manual is also suitable for:

H8/tiny 3664fHteb1

Table of Contents