AKI-H8 HD3664F


This page contains Japanese characters.
I have developed a program to get measured data of DSO ( Digital Storage Oscilloscope ). I named the program TDS.exe.

I have microprocessor unit boards made by Akizuki which is type of HD3664F.[12] The board has a RS232 port. So the board can send data to PC by RS232. I will replace DSO with the microprocessor unit, my old TDS310 is noisy because of a big fan for cooling. And I want to measure more than 2 channels at the same time.

I resumed this project again in the end of August 2012. However, I will not be able to program a critical application dependent on assemble level, because I lost the official hardware and programming pdf files by my HDD crush and Renesas does not publish them in site now.

I could download the official hardware manual in Japanese from a site. Akizuki tells that 3694F is faster version of 3664F. But we have not been able to download 3694F manuals from Renesas site now.
11:32 Sep27 GMT+9

Developing environment for 3664F

I checked developing environment for 3664F to write a program for RS232. I list a few sites for referrence.[1][2] My old PCs, 400MHz and 66MHz machines share files with Microsoft Network, so Linux developing environment is not good. To develop H8 software, There are mainly Akizuki, HEW by Hitachi and Best Technology. It seems that BestTechnology's GCC Developer Lite ( GDL ) is better.[3][4] I tried download of GDL more than 5 times. The downloads stopped less than 5 minutes, so I asked to send CD-R. A site decribes some developing environments of HEW4, KPIT, Akizuki and YellowIDE.[5] I downloaded HEW for H8 from Renesas. It took 22m 10s to download the size of 97.6MB. The transfer rate was 73.3 KB/S. I think that BestTechnology's server is poorer than Renesas. My Windows 98 machine failed to install HEW, because the HEW supports Windows 200 later. Both of KPIT and YellowIDE support Windows XP later. Although I installed Windows XP Home edition for GCC Developer Lite, I found an old version of it in a MO disk. I installed ver from file GDLFull1.5.0.33.exe. It seems to work on Windows 98. I read 3664.txt file in the target directory. GDL supports serial commnunication in 3664h. I may write a communication program with PC. GDL had flash writer 2.7 in tool menu.

I downloaded and installed the latest version of GDL. I wrote the process in my old PCs.

AKI-3664 flat microprocessor unit kit

Tbl.1 Parts mounted on part-side
IC1HD64F3664FPH8 microprocessor unit
IC3TA78L05F5V regulator
X1CSTCV16, 0MXJ0C3Ceramic oscillator, 16MHz
X2Crystal 32.768kHzCylindrical

The bord size is 27.8x40.2xt1.6 mm. There are parts on both sides of PWB. All the parts are surface mount type except a crystal of 32.768kHz. Document is written on both sides of A3 sheet. The table shows parts that there are on part side. The C8 and C10 are very small 1x1.8, though their capacity is 1uF. There are RS-232 dricer/receiver and chip capacitors and resistors on the reverse side. The RS-232 driver/receiver, ADM232A charges up ±9V by 0.1uF capacitors. I will design a tiny circuit to try 3664F.

I found my old circuit drawing of AKI-3664. I will rebuild it for my practice.

RS232 cable for writing flash ROM

Tbl.2 Connection of a cross RS232 cable

I have a RS232 cable of 2m long which has female Dsub 9P connector at the both ends. I bought it for interlink between PCs 15 years ago. AKI-3664 flat microprocessor unit shows a base board circuit in the document. The circuit connects TxD with P2 of Dsub 9P connector. A site shows pin assignment of Dsub 9P.[6] It means to use a straight RS232 cable. I checked whether my cable can apply by tester. The table shows the connection. Tektronix's DSO connects cross. I made the cable for Dsub 25P to connect DSO with 66MHz PC before. Akizuki's circuit is NC for P1, P7, P8 and P9. It connects P4 with P6.

Sixth band color code of resistors

Tbl.3 Color code of coefficient of temperature [x10-6/°C]

I had assembled my test circuit board for AKI-3664 flat microprocessor unit kit. A resistor with 6 color bands is on the board. How do you read the color code? The last band is coefficient of temperature.[7]

RS232 commnunication test

I copied a test program to communicate PC from Ref [3]. I built it by GDL. I booted AKI-3664 with a reset SW and a push SW on. I had fixed them for reset, shortening JP2 and JP3 on my base board. I added hyper terminal of Windows 98 from CDROM. I set up COM1 port, and property of the port are 38400bps, none flow control. The others are default by hyper terminal. The microprocessor board replied the same characters, when I inputed them. I can program AKI-3664 now at last.

Tbl.4 Communication function name
NameFunctionDefined name
Initialize sci
Check receiving buffer
Check transmitting buffer
Clear receiving buffer
Clear transmitting buffer
Transmit one byte
Transmit text(null termination)
Transmit binary string
Read a character
Read string
Interrupt SCI

Best Technology offers some usuful functions about RS232 communication. The table shows them.

Convert A/D and send to PC program

Ref [2] shows a source program to send A/D to PC with comments in Japanese,

I will have to think the code to program for my purpose. I think that we should comment in roma-ji or alphabet, considering globalization. We, Japanese programmers owed source programs commented in English for long time.


The above code describes EI to interrupt. EI is defined in an included 3664.h file in target directory.
  1. #define DI asm("orc.b #0xc0,ccr")
  2. #define EI asm("andc.b #0x3f,ccr")
