There is no actual use for it, but it promised back when I bought it, to be much fun. It is my only Ethernet connected microcontroller board (10BaseT only though, but still…) and the board comes with a large amount of RAM (2MB).
Since I nearly forgot how to use it, I better write this down here. I already have RedBoot installed (downloaded from here).
Connection details are: 38400 bps, 1 start and 1 stop bit, no flow control.
+DP83902A - eeprom ESA: 00:02:cb:01:a1:7d
... waiting for BOOTP information
Ethernet eth0: MAC address 00:02:cb:01:a1:7d
Can't get BOOTP info for device!
RedBoot(tm) bootstrap and debug environment [ROM]
Non-certified release, version UNKNOWN - built 21:28:57, Apr 11 2004
Platform: Akizuki H8/3068 Network micom (H8/300H)
Copyright (C) 2000, 2001, 2002, Red Hat, Inc.
RAM: 0x00400000-0x005f4000, [0x00400000-0x005e1000] available
FLASH: 0x00000000 - 0x00080000, 8 blocks of 0x00010000 bytes each.
To Set IP address:
RedBoot> ip_address -l 192.168.11.55/24 -h 192.168.11.53
IP: 192.168.11.55/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.11.53
.53 is the tftp server to use later. .55 is the assigned IP address of the H8 board.
To load a file via tftp:
RedBoot> load lcd_clock.elf
Using default protocol (TFTP)
Entry point: 0x00400000, address range: 0x003fff8c-0x0040add0
The program is from http://uclinux.quake4.jp/uClinux/Chapter5/lcd_clock.elf. Then execute it via
RedBoot> exec 0x00400000
Now booting linux kernel:
Entry Address 0x00400000
Cmdline :
And on the LCD you should see a clock starting at 00:00:00, increasing 1 per second.
Notable issue: If the LCD shows nothing or the board does not power on, turn J1 (Vdd/Vss). Some LCD need one setting, some another one. The original display needs 1-3 and 2-4 connected, another display I have needs 1-2 and 3-4 connected.
And here the main program including how to set an interrupt vector:
#include
#include
#include "h8_sample.h"
#include "h8_lcd.h"
static unsigned char buffer[16] = "";
static int counter = 0;
static unsigned char hour = 0;
static unsigned char minute = 0;
static unsigned char sec = 0;
void Set_Vector( int num, void *vect )
{
void **vvt;
vvt = (void **)0x00FFFD20;
void *jv = 0x5A000000 + vect;
vvt[num] = jv;
}
//
// 8ビットタイマー初期化(100ms)
//
void Init_Timer8(void)
{
T8TCR0.BIT.CKS = 0; // クロック一時停止
T8TCR0.BIT.CMIEB = 0; // CMFBによる割り込み禁止
T8TCR0.BIT.CMIEA = 0; // CMFAによる割り込み禁止
T8TCR0.BIT.OVIE = 0; // OVFによる割り込み禁止
T8TCR0.BIT.CCLR = 1; // コンペアマッチAでクリア
T8TCR1.BIT.CKS = 4; // 8TCNT0コンペアマッチAでカウント
T8TCR1.BIT.CMIEB = 0; // CMFBによる割り込み禁止
T8TCR1.BIT.CMIEA = 1; // CMFAによる割り込み許可
T8TCR1.BIT.OVIE = 0; // OVFによる割り込み禁止
T8TCR1.BIT.CCLR = 1; // コンペアマッチAでクリア
T8TCSR0.BYTE = 0; // クリア
T8TCSR1.BYTE = 0; // クリア
T8TCNT = 0; // カウンタクリア
T8TCORA0 = 249; // 20,000,000 / 64 / 250 = 1250
T8TCORA1 = 124; // 1250 / 125 = 10Hz (100ms)
T8TCR0.BIT.CKS = 2; // 内部クロック20MHz φ/64
}
//
// 8ビットタイマーチャンネル0
// コンペアマッチA1/B1割り込み
//
#pragma interrupt
void int_cmiab1(void)
{
T8TCSR1.BIT.CMFA = 0; // コンペアマッチフラグAクリア
counter++;
if( counter > 9 ) {
counter = 0;
if( ++sec > 59 ) {
sec = 0;
if( ++minute > 59 ) {
minute = 0;
if( ++hour > 23 ) {
hour = 0;
}
}
}
}
}
int main()
{
Set_Vector( 38, int_cmiab1 );
ABWCR.BYTE = 0xFF; // バス8ビットモードに設定
wait20us();
P4DDR.BYTE = 0xFF; // PORT4 = OUTPUT
wait20us();
P5DDR.BYTE = 0x00; // PORT5下位4ビット入力
wait20us();
P5PCR.BYTE = 0x0F; // プルアップ
LCD_Init();
hour = 0;
minute = 0;
sec = 0;
counter = 0;
Init_Timer8();
_sti(); // 割り込み許可
while(1) {
int i;
for( i = 0 ; i < 5 ; i++ ) {
sprintf(buffer, "%02d:%02d:%02d" ,hour, minute, sec);
LCD_Locate(0,0);
LCD_Putstr(buffer);
wait(100);
}
if( ! P5DR.BIT.B0 ) {
if( ++hour > 23 ) hour = 0;
}
if( ! P5DR.BIT.B1 ) {
if( ++minute > 59 ) minute = 0;
}
if( ! P5DR.BIT.B2 ) sec = 0;
if( ! P5DR.BIT.B3 ) break;
}
return 0;
}