Promotic
WikipediaLinkedInYoutubeTwitterFacebook

OpenPort - method of object PmaComm

Description:
Open the serial/ethernet communication port of this object.
Syntax:
OpenPort(sParam)
Calling:
b = oComm.OpenPort(sParam)
Parameters:
sParam(String) Parameters for opening
- for serial link: Only the port name is entered here.

For example "COM1".

- for Ethernet-client: The IP address and/or port number is entered.

Entries are in KeyVal format, for example "ipaddress:192.168.0.126;port:61682;". If any of the entries remain empty, then the previously entered value remains valid.

Return Values:
true -
- for serial link: Port has been successfully opened.
- for Ethernet-client: The parameters has been set and connection will be opened during the next transfer.
false -
- for serial link: Port hasn't been opened. Possible fault: Such port is not present on this computer or it is already used.
- for Ethernet-client: Because this method doesn't create a connection, false is return only if for bad input parameters.
Note:
This method cannot be used for the PmaComm object that contains PmaCommMsg object of the Slave type.
 
for serial link: The default setting of the serial communication port is defined in the "Serial port" configurator in parameters of the serial link. If it is necessary to change dynamically the serial link port, then it is possible to set Not set in its parameters and than by the OpenPort and ClosePort methods change the port.

For serial link each PmaComm object must have defined another communication port. For example, when one PmaComm object communicates through COM1, then next PmaComm object can communicate for example through COM2 (COM3,..) but it mustn't communicate through COM1.

for Ethernet-client: The method only adds new connection parameters into the object. The following transfer will close existing connection and open new connection.
Example1:
for serial link: Algorithm called after the request for sending 1 message (by PmaCommMsg object) through COM1 port.
JavaScriptVBScriptSelect and copy to clipboard

if (oComm.OpenPort("COM1"))
oCommMsg.Run();
Example2:
for Ethernet-client: Sets the IP address and port. The next calling of Run method will close previous connection and open new connection.
JavaScriptVBScriptSelect and copy to clipboard

oComm.OpenPort("ipaddress:192.168.0.2;port:88;");
oCommMsg.Run();
PROMOTIC 9.0.3 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice