Plc Access To The Serial Interface - JUMO mTRON T Manual

Measuring,control, and automation system
Hide thumbs Also See for mTRON T:
Table of Contents

Advertisement

4 Serial transmission modes
4.3

PLC access to the serial interface

4.3.1
Activation
The PLC can access the serial interface(s). To do this, the ComSetSettings() initialization func-
tion must be used.
Once the PLC has programmed its parameters using ComSetSettings(), a new protocol ("PLC-
controlled") is activated. The previous parameters are locally overwritten here. The new proto-
col and where applicable, the changed parameters cannot be viewed in the device-side config-
uration; the setup program still displays the previous parameters.
To reactivate the pervious parameters, the PLC must end its access using ComClose(). Alter-
natively, changing the device-side configuration can restore access to the interface on the de-
vice; the corresponding protocol is activated and the configured parameters are used here.
If the PLC no longer has interface access after a change on the device-side, it receives the error
code ERR_NET_NOTCONNECTED with the ComRead() or ComWrite() functions. If the PLC
still attempts to establish access, it must call the ComSetSettings() function again in this case,
since the parameters that were most recently set are valid.
4.3.2
API functions
The following API functions are provided to the user:
RTS_HANDLE CDECL SysComOpen(short sPort, RTS_RESULT *pResult)
= request interface handler
RTS_HANDLE CDECL SysComOpen2(COMSettings *pSettings, COMSettingsEx *pSet-
tingsEx, RTS_RESULT *pResult)
= request interface handler and simultaneously call up ComSetSettings
RTS_RESULT CDECL SysComSetSettings(RTS_HANDLE hCom,
COMSettings *pSettings, COMSettingsEx *pSettingsEx)
= obtain interface access and configure interface parameter
RTS_RESULT CDECL SysComGetSettings (RTS_HANDLE hCom,
COMSettings *pSettings, COMSettingsEx *pSettingsEx)
= read out interface parameter
unsigned int CDECL SysComRead(RTS_HANDLE hCom, unsigned char *pbyBuffer,
unsigned int uiSize, unsigned long ulTimeout, RTS_RESULT *pResult)
= request receiver
unsigned int CDECL SysComWrite(RTS_HANDLE hCom, unsigned char *pbyBuffer,
unsigned int uiSize, unsigned long ulTimeout, RTS_RESULT *pResult)
= start transmission
RTS_RESULT CDECL SysComSetTimeout(RTS_HANDLE hCom,
unsigned long ulTimeout)
= set character time-out
RTS_RESULT CDECL SysComClose(RTS_HANDLE hCom)
= return interface to the original protocol
All API functions return a 3S error code in RTS_RESULT, which must be evaluated by the PLC.
NOTE!
These API functions are based on the standard CODESYS functions (SysCom library).
The individual parameters and error codes are described in the PLC online help.
52

Advertisement

Table of Contents
loading

Table of Contents