FB_CrestronCommunication

FB_CrestronCommunication 1:

This function block manages the communication to the individual Crestron controllers.

If the FB_CrestronConnections function block receives a TCP connection on TCP port 48798, then all instances of FB_CrestronCommunication are notified. These check whether the socket has the desired IP address. If this is not the case with any of the instances the socket is closed again. If the IP address is correct, the FB_CrestronCommunication function block saves the socket.

An instance of FB_CrestronCommunication must be created for each Crestron controller. These instances should be called in a faster task than the instances for read and write commands. The priority of the faster task must also be higher than that of the task in which the read and write commands are called.

Both the IP address of the Crestron controller and the instance of FB_CrestronConnections are specified in the declaration. Also, the instance of FB_CrestronConnections must be declared before the instances of FB_CrestronCommunication.

Sample:

PROGRAM Communication
VAR
    fbCrestronConnections       : FB_CrestronConnections;
    fbCrestronCommunicationA    : FB_CrestronCommunication(Communication.fbCrestronConnections, '192.168.0.200');
    fbCrestronCommunicationB    : FB_CrestronCommunication(Communication.fbCrestronConnections, '192.168.0.201');
END_VAR

fbCrestronConnections();
fbCrestronCommunicationA();
fbCrestronCommunicationB();