canSetWakeup (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, NX-400, LX2, LX5

Firmware version:

1.36.00


This function is used to configure the system to wake from suspend when a CAN message is received.

It is similar to using the CAN parameter on pmWaitEvent.

 

pmSuspend return codes for this wake-up source:

Error

Type

Value

Description

True

9

-1

The CAN bus is not open.

True

9

-2

The CAN bus is open but not enabled as a wake-up source.

True

9

-3

The baud rate is not supported.

False

9

1

Wake-up on CAN.

 

 

Input:

enable : BOOL (default: TRUE)

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

 

port : SINT (1/2) (default 1)

The port of the CAN bus.

 

 

Returns: INT

1

- The system has been configured to wake.

0

- This function is not supported.

-1

- The CAN bus is not present.

-2

- The CAN bus is not open.

 

Declaration:

FUNCTION ALIGN canSetWakeup : INT;
VAR_INPUT
  enable : BOOL := TRUE;
  port   : SINT := 1;
END_VAR;
 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
BEGIN
  ...
  // Open CAN 1
  canOpen(baud:=500);
  ...
  // Enable wake on CAN 1
  canSetWakeup(port := 1, enable := ON);
  ...
END;
END_PROGRAM;