1.4.17.3 PORT_PinRead Function

C

bool PORT_PinRead(PORT_PIN pin)

Summary

Read the selected pin value.

Description

This function reads the present state at the selected input pin. The function can also be called to read the value of an output pin if input sampling on the output pin is enabled in MHC.If input synchronization on the pin is disabled in MHC, the function will cause a 2 PORT Clock cycles delay. Enabling the synchronization eliminates the delay but will increase power consumption.

Precondition

The PORT_Initialize() function should have been called. Input buffer (INEN bit in the Pin Configuration register) should be enabled in MHC.

Parameters

Param Description
pin the port pin whose state needs to be read.

Returns

- true - the state at the pin is a logic high.

- false - the state at the pin is a logic low.

Example

bool value;
value = PORT_PinRead(PORT_PIN_PB03);

Remarks

None.