Hitachi Network Adapter H8 User Manual page 34

Lowcost evaluation board
Table of Contents

Advertisement

HTEB1
User manual
}
if (LED_Speed) LED_Speed--;
if (!LED_Speed)
{
LED_Speed = LED_SPEED_INIT;
if (LED_Run)
{
if (LED_Dir)
{
}
else
{
}
}
}
PDR8 = ~LED_Out;
}
void PrepKeyPort(void)
{
PMR1 &= ~KEY_ALL;
PCR1 &= ~KEY_ALL;
PUCR1 |= KEY_ALL;
}
void RunningLightInit(void)
{
PrepKeyPort();
PDR8 = 0xff;
PCR8 = 0xff;
LED_Out = 0x01;
LED_Run = 0x01;
LED_Dir = 0x00;
LED_Speed = LED_SPEED_INIT;
}
/****************************************
TimerA-Interrupt (1s)
increments var c and output
the value of c to LED's (inverted)
****************************************/
interrupt [TIMER_A] void Timer_A_Isr(void)
{
static u8 c;
KeyCheck();
RunningLightUpdate();
IRR1 &= ~0x40;
}
/****************************************
TimerA-Test
setup : CLK/8 (=1µs @ 8MHz) at P10 (TMOW)
1s-Irq-intervall @ SubClock (32.678 Hz)
****************************************/
void Timer_A_Init(void)
{
PCR8 = 0xff;
TMA = 0x0c;
TMA = 0x4b;
PMR1 |= 0x01;
IENR1 |= 0x40;
set_interrupt_mask(0);
}
void main(void)
{
Issue 0.2
LED_Out >>= 1;
if (!LED_Out) LED_Out = 0x80; // if empty, set to 0x80
LED_Out <<= 1;
if (!LED_Out) LED_Out = 0x01; // if empty, set to 0x01
// prepare key-port-bits
// Port1 = I/O (0) for all keys
// Port1 = input(0) for all keys
// PullUps = on for all keys
// prepare LED-port and vars
// start speed
// enable all interrupts
Page 34
// decrement speed counter
// if zero ...
// re init speed counter
// right
// shift right
// shift left
// output (invert)
// all LED's off
// all out's
// start value
// run
// dir = left
// check for key pressed
// clear irq-flag
// P8 = output
// Reset PrescalerW
// CLK/8 on P10, 1/32s-interval (Clk=Prescaler W)
// set TMOW (P10) = Output
// enable TimerA-Interrupt
07/2002

Advertisement

Table of Contents
loading

This manual is also suitable for:

H8/tiny 3664fHteb1

Table of Contents