Download TelePACE C Tools User Manual

Transcript
Telepace C Tools Function Specifications
getProtocolSettingsEx
Reads extended protocol settings for a serial port.
Syntax
#include <ctools.h>
BOOLEAN getProtocolSettingsEx(
FILE * stream,
PROTOCOL_SETTINGS_EX * pSettings
);
Description
The setProtocolSettingsEx function sets protocol parameters for a serial port.
This function supports extended addressing and Enron Modbus parameters.
The function has two arguments:

stream specifies the serial port. It is one of com1, com2, com3 or com4.

pSettings is a pointer to a PROTOCOL_SETTINGS_EX structure. Refer to
the description of the structure for an explanation of the parameters.
The function returns TRUE if the settings were retrieved. It returns FALSE if the
stream is not valid.
Notes
Extended addressing and the Enron Modbus station are available on the Modbus
RTU and Modbus ASCII protocols only. See the TeleBUS Protocols User Manual
for details.
See Also
setProtocolSettingsEx
Example
This program displays the protocol configuration for com1.
#include <ctools.h>
void main(void)
{
PROTOCOL_SETTINGS_EX settings;
if (getProtocolSettingsEx(com1, &settings)
{
printf("Type: %d\r\n", settings.type);
printf("Station: %d\r\n", settings.station);
printf("Address Mode: %d\r\n", settings.mode);
printf("SF: %d\r\n", settings.SFMessaging);
printf("Priority: %d\r\n", settings.priority);
printf("Enron: %d\r\n", settings.enronEnabled);
printf("Enron station: %d\r\n",
settings.enronStation);
}
Document (Version 2.50) 5/12/2011
240