FB_PJLink

FB_PJLink 1:

This function block enables communication to a projector via TCP/IP and can be used for control and monitoring. Communication to a projector is established automatically by the function block. Any information received from the controller is evaluated and displayed in the structure ST_PJLink_Projector_Status (output parameter stProjStatus). In addition, there is an automatic status update function that is executed periodically. Information, warnings and errors are displayed using the TC3 Event Logger.

Requirements for FB_PJLink:

FB_PJLink 2:

Important: Obey Projector Settings

Following settings for the projector need to be set up:

  • Activate the PJLink function,
  • deactivate the PJLink-Security function (optional),
  • activate network functionality,
  • deactivate the ECO function (disabling of network functionality in standby mode).

Sending of commands and inquiries to the projector is controlled by calling methods and setting corresponding input parameters:

FB_PJLink 3:

Licence

For using FB_PJLink a TC1200 “TC3 PLC” licence and a TF6310 “TwinCAT TCP/IP” licence are required.

VAR_INPUT

    bEnable             : BOOL;
sProjector          : T_IPv4Addr;
sServerNetID        : T_AmsNetId;
sSecurityPW         : STRING(32);
bKeepAliveSocket    : BOOL := FALSE;
tStatusUpdateTime   : TIME := T#5S;
eTraceLevel         : TcEventSeverity;

bEnable: Setting this parameter TRUE activates the function module. Communication to a projector is established. If FALSE is set, communication is terminated and the function block is deactivated.

sProjector: The local IP address (IPv4) of the TCP/IP client/server socket as a string (e.g. '192.168.0.5'). An empty string can also be specified for the default network adapter.

sServerNetID: String containing the AMS network address of the TwinCAT TCP/IP Connection Server. An empty string can also be specified for the local computer (default).

sSecurityPW: Password for the Security Authorization function (optional). The identical (case sensitive) password must be entered in the projector settings.

bKeepAliveSocket: When TRUE, activates a Keep Alive mode for communication with the projector. Only one socket is opened, which is kept permanently open. In the event of an error, the function block remains in an error mode. FALSE (recommended) opens a new socket before sending a command and then closes it again. In the event of an error, a new connection process is automatically triggered.

tStatusUpdateTime: Update interval of the status information request from the projector. (Default=5s; higher update time tStatusUpdateTime reduces data traffic.)

eTraceLevel: Determines the event types that are sent via the Event Logger. Events of greater or equal importance than the value at the input parameter are sent. (Example: Value = Warning → Sending warnings, errors and criticals; value=Warning → Among other things, PJLink messages are logged.)

VAR_OUTPUT

    bBusy           : BOOL;
    eStep           : E_PJLink_step;
    bError          : BOOL;
    ipResultMessage : I_TcMessage;
    nErrID          : UDINT;
    sErrBlock       : STRING(20);
    stProjStatus    : ST_PJLink_Projector_Status;

bBusy: This output is set as long as the connection to the socket is established.

eStep: This output parameter specifies the current step in the FB_PJLink State machine.

bError: If an error occurs, this output is set. (e.g.: connection to the socket is not possible).

ipResultMessage: This interface is used to send events via the TC3 Event Logger.

nErrID: This parameter returns the TwinCAT TCP/IP Connection Server error number when the bError output is set.

sErrBlock: Provides further information on the error that occurred. (Causing function block)

stProjStatus: Structure with the projector status information. (After sending a command, the response of the projector is evaluated and output in stProjStatus.)

Example: Command = "%1POWR 1$R" → Projector response = "%1POWR=ERR3"ProjStatus.POWR.Err_UnavailableTime = TRUE.