Supported platforms: CODESYS 2.3

 

ISOBUS_VT_SetPreferredInstance (FUN)

Description

This function is used to set preferred VT function instance number which application tries to connect to.

 

During connection phase, VT client will wait for the defined max wait time to search for the preferred VT.

If preferred instance is not found then VT client's default behavior is used (connect to lowest instance).

 

Function should be called during application initialization before VT client tries to connect to server.

In code template this can be done in VT user init program.

 

Function can also be called on-fly but the updated values apply for the next connection to VT (e.g. after timeout).

 

Returns ISOBUS_ERR_SUCCESS if settings are successfully applied.

Inputs

Input variable name

Data type

Range

Description

i_pVTClient

POINTER TO ISOBUSVtClient

≠ 0

Pointer to configured VT client

i_PreferredVT

BYTE

0..31

Function instance number 0..31 of preferred VT

i_MaxWaitTime

TIME

N/A

Maximum time to wait for preferred VT to be found

Output

Data type

Description

ISOBUS_ErrorCodes

Returns ISOBUS_ERR_SUCCESS if settings are successfully applied.

 

Example code

See also implementation guide How to set VT preferred instance and move to another VT.

 

Following example assumes that code template is used and ISOBUS is defined to CAN2 bus.

Example code sets function instance 1 as preferred VT. By default VT client tries to connect in lowest detected instance number.

 

Code:

 

ISOBUS_VT_SetPreferredInstance(

    i_pVTClient := G_ISOBUS_CAN2_Data.pVtClient,

    i_PreferredVT:= 1,

    i_MaxWaitTime:= T#30s

);

 

 

 

Source file topic100562.htm

Last updated 13-Jun-2024