FinsGateway+Fins_API_Programmers_Manual
FinsGateway+Fins_API_Programmers_Manual
OMRON
FinsGateway
FINS API
Programmer’s Manual
Version 2 8/17/1998
OMRON Corporation
FINS API Programmer’s Manual
Contents
1 INTRODUCTION........................................................................................................................................................................1
1.1 FINS API .............................................................................................................................................................................1
1.2 Operating Environment......................................................................................................................................................1
1.3 Structure..............................................................................................................................................................................1
2 USING FINSGATEWAY............................................................................................................................................................5
2.1 Sending a FINS Command...............................................................................................................................................5
2.2 Returning a FINS Response .............................................................................................................................................5
2.3 Receiving FINS Commands/Responses .........................................................................................................................6
2.4 Inter-process Communication...........................................................................................................................................7
2.5 Ending Communication .....................................................................................................................................................7
3 ERROR EVENTS .......................................................................................................................................................................9
3.1 Function Call Errors............................................................................................................................................................9
3.2 Cause and Action of Error Events...................................................................................................................................10
4 FINS API REFERENCE...........................................................................................................................................................11
4.1 Summary...........................................................................................................................................................................11
4.2 Fins_requestVersion Function.........................................................................................................................................12
4.3 Fins_getVersion Function................................................................................................................................................13
4.4 Fins_new Function ...........................................................................................................................................................14
4.5 Fins_newReservedUnit Function....................................................................................................................................15
4.6 Fins_delete Function........................................................................................................................................................16
4.7 Fins_sendData Function..................................................................................................................................................17
4.8 Fins_receiveData Function..............................................................................................................................................18
4.9 Fins_setMessageOnArrival Function..............................................................................................................................19
4.10 Fins_setThreadMessageOnArrival Function .................................................................................................................20
4.11 Fins_clearMessageOnArrival Function ..........................................................................................................................21
4.12 Fins_getMessageSize Function......................................................................................................................................22
4.13 Fins_getTaddress Function.............................................................................................................................................23
4.14 Fins_getEventHandle Function.......................................................................................................................................24
4.15 Fins_getNetworkInfo Function ........................................................................................................................................25
4.16 Fins_getConnectUnits Function......................................................................................................................................26
4.17 FinsHead_compose Function.........................................................................................................................................27
4.18 FinsHead_composeResponse Function........................................................................................................................28
4.19 Fins_getLastErrorMessage Function .............................................................................................................................29
5 DATA STRUCTURE................................................................................................................................................................31
5.1 FINS Message..................................................................................................................................................................31
5.2 Transmission Header.......................................................................................................................................................32
6 SYSMAC NET FUNCTIONS...................................................................................................................................................33
6.1 C-series and CV-series in One System..........................................................................................................................33
7 SYSMAC NET C-MODE TRANSMISSION ..........................................................................................................................35
7.1 FINS Messages (with Conversion) .................................................................................................................................35
7.2 C-mode Messages (without Conversion).......................................................................................................................36
Revision History
Revision code Date Revised content
1.00 August 1998 Original production
1 Introduction
Application
ETN_UNIT
SLK UNIT
CPU UNIT
Unit level
Base level
FinsGateway
The major features of FinsGateway are the following:
A communication platform is provided in the personal computer to use OMRON FA networks, so that the user
can communicate without concern for the specific network such, as SYSMAC LINK or Ethernet.
FinsGateway performs data transfer between units, recognizing the applications and network providers
(including individual communication drivers) as equal units.
The communication functions (routing and gateway functions) of the same level as the PLC are provided.
• It is possible to perform direct communication with the PLCs which belong to other networks(i.e.,
realization of multi-layer network communication) by the FINS communication.
• It is possible to use a personal computer as a gateway between networks.
1.3 Structure
The basic processing requested of FINS API from applications is data send and receive. The data consists of
the header section to control protocol and the application message section. The header consists of the portion
from ICF to SID in the FINS protocol and a local-node-specific data structure used by FinsGateway.
1.3.1 Configuration
FINS API operates in cooperation with the following functions:
• FINS API library: Library that provides the API (Application Programming Interface) for FINS
communication. The major functions are message sending and receiving.
• Communication unit: Exists for each network and actually performs sending and receiving on the
network. Offers the same FINS services as PLC communication units offer.
• Communication driver: Exists for each network and directly controls the hardware of the network
board.
• Main unit: The only system service existing in the system. Offers FINS services comparable to the
main unit of PLC.
Header
Header
FinsGateway is somewhat different from the FINS command reference in the description of interpretation and
definition, although the data string is the same. FinsGateway handles both FINS commands and responses as
FINS messages without differentiating between them.
*
Explanations of the meanings of ICF and RSV are omitted (see the FINS Command Reference Manual).
©Copyright OMRON Corporation 1995-1998 All Rights Reserved.
3
FINS API Programmer’s Manual
FINS PCI
The application messages refer to those in the application layer(*). FINS command codes and the end code are
part of application messages, and FinsGateway, as a rule, is not involved with the content of application
messages. FINS API designates as a transport address a set of network number, node number, and unit
number, which represents a unit on FINS communication domain. Thus, a set of DNA, DA1, and DA2, and a
set of SNA, SA1, and SA2 are interpreted as a transport address and a sender transport address.
2 Using FinsGateway
Message Preparation
Refer to the FINS Command Reference Manual (Cat. No. W227) to prepare a FINS message (command).
Transmission
Send the prepared FINS header and message using the Fins_sendData function.
Message Preparation
Translate the received FINS message (command) and prepare the FINS response. Refer to the FINS
Command Reference Manual for details of the FINS response format.
Transmission
Transmit the prepared FINS header and FINS message using the Fins_sendData function.
break ;
}
3 Error Events
If an error is detected in FINS routing, FinsGateway normally returns an error response. The error responses
conform to the FINS command/response.
If it is not possible to return an error response to the message sent from an application, FinsGateway performs
the following:
• Error return of the FINS API function
• Logging of error in the main and communication units
Incorrect use of the FINS API or argument result in function call errors.
†
Codes in the above table show values with the upper 2 bytes masked.
4.1 Summary
The library consists of multiple functions of the following:
Version management
Fins_requestVersion Specification of version management
Fins_getVersion Acquisition of DDL release version
Basic Operation
Fins_new Generation of network handle
Fins_newReservedUnit Generation of network handle (automatic)
Fins_delete Delete of network handle
Fins_sendData FINS transmit processing
Fins_receiveData FINS receive processing
Miscellaneous
Fins_getLastErrorMessage Gets an error message associated with FINS API error code.
See Also
Fins_*, FinsHead_*
See Also
Fins_requestVersion, Fins_newReservedUnit, Fins_delete
See Also
Fins_requestVersion, Fins_new, Fins_delete
See Also
Fins_new, Fins_newReservedUnit
See Also
Fins_new, Fins_newReservedUnit, Fins_receiveData, FinsHead_compose, FinsHead_composeResponse
See Also
Fins_new, Fins_newReservedUnit, Fins_sendData
See Also
Fins_setThreadMessageOnArrival, Fins_clearMessageOnArrival, Fins_receiveData
See Also
Fins_setMessageOnArrival, Fins_clearMessageOnArrival, Fins_receiveData
See Also
Fins_setMessageOnArrival, Fins_setThreadMessageOnArrival, Fins_receiveData
See Also
Fins_new, Fins_newReservedUnit, Fins_sendData, Fins_receiveData
See Also
Fins_new, Fins_newReservedUnit
See Also
Fins_new, Fins_newReservedUnit, Fins_receiveData
See Also
Fins_new, Fins_newReservedUnit
See Also
Fins_new, Fins_newReservedUnit
See Also
Fins_sendData
‡
Note:The SID store area which is automatically incremented in the function is assured only one for the process. Note that it is not by the unit of network
handle nor thread.
©Copyright OMRON Corporation 1995-1998 All Rights Reserved.
28
FINS API Programmer’s Manual
See Also
Fins_sendData, Fins_receiveData
See Also
GetLastError
5 Data Structure
FinsGateway + SYSMAC NET provides functions for SYSMAC NET communications with control devices such
as SYSMAC series PLC to applications on a personal computer.
Applications that perform communications using FinsGateway can communicate with control devices via
standardized communications protocols, via FINS (Factory Interface Network Service), which is a
communications service, and via a general API (Application Programming Interface).
FinsGateway + SYSMAC NET supports transmission with PLCs that do not support FINS, such as the
SYSMAC C series. FinsGateway + SYSMAC NET also supports ASCII code.
6.1.2 Settings
CV-series PLCs
To select the mode in the datagram message specifications of the communications unit(C-mode or CV-mode),
use the PLC programming tools on personal computer. Restart the Unit or the PLC after changing the mode.
In C-mode, a FinsGateway application can use both FINS messages and C-mode messages.
7.2.1 Programming
Sending raw C-mode commands and FINS only differs in the process of creating the header part of the
message. The rest of the send procedure is the same. (The API to send a message is the same). These
operations use the same FINS API as described previously in this manual.
The procedure to add this information is as follows: The procedure to make a C-mode header in is
sown in the following figure.
(1) Make Original FINS header using FinsHead_compose function.
(2) Setting of GWPCI header in FINSHEAD structure body.
(2-1) Setting of protocol type to send message. SYSMAC NET C-mode protocol number is defined by
C_PROTOCOL_SYSNET_CMODE.
(2-2) Setting of local source unit address (LocalSU)
Get local source unit address using Fins_getTaddress function.
(2-3) Setting of local destination unit address(LocalDU)
(2-3-1) Obtain active units list from FinsGateway using Fins_getConnectUnits function.
(2-3-2) Search the units list for SYSMAC NET unit using pre-definition unit name ,
' FG_UNITNAME_SYSNET'
(3) Send C-mode commands to SYSMAC series PLCs.
int SysnetCmodeHead_compose(
HNET handle, // network handle
LPFINSHEAD lpHead, // FINS header
BYTE icfBits, // the least significant bit of ICF
LPFINSADDR lpAddr, // FINS transport address of send destination
int input_nSid) // SID
{
int sid; // SID
FINSADDR srcAddr; // source address
CONNECTINFO connectInfo[16]; // array of structure body of
// connected unit information
int cbUnits; // number of units which can be stored
int cbConnectUnits; // number of units which
// can be currently used
int ret; // return value of FINS API
/*
* (1) Make Original FINS header
*/
sid = FinsHead_compose(lpHead, 0, lpAddr, -1);
if (sid == -1)
return -1;
/*
* (2) Setting of GWPCI header
*/
// (2-1)Setting of protocol type
lpHead->gwPci.usProtoType = C_PROTOCOL_SYSNET_CMODE;