I knew that asm was called in-line assembler.[8] I tried to read a hardware manual from Renesas site. But I could not do by IE6. I restarted XP and downloaded it. ANDC is a mnemonic of "ANDC #xx:3, CCR" and a system command. CCR is condition code register. There are eight addressing modes for registers. # may mean immediate (direct?) addressing. I think that GDL has writen a value at 0x3f. Does EI set up 0 of bit1 of CCR only?[10]
A/D converter of 3664F has 8 channels and 10 bits resolution. If the span of analog input is 5V, the resolution is 5/1024, 4.88mV. It is enough to measure outputs of solar cells. The maximun output is about 1.8V. As for the A/D converter, 3664.h defines as follows,
  1. struct st_ad { /* struct A/D */
  2. unsigned int ADDRA; /* ADDRA */
  3. unsigned int ADDRB; /* ADDRB */
  4. unsigned int ADDRC; /* ADDRC */
  5. unsigned int ADDRD; /* ADDRD */
  6. union { /* ADCSR */
  7. unsigned char BYTE; /* Byte Access */
  8. struct { /* Bit Access */
  9. unsigned char ADF :1; /* ADF */
  10. unsigned char ADIE:1; /* ADIE */
  11. unsigned char ADST:1; /* ADST */
  12. unsigned char SCAN:1; /* SCAN */
  13. unsigned char CKS :1; /* CKS */
  14. unsigned char CH :3; /* CH */
  15. } BIT; /* */
  16. } ADCSR; /* */
  17. union { /* ADCR */
  18. unsigned char BYTE; /* Byte Access */
  19. struct { /* Bit Access */
  20. unsigned char TRGE:1; /* TRGE */
  21. } BIT; /* */
  22. } ADCR; /* */
  23. }; /* */
Tbl.5 Selection of AN channels when scan = 1

H83664 has 4 A/D data registers ( ADDRA, ADDRB, ADDRC, ADDRD ). So it can get 4 results of A/D at once, when scan mode works. ADCSR is A/D Control Status Register. 0x38 ( 00111000 ) means that CKS ( ClocK Seclect ) and SCAN are on, ADIE and ADF are off. I knew that A/D interrupt enable ADIE is disable and A/D flag ADF is off at start. A/D converts fast (70 states ), when CKS is on.

3664.h initializes serial comunication interface SCI3 simply in a function call. It seems to be difficult for me to program SCI3, reading H83664 hardware manual. GDL shows a few source codes to control SCI3 in sci.c.


Tbl.6 SCI3 initialization by SMR register
1 stop

As for SCR3 register, I do not know well. An infinite loop in the above A/D converting sample program is very useful to apply for measurements of photo cells. I had better not use different groups of AN0 and AN4 at the same time, because the both channels use the same register ADDRA.

A/D converter test

I connected AN0 with one of 7P header for a connector. I do not remember why I fitted the 7P connector before. I turned on my board, and measured AN0 by a tester. The output was 0.98V. If A/D works, the open input terminal should be 0V. A/D converter and universal port B use the same pins. The port B seems to be A/D, when ADCSR begins to work.[11] I built the above source and wrote to 3664F. I ran and tried receiving A/D result. But Hyper terminal displays mojibake. I tried no parity instead of even parity. Hyper terminal continued to display, as I expected.

A/D CONV = 1016
A/D CONV = 1017
A/D CONV = 1023

How do I think about? Certainly I also set up 8-N-1 on hyperterminal, when I ran com.c. Register SCR3 seems no to be a point accordign to H83664 hardware manual.

I connected a registor of 6.8k with P1 of 7P header and shortend the other end of the registor with GND. Hyper terminal showed 0. I connected it with 5V, and Hyper terminal showed 1023. It is OK because A/D is 10 bit resolution.

210 -1 = 1023

The AKI-H8/3664F has worked well with two solar cells and two kinds of temperature sensors as well as DSO TDS310 did. CNET and Vector puplished Slip21 for WinXP/7. Slip21 includes RS232 and A/D program writing to the MCU by flash ROM writer. I also publish the circuit drawing of the MCU with mother board.
Revised Oct11

Writing flash ROM times

Flash Writer 5.0 does not write my mot file to the target of H8/3664F now. GDL equips another flash writer FlashSimple. I ran it and FlashSimple showed a lot of warning messages. It seems to be able to communicate with PC at 38400bps, judging from Changing baud rate to 38400 bps of FlashSimple output. It is reasonable because the last program can communicate with PC.

AK-H8/3664F manual sheet says, 'can write more than 100 times'. I wrote less than 10 times in August 2012. I also wrote less than 10 times a few years ago. But I bought it several years ago. The life of writing times decreases in a long time, does it? Strange. However, I knew that FlashSimple can diagnose the writing status.

I was wrong. I changed a part to boot correct. SimpleFlash can write to my target now. I should have read the H8/3664F manual carefully.
11:11 Sep27 GMT+9

Current comsumption of AKI-H8/3664F

I measured current comsumption of AKI-H8/3664F with my addtional circuit while running. Sanwa PC510 indicated 17mA and 35mA at the range of A and mA each. Power LED always lights, when power switch turns on. The VF is 1.928V. The current of the LED is,

(5-1.928)/0.068 = 4.5mA

Therefore, The AKI-H8/3664F board works at 12mA at 5VDC.
10:39 Sep27 GMT+9

The following referrences contain Japanese characters.

[1] 0 to 10.23[V] denatsukei ni shitemiru
[2] H8/3664 ni kahenteikou wo setsuzokusi, denatsu no henka(0 to5[V]) wo 10bit no bunkainou de PC ni soushinsuru
[3] 3664F,3694F de hajimeru H8
[4] GCC Developer Lite han no riten
[5] Heisha CPU kibanyou program kaihatsu kankyou, kakushu download
[6] RS232C (EIA-574 no pin wariate)
[7] Teikouki
[8] GCC Inline Assembler
[9] H83664 hardware manual, p58
[10] H83664 hardware manual, p88
[11] H83664 hardware manual, p148

Biwa Lake JAPAN   aboutMe
© 2011 Enoki