跳转到主内容
Knowledgebase
Home
Renesas Electronics China - Knowledgebase

Can I use all 8 bit ports as input port regardless of ADCSR?

Latest Updated:03/26/2009

Question:

The port B is both used as analog input pin. When using port B as input port of 8 bit, one bit (PB0/AN0 pin is set to AN0 at the initial value) always reads 0. Can I use all 8bit ports as input port regardless of ADCSR.

Answer:

The port B is cannot be used all of 8 bit as input port at the same time. At least 1 bit must be set to analog input pin. If you want to use all port B as 8bit input port, the following procedures are needed.

(1) read the port data which is set to other than analog input channel

(2) then, shift analog input channel to another pin by changing CH2-CH0 in ADCSR.

(3) read the data of the pin which becomes input state through (2) process.

(4) mix the data gotten from (1) and (3), then can be used as 8 bit input port data.

Suitable Products
H8/300H Tiny
H8/36109
H8/36077, H8/36079
H8/36049
H8/36014, H8/36024
H8/3694
H8/3687
H8/3672
H8/3664