...
Constant Name | Value | Usage |
_COM232_ | 0 | Uses COM1 port as RS232C mode. |
_COM422_ | 1 | Uses COM1 port as RS422 mode. |
_COM485_ | 2 | Uses COM1 port as RS485 mode. |
_COMAUX_ | 3 | Uses COM2 port as RS232C mode only. |
_BPS300_ |
| 300 bps (Baudrate) |
_BPS600_ |
| 600bps (Baudrate) |
_BPS1200_ |
| 1200bps (Baudrate) |
_BPS2400_ |
| 2400bps (Baudrate) |
_BPS4800_ |
| 4800bps (Baudrate) |
_BPS9600_ |
| 9600bps (Baudrate) |
_BPS19200_ |
| 19200bps (Baudrate) |
_BPS38400_ |
| 38400bps (Baudrate) |
_BPS56000_ |
| 56000bps (Baudrate) |
_BPS57600_ |
| 57600bps (Baudrate) |
_BPS115200_ |
| 115200bps (Baudrate) |
_BPS128000_ |
| 128000bps (Baudrate) |
_BPS256000_ |
| 256000bps (Baudrate) |
_PARITY_NONE_ |
| No parity bit |
_PARITY_EVEN_ |
| Even parity |
_PARITY_ODD_ |
| Odd parity |
_PARITY_MARK_ |
| Mark parity |
_PARITY_SPACE_ |
| Space Parity |
_STOPBIT_ONE_ |
| 1 STOP bit |
_STOPBIT_TWO_ |
| 2 STOP bits |
_STOPBIT_ONE5_ |
| 1.5 STOP bit |
ClosePort | Closes the serial port. |
Function | n=ClosePort(PortNo.) |
Description | PortNo. (use predefined constant, _COMxxx_) Closes the assigned serial port which was previously opened by the OpenPort() function. If an error occurs during the port closing, the script will return 0. If the port closed successfully, the script would return a value other than 0. |
Example | Closes COM1 port. ClosePort(_COM485_); |
EnableDriver | Controls the selected station’s communication. |
Subroutine | EnableDriver(“DeviceName”, “StationName”, Enable/Disable) |
Description | Controls the communication of the assigned StationName of the DeviceName. You may Enable/Disable the communication with: 0: Disable 1: Enable This function only supports MODBUS RTU at XpanelDesigner V2.52 and versions above. |
Example | Enables the station “STATION” of the “MODBUS” device. EnableDriver(“MODBUS”, “STATION”, 1); |
...
SendByte | Sends byte data through the selected port. |
Function | n=SendByte(PortNo., Data) |
Description | PortNo. (use predefined constant, _COMxxx_) Data (0~255) This function is used when you wish to transmit data with the COM port that was previously opened by the OpenPort() function. Data must be byte data in the range of 0(0x00) to 255(0xFF). If the data is greater than 255(0xFF), only the lower byte will be transmitted. For example, if you assign Data with 0x1234, only 0x34 will be transmitted. The OpenPort() function must be used before the execution of the SendByte() function. If an error occurs during the data transmission, the script will return 0. If the data transmitted successfully, the script would return a value other than 0. |
Example | Transmits byte data “2” through COM1 port which uses RS485 communication. SendByte(_COM485_, 2); |
...
SendString | Sends string data through the selected port. |
Function | SendString(PortNo., Data) |
Description | PortNo. (use predefined constant, _COMxxx_) Data (Enter the String Tag or “String”) This function is used when you wish to transmit data with the COM port that was previously opened by the OpenPort() function. The Data must be assigned with a string tag or string data. If you use the string data, it must be used with double quotation marks (“ “). The OpenPort() function must be used before the execution of the SendString() function. If an error occurs during the data transmission, the script will return 0. If the data transmits successfully, the script will return a value other than 0. |
Example | Transmits string data “TEXT” through COM1 port which uses RS485 communication. SendString(_COM485_, “TEXT”); |
...