20.07.2015 Views

M16C/62 Group DATASHEET

M16C/62 Group DATASHEET

M16C/62 Group DATASHEET

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Programmable I/O PortMitsubishi microcomputers<strong>M16C</strong> / <strong>62</strong> <strong>Group</strong>SINGLE-CHIP 16-BIT CMOS MICROCOMPUTERProgrammable I/O PortsThere are 87 programmable I/O ports: P0 to P10 (excluding P85). Each port can be set independently forinput or output using the direction register. A pull-up resistance for each block of 4 ports can be set. P85 isan input-only port and has no built-in pull-up resistance.Figures 1.23.1 to 1.23.4 show the programmable I/O ports. Figure 1.23.5 shows the I/O pins.Each pin functions as a programmable I/O port and as the I/O for the built-in peripheral devices.To use the pins as the inputs for the built-in peripheral devices, set the direction register of each pin to inputmode. When the pins are used as the outputs for the built-in peripheral devices (other than the D-A converter),they function as outputs regardless of the contents of the direction registers. When pins are to beused as the outputs for the D-A converter, do not set the direction registers to output mode. See thedescriptions of the respective functions for how to set up the built-in peripheral devices.(1) Direction registersFigure 1.23.6 shows the direction registers.These registers are used to choose the direction of the programmable I/O ports. Each bit in these registerscorresponds one for one to each I/O pin.Note: There is no direction register bit for P85.(2) Port registersFigure 1.23.7 shows the port registers.These registers are used to write and read data for input and output to and from an external device. Aport register consists of a port latch to hold output data and a circuit to read the status of a pin. Each bitin port registers corresponds one for one to each I/O pin.(3) Pull-up control registersFigure 1.23.8 shows the pull-up control registers.The pull-up control register can be set to apply a pull-up resistance to each block of 4 ports. When portsare set to have a pull-up resistance, the pull-up resistance is connected only when the direction register isset for input.However, in memory expansion mode and microprocessor mode, the pull-up control register of P0 to P3,P40 to P43, and P5 is invalid.(4) Port control registerFigure 1.23.9 shows the port control register.The bit 0 of port control resister is used to read port P1 as follows:0 : When port P1 is input port, port input level is read.When port P1 is output port , the contents of port P1 register is read.1 : The contents of port P1 register is read always.This register is valid in the following:• External bus width is 8 bits in microprocessor mode or memory expansion mode.• Port P1 can be used as a port in multiplexed bus for the entire space.166

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!