Supported platforms: CODESYS 2.3
This guide describes how to:
set VT preferred instance
save used VT instance to nonvolatile memory
move to another VT on-fly
The following example assumes that MultiTool Creator code template is used and ISOBUS is initialized to CAN2.
|
Requires ISOBUS VT library 1.4.9 or later.
|
The following example uses 3000 series FRAM to save VT instance.
FRAM definitions: |
|
G_VTPreferredInstance AT %MB10006:BYTE := 0;
|
The following variables are used to trigger move to another VT.
Implementation to VT object pool is required (e.g. buttons or softkeys) and not described in this example.
Definitions: |
|
G_MoveNextVT: BOOL := FALSE; G_MovePreviousVT: BOOL := FALSE; |
The following code sets the VT preferred instance which VT tries to connect to.
The FRAM variable is used as initial instance value.
The max wait time is application specific.
Application can utilize the terminal's boot time value from VT client metrics or implement wait time adjustment to object pool.
ISOBUS_CAN2_IsobusVtInitUserCode: |
|
ISOBUS_VT_SetPreferredInstance( i_pVTClient := G_ISOBUS_CAN2_Data.pVtClient, i_PreferredVT := G_VTPreferredInstance, i_MaxWaitTime := T#30s ); |
The following example code saves the VT instance to FRAM variable after VT client has connected to server.
ISOBUS_CAN2_IsobusVtUpdateUserCode: |
|
(*Save current VT instance as preferred*) IF G_ISOBUS_CAN2_Data.pVtClient <> DWORD#0 THEN IF G_ISOBUS_CAN2_Data.pVtClient^.o_VtStatus.ObjectPoolReady THEN IF G_ISOBUS_CAN2_Data.pVtClient^.o_VtStatus.VtInstance <> G_VTPreferredInstance THEN G_VTPreferredInstance := G_ISOBUS_CAN2_Data.pVtClient^.o_VtStatus.VtInstance; G_3724_FastParamsSave := TRUE; END_IF END_IF END_IF |
The following code implements "Move to another VT" functionality which is used on-fly to move UI in different terminal.
The example implements move to next and move to previous VT.
Application can use o_AvailableVTs.MultipleVTs flag to check if multiple VTs are found before showing the move options to user.
|
Requires multiple VT terminals on ISOBUS.
|
|
It is also possible to move to specific VT instance number. VT client has list of detected VT instances in o_AvailableVTs.InstanceFound array. Moving to specific instance is not implemented in this example. |
ISOBUS_CAN2_IsobusVtUpdateUserCode: |
|
(*Move to another VT*) IF G_MoveNextVT OR G_MovePreviousVT THEN IF G_MoveNextVT THEN movetype := ISOBUS_VT_MOVE_TO_NEXT; ELSIF G_MovePreviousVT THEN movetype := ISOBUS_VT_MOVE_TO_PREV; END_IF G_MoveNextVT := FALSE; G_MovePreviousVT := FALSE; move_result := ISOBUS_VT_MoveToAnotherVT( i_pVTClient := G_ISOBUS_CAN2_Data.pVtClient, i_Type := movetype, i_PreferredVT := G_VTPreferredInstance, i_MaxWaitTime := T#10s ); END_IF |
ISOBUS_VT_MoveToAnotherVT (FUN)
ISOBUS_VT_SetPreferredInstance (FUN)
Source file topic100737.htm
Last updated 21-Feb-2025