Preview only show first 10 pages with watermark. For full document please download

Modem_01.lib

   EMBED


Share

Transcript

Appendix A – Additional libraries WAGO-I/O-PRO 32 Library Modem_01.lib The library „Modem_01.lib“ provides the function block “MODEM_INTERFACE”, this covers the complied modem handling necessary to create and close a transparent modem connection. Contents Modem_01.lib 3 MODEM_INTERFACE .............................................................................. 3 MODEM_CONNECT ................................................................................. 6 typMODEM_STATUS (ENUM)................................................................. 8 typMODEM_ERROR (ENUM) .................................................................. 8 WAGO-I/O-PRO 32 Version 1.0.3 Modem_01.lib - 1 MODEM_INTERFACE 2 – Modem_01.lib ml00200e WAGO-I/O-PRO 32 Appendix A – Additional libraries Modem_01.lib MODEM_INTERFACE WAGO-I/O-PRO 32 Library elements Category: Name: Type: Library name: Used libraries Applicable to: Input parameter xOPEN_CONNECTION Data type: BOOL bCOM_PORT_NR BYTE cbBAUDRATE strMODEM_INT COM_ BAUDRATE COM_ PARITY COM_ STOPBITS COM_ BYTESIZE COM_ FLOW_CONTROL STRING strMODEM_DIAL STRING cpPARITY csSTOPBITS cbsBYTESIZE cfFLOW_CONTROL WAGO-I/O-PRO 32 Communication MODEM_INTERFACE Function block X Program Function Modem_01.lib Serial_Interface_01.LIB SerComm.LIB STANDARD.LIB All programmable fieldbus controllers (except 750-812/814/815/816) Version 1.0.3 Comments: TRUE: set up and hold a transparent modem connection . FALSE shut down an established modem connection. Used COM-port 1: internal Service interface COM1 2: 1th plugged 750-65x COM2 3: 2nd plugged 750-65x COM3 4: – etc. Modem specific (max. 19200) Modem specific Modem specific Modem specific Modem specific Initialisation string for the modem. This string will be transmitted first to the modem while set up. Following strings have a special meaning: / :=1 sec pause;the string / will not be transmitted | := will be replaced by (0x0D) The dial string contains the dial sequence Following strings have a special meaning: / :=1 sec pause;the string / will not be transmitted | := will be replaced by (0x0D) Modem_01.lib - 3 MODEM_INTERFACE WAGO-I/O-PRO 32 Library elements strMODEM_HANG_UP STRING strPHONE_No STRING tCONNECTION_TIMEOUT TIME iBYTES_TO_SEND ptSEND_BUFFER INT POINTER Output parameter: Data type: xCONNECTION_READY BOOL bERROR BYTE utMODEM_STATUS typMODEM_ STATUS The Hang-Up-string contains the sequence needed by the modem to close the connection. Following strings have a special meaning: / :=1 sec pause;the string / will not be transmitted | := will be replaced by (0x0D) Telefon number of the communication partner Maximum period of time to set up the modem connection. Number of bytes to be send Pointer to the transmitt buffer TRUE: A rising edge signaling the end of the requested operation. Subsequent the result of the requested operation should be checked by bERROR, utMODEM_ERROR and utMODEM_STATUS. FALSE: a requested operation like set up or close is in progress. Errorcodes of the serial interface (see SERIAL_INTERFACE from Library Serial_Interface_01.lib) Actual status of the connection MODEM_DISCONNECT := 0, MODEM_INITIALIZE := 1, MODEM_IS_CONNECTING := 2, MODEM_CONNECTED := 3, MODEM_DATA_EXCHANGE := 4 Status MODEM_DATA_EXCHANGE is needed for data transfer with a partner. utMODEM_ERROR typMODEM_ ERROR In/Output parameter: xSTART_SEND Data type: BOOL utRECEIVE_BUFFER xINIT 4 – Modem_01.lib MODEM_NO_ERROR MODEM_CONNECT_ERROR MODEM_DISCONNECT_ERROR MODEM_INIT_ERROR := 0, := -1, := -2, := -3 Comments Parameter to start a transparent data transfer.(utMODEM_STATUS must be in state MODEM_DATA_EXCHANGE) typRING_BUFFER Buffer for the received data BOOL ml00200e WAGO-I/O-PRO 32 Appendix A – Additional libraries Graphic display: Function description: This function block provide the complied modem handling over a serial interface to create a transparent modem connection. All necessary system calls like - Open a COM-Port - The modem initalisation. - Set up a modem connection, - Transparent data exchange - Close the modem connection - Close the COM-Port are covered inside this function block. In the end it is enough to call this function block every cycle. This function block use internal the following FB’s: „MODEM_CONNECT“ from this library and „SERIAL_INTERFACE“ from the library „Serial_Interface_01.lib WAGO-I/O-PRO 32 Version 1.0.3 Modem_01.lib - 5 MODEM_CONNECT MODEM_CONNECT WAGO-I/O-PRO 32 Library elements Category: Name: Type: Library name: Used libraries Applicable to: 6 – Modem_01.lib Communication MODEM_CONNECT Function block X Program Function Modem_01.lib Serial_Interface_01.LIB (Data types only) SerComm.LIB STANDARD.LIB All programmable fieldbus controller (except 750-812/814/815/816) Input parameter: xCONNECT Data type: BOOL strMODEM_INT STRING strMODEM_DIAL STRING strMODEM_HANG_UP STRING strPHONE_No STRING ptSEND_BUFFER tTIMEOUT POINTER TIME Output parameter: xREADY Data type: BOOL ml00200e Comments: A TRUE sets up the modem connection. A FALSE closes the actual modem connection. Initialisation string for the modem. This string will be transmitted first to the modem while set up. Following strings have a special meaning: / :=1 sec pause;the string / will not be transmitted | := will be replaced by (0x0D) The dial string contains the dial sequence Following strings have a special meaning: / :=1 sec pause;the string / will not be transmitted | := will be replaced by (0x0D) The Hang-Up-string contains the sequence needed by the modem to close the connection. Following strings have a special meaning: / :=1 sec pause;the string / will not be transmitted | := will be replaced by (0x0D) Telephone number of the communication partner Pointer to the transmit buffer. Maximum period of time to establish a connection. Comments A TRUE indicates,that the function block has finished the job. Outputs STATUS and ERROR gives detailed information. xREADY is FALSE while set up and close of the connection. WAGO-I/O-PRO 32 Appendix A – Additional libraries WAGO-I/O-PRO 32 Library elements xOPEN_COMPORT BOOL Opens the appropriate serial port. Needs to stay TRUE during modem operation. STATUS typMODEM_ STATUS Actual status of the connection MODEM_DISCONNECT := 0, MODEM_INITIALIZE := 1, MODEM_IS_CONNECTING := 2, MODEM_CONNECTED := 3, MODEM_DATA_EXCHANGE := 4 Status MODEM_DATA_EXCHANGE is needed to communicate with a partner. ERROR typMODEM_ ERROR MODEM_NO_ERROR MODEM_CONNECT_ERROR MODEM_DISCONNECT_ERROR MODEM_INIT_ERROR In/Output parameter: utRECEIVE_BUFFER Comments Buffer for the received data iCOUNT Data type: typRING_ BUFFER INT xSTART_SIO xINIT_SIO BOOL BOOL := 0, := -1, := -2, := -3 Information to the interface about the number of transmitted data. Parameter for interface control. Parameter for interface initialisation. Graphic display: Function description: This function block is not designed to act as a stand alone function block in user application, this function block is used internal by „MODEM_INTERFACE“. The function block implements the functions necessary for modem initialisation and dialing and hang up. This function block need an additional interface driver for communication. WAGO-I/O-PRO 32 Version 1.0.3 Modem_01.lib - 7 typMODEM_STATUS (ENUM) typMODEM_STATUS (ENUM) WAGO-I/O-PRO 32 Library elements Category: Name: Type: Library name: typMODEM_STATUS Enumeration X Data type Modem_01.lib Header: TYPE typMODEM_STATUS : ( MODEM_DISCONNECT MODEM_INITIALIZE MODEM_IS_CONNECTING MODEM_CONNECTED MODEM_DATA_EXCHANGE MODEM_IS_DISCONNECTING END_TYPE := := := := := := 0, 1, 2, 3, 4, 5); typMODEM_ERROR (ENUM) WAGO-I/O-PRO 32 Library elements Category: Name: Type: Library name: typMODEM_ERROR Enumeration X Data type Modem_01.lib Header: TYPE typMODEM_ERROR : ( MODEM_NO_ERROR MODEM_CONNECT_ERROR MODEM_DISCONNECT_ERROR MODEM_INIT_ERROR END_TYPE 8 – Modem_01.lib ml00200e := := := := 0, -1, -2, -3); WAGO-I/O-PRO 32