boardDinSetWakeup (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.36.00


This function is used to configure the system to wake from suspend when a digital input changes state.

It is similar to using the DI1-4 and DI1-5Falling parameters on pmWaitEvent.

 

There may be situations where it is possible to enable both the rising and falling edges, triggering a wake-up on any change. The return code can be used to determine if this is the case.

Under some circumstances, the return code from pmSuspend may show the edge that triggered the wake-up.

 

 

pmSuspend return codes for this wake-up source:

Error

Type

Value

Description

True

2

-10

S0 is enabled but there is no external power.

False

2

1

Wake-up on a rising edge

False

2

0

Wake-up on a falling edge.

False

2

-1

Wake-up on an edge.

The ID variable is set to the number of the digital input(1..8).

 

Input:

 

Enable : BOOL (default: TRUE)

Set to true to enable the wake-up, set to false to disable it.

 

Pin : SINT (1..8)

The digital input to enable wake up on.

 

 

Rising : BOOL (default: TRUE)

If set to true, the device will wake on the rising edge of the input.

 

Falling : BOOL (default: FALSE)

If set to true, the device will wake on the falling edge of the input.

 

Returns:

1

- The system has been configured to wake.

0

- This function is not supported.

-1

- The input is not present

-2

- The input does not support wake on both edges

-3

- The input is not a supported wake source.

 

Declaration:

FUNCTION ALIGN boardDinSetWakeup:INT;
VAR_INPUT
  enable : BOOL := TRUE;
  pin     : SINT;
  rising : BOOL := TRUE;
  falling : BOOL := FALSE;
END_VAR;
 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
BEGIN
  ...
  // Enable wake on DIN 1 rising edge
  boardDinSetWakeup(pin := 1, rising := TRUE);
  ...
END;
 
END_PROGRAM;