User`s manual

RX62N Group, RX621 Group 4. Library Reference
4) R_IO_PORT_Read
Synopsis
Read data from an I/O port.
Prototype
bool R_IO_PORT_Read(
uint16_t data1,
// Port or port pin selection
uint8_t * data2
// Pointer to the variable in which the value shall be stored.
);
Description
Gets the value of an I/O port or I/O port pin.
[data1]
Use either one of the following definition values (from §4.2.3).
One port definition or
One port pin definition.
[data2]
The value will be between 0x00 and 0xFF for a port, 0 or 1 for a pin.
Return value
If the I/O port specification is incorrect, false is returned; otherwise, true is returned.
Category
I/O port
Reference
R_IO_PORT_Set
Remarks
If an invalid port or pin is specified, the operation of the function cannot be guaranteed.
The input buffer for the specified port or pin must be switched on (see R_IO_PORT_Set).
Program example
/* RPDL definitions */
#include "r_pdl_io_port.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
void func( void )
{
uint8_t data;
/* Get the value of port pin P12 */
R_IO_PORT_Read(
PDL_IO_PORT_1_2,
&data
);
/* Get the value of port 4 */
R_IO_PORT_Read(
PDL_IO_PORT_4,
&data
);
}
R20UT0084EE0112 Rev.1.12 Page 4-33
July. 16, 2014