Contact Us 
   

IO Port 7 on the H8/3664 Processor

Port 7 is a general I/O port with only three pins also functioning as a timer V I/O pin. The register setting of TCSRV in timer V has priority for functions of pin P76/TMOV. The pins, P75/TMCIV and P74/TMRIV, are also functioning as timer V input ports that are connected to the timer V regardless of the register setting of port 7.

PIN   Alternate Function
P74   TMRIV
P75   TMCRV
P76   TMOV

Two registers control its functions:

• Port control register 7 (PCR7)
• Port data register 7 (PDR7)

There is no mode register since settings in the TimerV control registers override the use of pins in port 7.

PCR7 determines the direction of the pin. If a pin is designated as an IO pin in PMR7, setting a bit in PCR7 to 1 makes the corresponding pin an output, setting it to zero makes the corresponding pin an input.

PDR7 simply holds the output data at the port 7 pins if the pin is configured as an output. Reading a pin while it is configured as an input reads the value at the pin regardless of the value in the PDR7 register.

There are no pullups associated with port 7

After a reset, this port is configured as all general purpose input pins.

Using the header files provided with the GNUH8 toolchain, port 7 and its registers are found in the IO address space and can be accessed using statements like these:

int data;
IO.PCR7 = 0xFF;        // set all pins as outputs
IO.PDR7.BIT.B5 = 1;    // set P75 to 1
data = IO.PDR7.BIT.B6; // read a single bit into an integer variable

You should note that the final statement may not really read the individual bit - it simply reads the whole of PDR7 into data if the optimisation level is anything other than none. Thus you should treat the answer with a little care. The compiler can be trusted to a degree since the optimiser will mask subsequent access to the variable to ensure that the required bit is used.

 

Port 1IO port 1 registers and usage
Port 2IO port 2 registers and usage
Port 5IO port 5 registers and usage
Port 7IO port 7 registers and usage
Port 8IO port 8 registers and usage
Port BIO port B registers and usage
Timer Ausing 8-bit Timer A
Timer Vusing 8-bit Timer V