1.2.17.3 1.3.19.3 1.4.17.3 1.5.18.3 1.29.18.3 1.30.13.3 1.31.13.3 1.32.20.3 1.33.13.3 1.37.14.3 1.38.17.3 1.39.14.3 1.40.16.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.