serSetWakeup (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 data is received on a serial port.

It is similar to using the ser0 and ser1 parameters on pmWaitEvent.

 

 

pmSuspend return codes for this wake-up source:

Error

Type

Value

Description

True

3

-10

The serial port is not open.

False

3

1

The serial port has awoken the system.

The ID variable is set to the port number of the affected serial port.

 

 

Input:

 

Enable : BOOL (default: TRUE)

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

 

Port : SINT (default: 0)

The serial port to wake on.

 

Mode : SINT (default: 0)

The type of event to wake on. Not all ports have support for all modes. Mode 0 will wake when data is received. Mode 1 will wake on any change on the bus and the received data is not available from serFrameReceiver.

 

 

Returns:

1

- The system has been configured to wake.

0

- This function is not supported.

-1

- The port is not present.

-2

- The port is not open.

-3

- The port does not support wake-up.

-4

- The serial port does not support the mode.

-5

- Unknown mode.

 

Declaration:

FUNCTION ALIGN serSetWakeup:INT;
VAR_INPUT
  enable : BOOL := TRUE;
  port   : SINT := 0;
  mode   : SINT := 0;
END_VAR;
 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
BEGIN
  ...
  // Enable wake on serial port 1
  serSetWakeup(port := 1);
  ...
END;
 
END_PROGRAM;