21.07.2015 Views

M16C User Manual.pdf

M16C User Manual.pdf

M16C User Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Programmable I/O PortsMitsubishi microcomputers<strong>M16C</strong> / 62 GroupSINGLE-CHIP 16-BIT CMOS MICROCOMPUTER2.15 Programmable I/O Ports2.15.1 OverviewEighty-seven programmable I/O ports and one input-only port are available. I/O pins also serve as I/Opins for built-in peripheral functions.Each port has a direction register that defines the I/O direction and also has a port register for I/O data. Inaddition, each port has a pull-up control register that defines pull-up in terms of 4 bits. The input-only porthas neither direction register nor pull-up control bit.The following is an overview of the programmable I/O ports:(1) Writing to a port registerWith the direction register set to output, the level of the written values from each relevant pin is outputby writing to a port register. The output level conforms to CMOS output. Port P70 and P71 are Nchannel open drain. Writing to the port register, with the direction register set to input, inputs a valueto the port register, but nothing is output to the relevant pins. The output level remains floating.(2) Reading a port registerWith the direction register set to output, reading a port register takes out the content of the port register,not the content of the pin. With the direction register set to input, reading the port register takes outthe content of the pin.(3) Effect of the protection registerData written to the direction register of P9 is affected by the protection register. The direction registerof P9 cannot be easily rewritten.(4) Input-only port_______P85 is used as the input-only port, it also serves as NMI. P85 has no direction register. Pull-up cannot______________be set to this port. As NMI cannot be disabled, an NMI interrupt occurs if a falling edge is input to P85.Use P85 for reading the level input at this time only.(5) Setting pull-upThe pull-up control bit allows setting of the pull-up, in terms of 4 bits, either in use or not in use. For thefour bits chosen, pull-up is effective only in the ports whose direction register is set to input. Pull-up isnot effective in ports whose direction register is set to output.Do not set pull-up of corresponding pin when XCIN/XCOUT is set or a port is used as A-D input.Pull-up can be set for P0 to P3, P40 to P43, P5 in only single-chip mode. Pull-up cannot be set for P0to P3, P40 to P43, P5 in memory expansion and microprocessor modes.446

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

Saved successfully!

Ooh no, something went wrong!