MVI-ADMNET Developer's Guide
MVI-ADMNET Developer's Guide
'C' Programmable
'C' Programmable Application
Development Module with Ethernet
DEVELOPER'S GUIDE
Your Feedback Please
We always want you to feel that you made the right decision to use our products. If you have suggestions, comments,
compliments or complaints about our products, documentation, or support, please write or call us.
ProSoft Technology
5201 Truxtun Ave., 3rd Floor
Bakersfield, CA 93309
+1 (661) 716-5100
+1 (661) 716-5101 (Fax)
[Link]
support@[Link]
Copyright © 2013 ProSoft Technology, Inc., all rights reserved.
® ® ® ® ®
ProSoft Technology , ProLinx , inRAx , ProTalk , and RadioLinx are Registered Trademarks of ProSoft
Technology, Inc. All other brand or product names are or may be trademarks of, and are used to identify products
and services of, their respective owners.
In an effort to conserve paper, ProSoft Technology no longer includes printed manuals with our product shipments.
User Manuals, Datasheets, Sample Ladder Files, and Configuration Files are provided on the enclosed CD-ROM,
and are available at no charge from our web site: [Link].
Content Disclaimer
This documentation is not intended as a substitute for and is not to be used for determining suitability or reliability of
these products for specific user applications. It is the duty of any such user or integrator to perform the appropriate
and complete risk analysis, evaluation and testing of the products with respect to the relevant specific application or
use thereof. Neither ProSoft Technology nor any of its affiliates or subsidiaries shall be responsible or liable for
misuse of the information contained herein. Information in this document including illustrations, specifications and
dimensions may contain technical inaccuracies or typographical errors. ProSoft Technology makes no warranty or
representation as to its accuracy and assumes no liability for and reserves the right to correct such inaccuracies or
errors at any time without notice. If you have any suggestions for improvements or amendments or have found errors
in this publication, please notify us.
No part of this document may be reproduced in any form or by any means, electronic or mechanical, including
photocopying, without express written permission of ProSoft Technology. All pertinent state, regional, and local safety
regulations must be observed when installing and using this product. For reasons of safety and to help ensure
compliance with documented system data, only the manufacturer should perform repairs to components. When
devices are used for applications with technical safety requirements, the relevant instructions must be followed.
Failure to use ProSoft Technology software or approved software with our hardware products may result in injury,
harm, or improper operating results. Failure to observe this information can result in injury or equipment damage.
Printed documentation is available for purchase. Contact ProSoft Technology for pricing and availability.
North America: +1.661.716.5100
Asia Pacific: +603.7724.2080
Europe, Middle East, Africa: +33 (0) 5.3436.87.20
Latin America: +1.281.298.9109
Warnings
Electrical Ratings
Backplane Current Load: 800 mA @ 5 V DC; 3mA @ 24V DC
Operating Temperature: 0 to 60°C (32 to 140°F)
Storage Temperature: -40 to 85°C (-40 to 185°F)
Shock: 30g Operational; 50g non-operational; Vibration: 5 g from 10 to 150 Hz
Relative Humidity 5% to 95% (non-condensing)
All phase conductor sizes must be at least 1.3 mm(squared) and all earth ground conductors must be at least
4mm(squared).
Markings - MVI56, MVI69, PTQ
CE EMC-EN61326-1:2006; EN6100-6-4:2007
CSA/cUL C22.2 No. 213-1987
CSA CB Certified IEC61010
ATEX EN60079-0 Category 3, Zone 2
EN60079-15
243333 ME06
243333
Warning: This module is not hot-swappable! Always remove power from the rack before inserting or removing this
module, or damage may result to the module, the processor, or other connected devices.
Contents
Your Feedback Please ........................................................................................................................ 2
Content Disclaimer .............................................................................................................................. 2
Important Installation Instructions ....................................................................................................... 3
MVI (Multi Vendor Interface) Modules ................................................................................................ 3
Warnings ............................................................................................................................................. 3
Battery Life Advisory ........................................................................................................................... 4
1 Introduction 9
1.1 Operating System .................................................................................................... 10
sock_exit ...................................................................................................................................... 96
sock_abort ................................................................................................................................... 97
sock_close ................................................................................................................................... 98
6.5 ADMNET API Send Socket Functions .................................................................... 99
sock_write .................................................................................................................................... 99
sock_fastwrite ............................................................................................................................ 100
sock_flush .................................................................................................................................. 101
sock_flushnext ........................................................................................................................... 102
sock_puts ................................................................................................................................... 103
sock_putc ................................................................................................................................... 104
6.6 ADMNET API Receive Socket Functions .............................................................. 105
sock_read .................................................................................................................................. 105
sock_fastread............................................................................................................................. 106
tcp_listen .................................................................................................................................... 107
sock_gets ................................................................................................................................... 108
sock_getc ................................................................................................................................... 109
sock_dataready.......................................................................................................................... 110
rip ............................................................................................................................................... 111
inet_ntoa .................................................................................................................................... 112
inet_addr .................................................................................................................................... 113
Index 121
1 Introduction
In This Chapter
Operating System .................................................................................. 10
Note: DOS programs that try to access the video or keyboard hardware directly will not function
correctly on the MVI module. Only programs that use the standard DOS and BIOS functions to
perform console I/O are compatible.
In This Chapter
Package Contents ................................................................................. 12
Jumper Locations and Settings ............................................................. 13
Connections .......................................................................................... 14
2.3 Connections
In This Chapter
Setting Up Your Compiler ...................................................................... 16
ROM Disk Configuration ........................................................................ 33
Creating a ROM Disk Image.................................................................. 37
Downloading a ROM Disk Image .......................................................... 39
MVI System BIOS Setup ....................................................................... 41
Transferring Files to and from the Module with HyperTerminal ............. 43
Installing and Configuring the Module ................................................... 52
Note: This procedure assumes that you have successfully installed Digital Mars C++ 8.49 on your
workstation.
Important: The sample code and libraries in the 1756-MVI-Samples folder are not compatible with,
and are not supported for, the Digital Mars compiler.
2 From the Folders field, navigate to the folder that contains the project
(C:\ADM_TOOL_MVI\SAMPLES\…).
3 In the File Name field, click on the project name ([Link]).
5 Click Project Rebuild All from the Main Menu to create the .exe file. The
status of the build will appear in the Output window:
Porting Notes: The Digital Mars compiler classifies duplicate library names as Level 1 Errors
rather than warnings. These errors will manifest themselves as "Previous Definition Different:
function name". Level 1 errors are non-fatal and the executable will build and run. The architecture
of the ADM libraries will cause two or more of these errors to appear when the executable is built.
This is a normal occurrence. If you are building existing code written for a different compiler you
may have to replace calls to run-time functions with the Digital Mars equivalent. Refer to the Digital
Mars documentation on the Run-time Library for the functions available.
6 The executable file will be located in the directory listed in the Compiler
Output Directory field. If it is blank then the executable file will be located in
the same folder as the project file. The Project Settings window can be
accessed by clicking Project Settings from the Main Menu.
6 Click Next.
12 Click Next.
17 These settings were set when the project was created. No changes are
required. The executable must be built as a DOS executable in order to run
on the MVI platform.
18 Click the Directories tab and fill in directory information as required by your
project’s directory structure.
19 If the fields are left blank then it is assumed that all of the files are in the
same directory as the project file. The output files will be placed in this
directory as well.
20 Click on the Build tab, and choose the Compiler selection. Confirm that the
settings match those shown in the following screen:
21 Click Code Generation from the Topics field and ensure that the options
match those shown in the following screen:
22 Click Memory Models from the Topics field and ensure that the options
match those shown in the following screen:
23 Click Linker from the Topics field and ensure that the options match those
shown in the following screen:
24 Click Packing & Map File from the Topics field and ensure that the options
match those shown in the following screen:
25 Click Make from the Topics field and ensure that the options match those
shown in the following screen:
26 Click OK.
27 Click Parse Update All from the Project Window Menu. The new settings
may not take effect unless the project is updated and reparsed.
28 Click Project Build All from the Main Menu.
29 When complete, the build results will appear in the Output window:
The executable file will be located in the directory listed in the Compiler Output
Directory box of the Directories tab (that is, C:\ADM_TOOL_MVI\SAMPLES\…).
The Project Settings window can be accessed by clicking Project Settings
from the Main Menu.
Porting Notes: The Digital Mars compiler classifies duplicate library names as Level 1 Errors
rather than warnings. These errors will manifest themselves as "Previous Definition Different:
function name". Level 1 errors are non-fatal and the executable will build and run. The architecture
of the ADM libraries will cause two or more of these errors to appear when the executable is built.
This is a normal occurrence. If you are building existing code written for a different compiler you
may have to replace calls to run-time functions with the Digital Mars equivalent. Refer to the Digital
Mars documentation on the Run-time Library for the functions available.
Note: This procedure assumes that you have successfully installed Borland C++ 5.02 on your
workstation.
Important: The sample code and libraries in the 1756-MVI-Samples folder are not compatible with,
and are not supported for, the Digital Mars compiler.
2 From the Directories field, navigate to the directory that contains the project
(C:\adm\sample).
3 In the File Name field, click on the project name ([Link]).
4 Click OK. The Project window appears:
5 Click Project Build All from the Main Menu to create the .exe file. The
Building ADM window appears when complete:
The executable file will be located in the directory listed in the Final field of
the Output Directories (that is, C:\adm\sample). The Project Options window
can be accessed by clicking Options Project Menu from the Main Menu.
2 Type in the Project Path and Name. The Target Name is created
automatically.
3 In the Target Type field, choose Application (.exe).
4 In the Platform field, choose DOS (Standard).
5 In the Target Model field, choose Large.
6 Ensure that Emulation is checked in the Math Support field.
8 Click on the .cpp file created and press the Delete key. Click Yes to delete
the .cpp file.
9 Right click on the .exe file listed in the Project window and choose the Add
Node menu selection. The following window appears:
10 Click source file, then click Open to add source file to the project. Repeat this
step for all source files needed for the project.
11 Repeat the same procedure for all library files (.lib) needed for the project.
12 Choose Libraries (*.lib) from the Files of Type field to view all library files:
13 The Project window should now contain all the necessary source and library
files as shown in the following window:
15 Click Directories from the Topics field and fill in directory information as
required by your project’s directory structure.
16 Double-click on the Compiler header in the Topics field, and choose the
Processor selection. Confirm that the settings match those shown in the
following screen:
17 Click Memory Model from the Topics field and ensure that the options match
those shown in the following screen:
18 Click OK.
19 Click Project Build All from the Main Menu.
21 Click OK. The executable file will be located in the directory listed in the Final
box of the Output Directories (that is, C:\adm\sample). The Project Options
window can be accessed by clicking Options Project from the Main
Menu.
MVI46
IRQPRIORITY=1
INSTALL=A:\[Link] -iomix=0 -class=4 -m0size=3000 -m1size=10000
Note: The MVI46 driver file is called [Link], and may be loaded from the [Link] or
[Link] files. The driver must be loaded before executing an application which uses the
MVI API.
The SLC platform supports several classes of modules. The MVI46 can be
configured as a Class 1 or Class 4 module. Also, the I/O image sizes are
configurable. If the MVI46 is configured as Class 4, M0 and M1 files are
supported and their sizes are configurable.
To configure the class of the MVI46, use the command line options shown below
when loading the MVI driver [Link]. If no options are given, the MVI46
MVI driver defaults to Class 4, 32 words of I/O, and M0 and M1 sizes of 1024
words (module ID = 13635).
[C:\]MVI46bp -?
MVI46 MVI Driver V1.00
Copyright (c) 2000 Online Development, Inc.
Usage:
C:\[Link] [-iomix=n] [-class=n] [-m0size=n] [-m1size=n]
where:
- iomix=n sets the I/O image sizes. Valid values for n are:
0 => 2 words of IO 5 => 12 words of IO
1 => 4 words of IO 6 => 16 words of IO
2 => 6 words of IO 7 => 24 words of IO
3 => 8 words of IO 8 => 32 words of IO (default)
4 => 10 words of IO
- class=n sets the module class. Valid values for n are:
1 => Class 1 (Messaging disabled)
4 => Class 4 (Messaging enabled, default)
- m0size=n sets the number of words for the Messaging
receive buffer, default m0size=1024
- m1size=n sets the number of words for the Messaging
send buffer, default m1size=1024
NOTE: m0size + m1size must be less than 16320 words.
When configuring the Host Controller for the MVI46, the programming software
requires the Module ID for each module in the system. The Module ID for the
MVI46 depends upon the configuration set by the driver. When the driver is
loaded, it prints to the console the Module ID value that can be entered into the
programming software for the Host Controller. For example, the default
configuration prints the following information:
[C:\]MVI46bp
MVI46 MVI Driver V1.00
Copyright (c) 2000 Online Development, Inc.
1746 MVI Configuration
----------------------
Class 4
IO mix 8 = 32 words of IO
M0 File size = 1024 words
M1 File size = 1024 words
SLC Module ID = 13635
The first line, IRQPRIORITY=1, assigns the highest interrupt priority to the I/O
backplane interrupt. The next line loads the backplane device driver. In this
example, the backplane device driver file ([Link]) must be located in the
root directory of the ROM disk. In the case of the MVI46, the module I/O is set
when the backplane driver is loaded. The module is set to class 4 with a 3000
word M0 file and a 10000 word M1 file. The Module ID for installing and
configuring the module in the ladder program will be printed to the console when
the backplane driver is loaded.
MVI56
IRQPRIORITY=1
INSTALL=A:\[Link]
INSTALL=A:\[Link]
MVI69
IRQPRIORITY=1
SYSTEMPOOL=16384
STACKS=5
SHELL=A:\[Link] /s /p
INSTALL=A:\[Link]
MVI71
IRQPRIORITY=1
INSTALL=A:\[Link]
MVI94
IRQPRIORITY=1
INSTALL=A:\[Link]
MVI46
File Name Description
[Link] Runs the executable at startup
[Link] Loads the backplane device driver and the command interpreter
[Link] Command interpreter
[Link] Backplane device driver
[Link] Sample application
MVI56
File Name Description
[Link] Runs the executable at startup
[Link] Loads the backplane device driver and the command interpreter
[Link] Command interpreter
[Link] Backplane device driver
[Link] Backplane device driver
[Link] Sample application
MVI69
File Name Description
[Link] Runs the executable at startup
[Link] Loads the backplane device driver and the command interpreter
[Link] Command interpreter
[Link] Backplane device driver
[Link] Sample application
MVI71
File Name Description
[Link] Runs the executable at startup
[Link] Loads the backplane device driver and the command interpreter
[Link] Command interpreter
[Link] Backplane device driver
[Link] Sample application
[Link] Configures the module to use either backplane or side-connect interface.
MVI94
File Name Description
[Link] Runs the executable at startup
[Link] Loads the backplane device driver and the command interpreter
[Link] Command interpreter
[Link] Backplane device driver
[Link] Sample application
3 Drag and drop the files you want in your image to the WINIMAGE window.
4 Click on Options, Settings and make sure the Truncate unused image part
option is selected, as shown in the following figure. Click on OK.
5 Click on File, Save As, and choose a directory and filename for the disk
image file. The image must be saved as an uncompressed disk image, so be
sure to select Save as type: Image file (*.IMA) as shown in the following
figure.
6 Check the disk image file size to be sure it does not exceed the maximum
size of the MVI-ADMNET module’s ROM disk (896K bytes, 384K bytes for
MVI94). If it is too large, use WINIMAGE to remove some files from the
image, then de-fragment the image and try again (Note: To de-fragment an
image, click on Image, Defrag current image.
7 The disk image is now ready to be downloaded to the MVI-ADMNET module.
For more information on using WINIMAGE, refer to the documentation included
with it.
Note: WINIMAGE is a shareware utility. If you find this program useful, please register it with the
author.
3.4.1 MVIUPDAT
[Link] is a DOS-compatible utility for downloading a ROM disk image
from a host PC to the MVI-ADMNET module. [Link] uses a serial port
on the PC to communicate with the module. Follow the steps below to download
a ROM disk image:
1 Connect a null-modem serial cable between the serial port on the PC and
PRT1 on the MVI module.
2 If you are using HyperTerm or a similar terminal program for the MVI-
ADMNET module console, exit or disconnect from the serial port before
running the MVI Flash Update tool.
3 Turn off power to the MVI module. Install the Setup Jumper as described in
the Installation Instructions.
For DOS:
1 Click the START button, and then choose RUN.
2 In the OPEN: field, enter MVIUPDAT. Specify the PC port on the command line
as shown in the following illustration. The default is COM1.
3 Turn on power to the MVI module. You should see the following menu shown
on the host PC.
+----------------------------+
| Main Menu |
|----------------------------|
| Verify Module Connection |
| Update Flash Disk Image |
| Reboot Module |
+----------------------------+
4 Select VERIFY MODULE CONNECTION to verify the connection to the MVI
module. If the connection is working properly, the message "Module
Responding" will be displayed.
Note: If an error occurs, check your serial port assignments and cable connections. You may also
need to cycle power more than once before the module responds.
5 Select UPDATE FLASH DISK IMAGE to download the ROM disk image. Type the
image file name when prompted. The download progress is displayed as the
file is being transmitted to the module.
6 After the disk image has been transferred, reboot the MVI module by
selecting the REBOOT MODULE menu item.
7 Exit the [Link] utility by pressing [ESC].
For Windows:
Double Click on the MVI FLASH UPDATE icon to open the Establish
Connection dialog box.
It may be necessary to install the setup jumper in order to access the BIOS
Setup. The setup jumper will be necessary if the Console is disabled. The
following illustration shows the BIOS Setup screen.
The MVI module can be placed in a mode where it is waiting to receive a new
flash image by selecting the Begin Flash ROM Update Mode option.
Select MVI Module Configuration to set the Console, Console Baud Rate and
Compact Flash mode. The Console allows keyboard entry and text output to the
debug port. The baud rate of the console port is selected by the Console Baud
Rate option. In order to use a Compact Flash disk in the MVI module the
Compact Flash option must be set to CHS mode.
Important: The embedded operating system in the ADM/ADMNET module restricts file names to
eight "DOS legal" characters or fewer, with a three character extension. For more information on
creating filenames in the proper format refer to pages 17 through 20 of the DOS 6-XL Reference
manual.
The RY and SY programs use the Ymodem file transfer protocol to send (upload)
and receive (download) configuration files from your module. If you use a
communication program that is not on the list above, please be sure that it
supports Ymodem file transfers.
4 During the memory check portion of the module’s boot sequence, press
[Ctrl][C] to enter the BIOS configuration menu.
6 On the BIOS configuration menu, use the [Tab] key to navigate through the
menu options, and then use the [+] key to toggle the choices.
The options to change are:
o Console on Port 1: change to Enabled
o Console Baud Rate: change to 57600
7 Press [Esc] to return to the Main Menu.
8 Press [Esc] again to apply your changes and reboot the module.
9 Remove the module from the rack and disable the Setup jumper.
To communicate with the module in Console mode
2 Press [Esc] to exit the program and return to the command prompt.
Important: The [Link] in the image file must allow the application to exit to a DOS prompt.
Important: You cannot copy files directly to the A:\ drive on the module. To update files on the A
drive, you must create a new ROM image (page 37) and download the image to the module using
MVIFlashUpdate. (page 39) The following procedures show how to send and receive files from the
module’s Compact Flash card (drive C:\).
4 Click the Browse button to navigate to the folder and file to send to the
module.
5 Chose Ymodem from the Protocol dropdown list, and then click Send.
6 The Ymodem File Send dialog box shows the file transfer size and remaining
time.
When the file has been transferred to the module, the dialog box will indicate
that the transfer is complete.
3 From the Transfer menu in HyperTerminal, select Receive File. This action
opens the Receive File dialog box.
4 Use the Browse button to choose a folder on your computer to save the file,
5 Select Ymodem as the receiving protocol, and then click the Receive button.
When the file has been transferred to your PC, the dialog box will indicate
that the transfer is complete.
Note: The software must be in "offline" mode to add the module to a project.
2 Modify the example ladder logic to meet the needs of your application, and
copy the ladder logic to the processor. Example ladder logic files are provided
on the CD-ROM.
Note: If you are installing this module in an existing application, you can copy the necessary
elements from the example ladder logic into your application.
Note for MVI94: Configuration information for the MVI94-ADM module is stored in the module’s
Flash ROM. This provides permanent storage of the information. The user configures the module
using a text file and then using the terminal emulation software provided with the module to
download it to the module’s Flash ROM. The file contains the configuration for the Flex backplane
data transfer, master port and the command list. This file is downloaded to the module for each
application.
Note for MVI69: Configuration information for the MVI69-ADM module is stored in the module’s
EEPROM. This provides permanent storage of the information. The user configures the module
using a text file and then using the terminal emulation software provided with the module to
download it to the module’s EEPROM. The file contains the configuration for the virtual database,
backplane data transfer, and serial port. This file is downloaded to the module for each application.
Next, define the data files for the application. If the block transfer interface is
used, define the data files to hold the configuration, status, and user data. Enter
the module’s configuration in the user data files. Enter the ladder logic to handle
the blocks transferred between the module and the PLC. Download the program
to the PLC and test the program with the module.
If the side-connect interface is used, no ladder logic is required for data transfer.
The user data files to interface with the module must reside in contiguous order
in the processor. The first file to be used by the interface is the configuration file.
This is the file number set in the SC_DATA.TXT file using the [Link]
program. The following table lists the files used by the side-connect interface:
File Number Example Size Description
Cfg File N10 300 Configuration/Control/Status File
Cfg File+1 N11 to 1000 Port 1 commands 0 to 99
Cfg File+2 N12 to 1000 Port 2 commands 0 to 99
Cfg File+5 N15 to 1000 Data transferred from the module to the processor.
Other files for read data.
Cfg File+5+n N16 to 1000 Data transferred from the processor to the module.
Cfg File +5+n+m Other files for write data.
n is the number of read data files minus one. Each file contains up to 1000
words.
m is the number of write data files minus one. Each file contains up to 1000
words.
Even if both files are not required for a port’s commands, they are still reserved
and should only be used for that purpose. The read and write data contained in
the last set of files possess the data transferred between the module and the
processor. The number of files required for each depends on the number of
registers configured for each operation. Two examples follow:
Example of 2300 read and 3500 write data registers (cfg file=10)
Data Files Description
N15:0 to 999 Read data words 0 to 999
N16:0 to 999 Read data words 1000 to 1999
N17:0 to 299 Read data words 2000 to 2299
N18:0 to 999 Write data words 0 to 999
N19:0 to 999 Write data words 1000 to 1999
N20:0 to 999 Write data words 2000 to 2999
N21:0 to 499 Write data words 3000 to 3499
Special care must be taken when defining the files for the side-connect interface.
Because the module directly interacts with the PLC processor and its memory,
any errors in the configuration may cause the processor to fault and it may even
lose its configuration program. After defining the files and populating them with
the correct data, download the program to the processor, and place the
processor in Run mode. If everything is configured properly, the module should
start its normal operation.
If all the configuration parameters are set correctly, the module’s application LED
(OK LED) should remain off and the backplane activity LED (BP ACT) should
blink rapidly. Refer to the Diagnostics and Troubleshooting of this manual if you
encounter errors. Attach a terminal to Port 1 on the module and look at the status
of the module using the Configuration/Debug Menu in the module.
In This Chapter
API Libraries .......................................................................................... 56
Development Tools ............................................................................... 58
Theory of Operation .............................................................................. 59
ADM API Files ....................................................................................... 60
The MVI ADM API Suite allows software developers access to the top layer of
the serial and Ethernet ports. The MVI-ADMNET API suite accesses the Ethernet
port. Both APIs can be easily used without having detailed knowledge of the
module’s hardware design. The MVI ADMNET API Suite consists of the Ethernet
Port API. The Ethernet Port API provides access to the Ethernet network.
Applications for the MVI ADMNET module may be developed using industry-
standard DOS programming tools and the appropriate API components.
This section provides general information pertaining to application development
for the MVI ADMNET module.
Note: The following compiler versions are intended to be compatible with the MVI module API:
Digital Mars C++ 8.49
Borland C++ V5.02
More compilers will be added to the list as the API is tested for compatibility with them.
Important: The sample code and libraries in the 1756-MVI-Samples folder are not compatible with,
and are not supported for, the Digital Mars compiler.
Note: The multi-threading library [Link] in the DOS folder on the distribution CD-ROM is
compiler-specific to Borland C++ 5.02. It is not compatible with Digital Mars C++ 8.49. ProSoft
Technology, Inc. does not support multi-threading with Digital Mars C++ 8.49.
Note: The ADM DOS 6-XL operating system has a system tick of 5 milliseconds. Therefore, thread
scheduling and timer servicing occur at 5ms intervals. Refer to the DOS 6-XL Developer’s Guide
on the distribution CD-ROM for more information.
WARNING: ADM and ADMNET libraries are not thread-safe. ProSoft Technology, Inc. does not
support the use of ADM and ADMNET libraries in multi-threaded applications.
int queuelen;
byte *queue;
longword acknum;
longword seqnum; // data ack'd and sequence num
long timeout; // timeout, in milliseconds
byte unhappy; // flag, indicates retransmitting
segt's
byte recent; // 1 if recently transmitted
word mss;
longword inactive_to; // for the inactive flag
int sock_delay;
int queuelen;
byte *queue;
ADM_init_socket
Syntax
int ADM_init_socket(int numSK, int portNum, int buffSize, char *name);
Parameters
numSK Variable indicating how many sockets to use.
portNum Port Number.
buffSize The size of the buffer available in each socket.
name The name of the socket.
Description
ADM_init_socket acquires access to the ADMNET API and dynamically
generates a set of sockets according to numSK and assigns portNum, buffSize,
then names each socket that the application will use in subsequent functions.
This function must be called before any of the other API functions can be used.
IMPORTANT After the API has been opened, ADM_Release_Sockets should always be called
before exiting the application.
Return Value
SK_SUCCESS API has successfully initialized variables.
SK_PORT_NOT_ALLOW API does not allow port number used.
SK_CANNOT_ALLOCATE_MEMORY API cannot allocate memory.
Example
int numSK = 5;
int portNum = 5757;
int buffSize = 1000;
See Also
ADM_release_sockets (page 68)
ADM_open_sk
Syntax
int ADM_open_sk(char *skName, char *ServerIPAddress, int protocol);
Parameters
skName Name of the socket that has been initialized and used to send data.
ServerIPAddress IP address that will be used to send data to.
protocol Specified protocol to send over Ethernet (USE_TCP or USE_UDP).
Description
ADM_open_sk opens a socket according to the name previously initialized,
skName, with ADM_init_socket given, and assigns IP address, ServerIPAddress
for send function with specific protocol, either UDP or TCP. ADM_init_socket
must be used before this function. Returns SK_TIMEOUT if no connection is
made within 30 seconds.
IMPORTANT: After the API has been opened, ADM_close_sk should always be called for closing
the socket. [Link] passes as ServerIPAddress to open socket as a server to listen to a message
from client.
Return Value
SK_SUCCESS API has successfully opened socket.
SK_PROCESS_SOCKET Open is still in process.
SK_NOT_FOUND API could not find an initialized socket with the name passed to the
function.
SK_TIMEOUT Time out opening socket.
SK_OPEN_FAIL Socket could not be opened.
Example
char sockName1[ ] = "SendSocket";
int buffSize1 = 4096;
int port_1 = 6565;
int numSocket1 = 1;
int result;
if (result==SK_SUCCESS)
{
printf("successfully Opened a connection!\n");
} else {
printf("Error Opening a connection! %d\n", result);
}
ADM_init_UDP_buffer
Syntax
int ADM_init_UDP_buffer(char *skName, char **buffer, int maxLength);
Parameters
skName Name of the socket that has been initialized and used to receive data
buffer Pointer to a buffer to hold received messages
maxlength Maximum length of each message in the buffer
Description
ADM_init_UDP_buffer attaches a user supplied buffer to the UDP socket for
storing the received messages. Since the buffer is user supplied, the user can
adjust the size to suit the application.
Return Value
SK_SUCCESS Buffer has been attached to UDP socket
successfully.
SK_NOT_FOUND Socket could not be found.
SK_CANNOT_ALLOCATE_MEMORY API cannot allocate memory.
Example
char sockName1[] = "ReceiveSocket";
if(ADM_init_UDP_buffer(sockName1, (char**)&bigbuff0[0],
BIG_BUFFER_SIZE_CYCLIC))
{
printf("\nCould not enable large buffers for server!\n");
sock_close(sockName1);
return;
}
printf("listen for datagrams\n");
ADM_release_sockets
Syntax
int ADM_release_sockets(void);
Parameters
none
Description
This function is used by an application to release all sockets created by
ADM_init_socket.
IMPORTANT: After a socket has been generated, this function should always be called before
exiting the application.
Return Value
SK_SUCCESS API was successfully released all the sockets.
Example
ADM_release_sockets();
See Also
ADM_init_socket (page 65)
ADM_close_sk
Syntax
int ADM_close_sk(char *skName);
Parameters
skName Name of the socket that has been initialized and used
to send data.
Description
This function is used by an application to close socket opened by ADM_open_sk.
IMPORTANT: After a socket has been opened, this function should always be called to close
socket, but not release socket.
Return Value
SK_SUCCESS API was successfully released all the sockets.
SK_NOT_FOUND API could not find an initialized socket with the name
passed to the function.
Example
char sockName1[ ] = "SendSocket";
ADM_close_sk(sockName1);
printf ("Connection Closed!\n");
See Also
ADM_init_socket (page 65)
ADM_send_socket
Syntax
int ADM_send_socket(char *skName, char *holdSendPtr, int *sendLen, char
*ServerIPAddress, int protocol);
Parameters
skName Name of the socket that has been initialized and used to
send data.
holdSendPtr Pointer to a string of data that will be sent to the
ServerIPAddress
sendLen Number of data specified to send.
ServerIPAddress IP address that will be used to send data to.
protocol Specified protocol to send over Ethernet (USE_TCP or
USE_UDP).
Description
To simplify a program, this function opens connection and sends message.
skName must be a valid name that has been initialized with ADM_init_socket.
Return Value
SK_SUCCESS Socket is successfully sent.
SK_NOT_FOUND Socket could not be found.
SK_PROCESS_SOCKET Socket is in the process of sending.
Example
int sendLen = 10;
int se;
See Also
ADM_receive_socket (page 72)
ADM_send_sk
Syntax
int ADM_send_sk(char *skName, char *holdSendPtr, int *sendLen);
Parameters
skName Name of the socket that has been initialized and used
to send data.
holdSendPtr Pointer to a string of data that will be sent to the
ServerIPAddress
sendLen Number of data specified to send.
Description
ADM_ send _sk sends with a socket previously open using ADM_open_sk.
Return Value
SK_SUCCESS API has successfully open socket.
SK_PROCESS_SOCKET Open process is still in
SK_NOT_FOUND API could not find an initialized socket with the name
passed to the function.
Example
char sockName1[ ] = "SendSocket";
char holdingReg[100];
int buffSize1 = 4096;
int port_1 = 6565;
int numSocket1 = 1;
int result;
sprintf(holdingReg,"abcdefghijklmnopqrstuvwxyz-");
sendLen = 27;
if(result == SK_SUCCESS)
{
printf("Data: %s Sent \n", holdingReg);
} else {
printf("Error sending data\n");
}
See Also
ADM_receive_sk (page 73)
ADM_receive_socket
Syntax
int ADM_receive_socket(char *skName, char *holdRecPtr, int *readLen, int
protocol);
Parameters
skName Name of the socket that has been initialized and used to receive data.
holdRecPtr Pointer to a buffer to hold data that will be received by the API.
readLen Length of data received by the API.
protocol Specified protocol to receive over Ethernet (USE_TCP or USE_UDP).
Description
To simplify a program, this function opens connection and receives message.
Return Value
SK_SUCCESS Socket is successfully sent.
SK_NOT_FOUND Socket could not be found.
SK_PROCESS_SOCKET Socket is in the process of sending.
Example
char hold[5000];
int readLen;
int se, i;
See Also
ADM_send_socket (page 70)
ADM_receive_sk
Syntax
int ADM_receive_sk(char *skName, char *holdRecPtr, int *readLen, char *fromIP);
Parameters
skName Name of the socket that has been initialized and used to receive data.
holdRecPtr Pointer to a buffer to hold data that will be received by the API.
readLen Length of data received by the API.
fromIP Pointer to character array which in turn return with client IP.
Description
This function receives socket after ADM_open_sk is used. skName must be a
valid name that has been initialized with ADM_init_socket.
Return Value
SK_SUCCESS Socket is successfully sent.
SK_NOT_FOUND Socket could not be found.
SK_PROCESS_SOCKET Socket is in the process of sending.
SK_TIMEOUT Time out opening socket.
Example
char sockName1[ ] = "SendSocket";
char holdingReg[100];
int result;
if(result == SK_SUCCESS){
printf("Received data!\n");
printf("Length == %d\n", readLen);
for (i=0; i<readLen; i++)
{
printf("%c", *(holdingReg+i));
}
printf("\n");
} else {
printf("Received no data Error: %d\n",result);
}
ADM_receive_buffered_UDP_sk
Syntax
int ADM_receive_buffered_UDP_sk(char *skName, char *holdRecPtr, int
*readLen, char *fromIP, int nBlock);
Parameters
skName Name of the socket that has been initialized and used to receive messages
holdRecPtr Pointer to a buffer to hold data that will be received by the API
readLen Length of data received by the API
fromIP Character array to hold client IP address
nBlock Function will block on receive if nBlock > 0. If nBlock is 0, the function will
return
Description
This function is used to receive messages when ADM_init_UDP_buffer is used.
Received messages will be placed in the buffer pointed to by holdRecPtr. The
parameter readLen will be updated with the length of the received message. The
client’s IP address will be placed in fromIP.
Return Value
SK_SUCCESS Message received if nBlock is non-zero. If nBlock is 0 then this
denotes a successful receive check which will result in a received
message if a message was available..
SK_NOT_FOUND Socket could not be found.
SK_SOCKET_CLOSE Socket is closed
Example
char sockName1[] = "ReceiveSocket";
char data[1024];
int length;
char fromIP[64];
unsigned long recvVal[10];
length = MAX_MESSAGE;
err = ADM_receive_buffered_UDP_sk(sockName1, data, &length, fromIP, 1);
if(length > 0)
{
recvVal[index++] = *(unsigned long *)data;
}
if(err < 0)
{
printf("got error\n");
}
ADM_NET_GetVersionInfo
Syntax
void ADM_NET_GetVersionInfo(ADMNETVERSIONINFO* admnet_verinfo);
Parameters
admnet_verinfo Pointer to structure of type ADMNETVERSIONINFO.
Description
ADM_GetVersionInfo retrieves the current version of the ADMNET API library.
The information is returned in the structure admnet_verinfo.
The ADMVERSIONINFO structure is defined as follows:
typedef struct
{
char APISeries[4];
short APIRevisionMajor;
short APIRevisionMinor;
long APIRun;
}ADMNETVERSIONINFO;
Return Value
None
Example
ADMNETVERSIONINFO verinfo;
/* print version of API library */
ADM_NET_GetVersionInfo(& verinfo);
ADM_is_sk_open
Syntax
int ADM_is_sk_open(char *skName);
Parameters
skName Name of the socket that has been initialized and used to receive data.
Description
ADM_is_sk_open tests if connection is still valid or not.
Return Value
SK_SUCCESS Socket is successfully sent.
SK_NOT_FOUND Socket could not be found.
SK_SOCKET_CLOSE Socket is closed.
Example
char sockName1[ ] = "SendSocket";
if(ADM_is_sk_open(sockName1) != SK_SUCCESS) {
printf("Socket not Opened\n");
} else {
printf("Socket Opened\n");
}
In This Chapter
WATTCP API Functions ........................................................................ 78
ADMNET API Initialize Functions .......................................................... 80
ADMNET API System Functionality ...................................................... 81
ADMNET API Release Socket Functions .............................................. 96
ADMNET API Send Socket Functions ................................................... 99
ADMNET API Receive Socket Functions ............................................ 105
sock_init
Syntax
void sock_init(void);
Parameters
None
Description
This function will read a stored TCP/IP configuration file and prepare a variable.
Return Value
SK_SUCCESS API has successfully initialized variables.
SK_PORT_NOT_ALLOW API does not allow port number used.
SK_CANNOT_ALLOCATE_MEMORY API cannot allocate memory.
Example
int numSK = 5;
int portNum = 5757;
int buffSize = 1000;
See Also
sock_exit (page 96)
tcp_tick
Syntax
int tcp_tick( sock_type *skType );
Parameters
skType Current socket Type or NULL for all sockets.
Description
This function is used by an application to determine the connection status of the
sockets.
Return Value
0 disconnected or reset.
>0 connected.
Example
sock_type *socket;
. . .
tcp_open
Syntax
int tcp_open( tcp_Socket *sk, word lPort, longword ina, word port,
dataHandler_t datahandler );
Parameters
sk Pointer to the socket that has been initialized.
lPort Local port number.
ina Host IP Address.
port Host port number.
datahandler Data Handler. Not used in this version. Use NULL for this parameter.
Description
This function opens a TCP socket connection to a host machine using
parameters passed to it. IPort is an option parameter. Most of the time, IPort can
be set to 0. The API will find an available port number for the socket. ina is a host
IP address passed as a longword. Function resolve can be used to convert an IP
address into longword-formatted variable.
Return Value
Connection cannot be made
>0 Connection is made
Example
tcp_Socket *socket;
. . .
See Also
resolve (page 86)
tcp_open_fast
Syntax
int tcp_open_fast( tcp_Socket *sk, word lPort, longword ina, word port,
dataHandler_t datahandler );
Parameters
sk Pointer to the socket that has been initialized.
lPort Local port number.
ina Host IP Address.
port Host port number.
datahandler Data Handler. Not used in this version. Use NULL for this parameter.
Description
This function opens a TCP socket connection to a host machine using
parameters passed to it. For this function, there is no wait to resolve the IP
address. IPort is an option parameter. Most of the time, IPort can be set to 0. The
API will find an available port number for the socket. ina is a host IP address
passed as a longword. Function resolve can be used to convert an IP address
into a longword-formatted variable.
Return Value
Connection cannot be made
>0 Connection is made
Example
tcp_Socket *socket;
. . .
See Also
resolve (page 86)
udp_open
Syntax
int udp_open( udp_Socket *sk, word lPort, longword ina, word port,
dataHandler_t datahandler );
Parameters
sk Pointer to the socket that has been initialized.
lPort Local port number.
ina Host IP Address.
port Host port number.
datahandler Data Handler. Not used in this version. Use NULL for this parameter.
Description
This function opens a UDP socket connection to a host machine using
parameters passed to it. IPort is an option parameter. Most of the time, IPort can
be set to 0. The API will find an available port number for the socket. ina is a host
IP address passed as a longword. Function resolve can be use to convert an IP
address into a longword-formatted variable.
Return Value
Connection cannot be made
>0 Connection is made
Example
udp_Socket *socket;
. . .
See Also
resolve (page 86)
udp_open_fast
Syntax
int udp_open_fast( tcp_Socket *sk, word lPort, longword ina, word port,
dataHandler_t datahandler );
Parameters
sk Pointer to the socket that has been initialized.
lPort Local port number.
ina Host IP Address.
port Host port number.
datahandler Data Handler. Not used in this version. Use NULL for this parameter.
Description
This function opens a UDP socket connection to a host machine using
parameters passed to it. For this function, there is no wait to resolve the IP
address that passes the function. IPort is an option parameter. Most of the time,
IPort can be set to 0. The API will find an available port number for the socket.
ina is a host IP address passed as a longword. Function resolve can be used to
convert an IP address into a longword-formatted variable.
Return Value
Connection cannot be made
>0 Connection is made
Example
udp_Socket *socket;
. . .
See Also
resolve (page 86)
resolve
Syntax
longword resolve( char *name );
Parameters
name String IP Address.
Description
This function converts a string IP Address into a long.
Return Value
longword Value of the IP Address in a long format.
Example
resolve("[Link]");
sock_mode
Syntax
word sock_mode( sock_type *skType, word mode);
Parameters
skType Current socket Type that will be used to set up socket mode.
mode The following is the available mode:
TCP_BINARY 0 default
TCP_ASCII 1 treat as ASCII data
UDP_CRC 0 checksum enable
UDP_NOCRC 2 checksum disable
TCP_NAGLE 0 default
TCP_NONAGLE 4 used for real time application.
Description
This function is used set the socket transfer protocol mode.
Return Value
Current mode.
Example
sock_type *socket;
. . .
sock_mode(socket, TCP_MODE_NONAGLE);
sock_established
Syntax
int sock_established( sock_type *skType );
Parameters
skType Current socket Type that will be used to check the connection.
Description
This function is used check if the socket has been established.
Return Value
Not established.
1 Establish
Example
sock_type *socket;
. . .
if(sock_established(socket))
{
printf("Socket has been established\n");
}
ip_timer_init
Syntax
void ip_timer_init( sock_type *skType, word second );
Parameters
skType Current socket Type that will be used to check the connection.
second Number of second to set the timer. 0 mean no timer out.
Description
This function is used initialize the timer.
Return Value
None
Example
sock_type *socket;
. . .
ip_timer_expired
Syntax
word ip_timer_expired( sock_type *skType );
Parameters
skType Current socket Type that will be used to check the connection.
Description
This function is used check if the timer has been expired.
Return Value
1 timer has been expired.
Example
sock_type *socket;
. . .
if(ip_timer_expired (socket))
{
printf("time’s up\n");
}
set_timeout
Syntax
longword set_timeout( word seconds );
Parameters
seconds Number of second to set the timer.
Description
This function is used set the timer.
Return Value
Number of timeout.
Example
set_timeout (100);
chk_timeout
Syntax
word chk_timeout( longword timeout );
Parameters
timeout Number of timeout return from set_timerout.
Description
This function is used check if the time is out.
Return Value
1 timeout
Example
int timeout = set_timeout (100);
While(!chk_timeout (timeout))
printf("Not timeout yet\n");
sockerr
Syntax
char *sockerr ( sock_type *skType );
Parameters
skType Current socket Type that will be used to check the connection.
Description
This function returns ASCII error message if there is any. Otherwise, NULL is
returned.
Return Value
String message or NULL if there is no error.
Example
sock_type *socket;
char *p;
. . .
sockstate
Syntax
char *sockstate ( sock_type *skType );
Parameters
skType Current socket Type that will be used to check the connection.
Description
This function returns ASCII message indicating current state.
Return Value
String message.
Example
sock_type *socket;
char *p;
. . .
gethostid
Syntax
char *gethostid ( void );
Parameters
None
Description
This function returns value of the IP address in host format.
Return Value
String IP Address.
Example
sock_type *socket;
char *p;
. . .
sock_exit
Syntax
void sock_exit( void );
Parameters
None
Description
This function is used by an application to release all the TCP/IP variables created
by sock_init.
Return Value
None
Example
sock_exit();
See Also
sock_init (page 80)
sock_abort
Syntax
void sock_abort( sock_type *skType);
Parameters
skType Current socket Type that will be used to abort the connection.
Description
This function is used abort a connection. This function is common for TCP
connections.
Return Value
None
Example
sock_type *socket;
. . .
sock_abort(socket);
See Also
sock_close (page 98)
sock_close
Syntax
void sock_close ( sock_type *skType);
Parameters
skType Current socket Type that will be used to close the connection.
Description
This function is used to permanently close a connection. This function is common
for UDP connections.
Return Value
None
Example
sock_type *socket;
. . .
sock_close(socket);
See Also
sock_abort (page 97)
sock_write
Syntax
int sock_write( sock_type *skType, byte *data, int len);
Parameters
skType Socket that will be used to send data.
data Pointer to a buffer that contains data that will be sent to a server.
len Length of the data specified to send.
Description
This function writes data to the socket being passed to the function. The function
will wait until the all the data is written.
Return Value
Number of Bytes that are written to the socket or -1 if an error occurs.
Example
sock_type *socket;
char theBuffer [512];
int len, bytes_sent;
. . .
See Also
sock_fastwrite (page 100)
sock_fastwrite
Syntax
int sock_fastwrite( sock_type *skType, byte *data, int len);
Parameters
skType Current socket that will be used to send data.
data Pointer to a buffer that contains data that will be sent to a server.
len Length of data specified to send.
Description
This function writes data to the socket being passed to the function. The function
will not check to the data written out to the socket.
Return Value
Number of bytes that are written to the socket or -1 if an error occurs.
Example
sock_type *socket;
char theBuffer [512];
int len, bytes_sent;
. . .
See Also
sock_write (page 99)
sock_flush
Syntax
void sock_flush( sock_type *skType );
Parameters
skType Current socket that will be used to flush all the data out of the buffer.
Description
This function is used to flush all the data that is still in the buffer out to the socket.
This function has no effect for UDP, since UDP is a connectionless protocol.
Return Value
None
Example
sock_type *socket;
. . .
See Also
sock_flushnext (page 102)
sock_flushnext
Syntax
void sock_flushnext( sock_type *skType );
Parameters
skType Current socket that will be used to flush all the data in the buffer out.
Description
This function is used after the write function is called to ensure that the data in a
buffer is flushed immediately.
Return Value
None
Example
sock_type *socket;
. . .
See Also
sock_flush (page 101)
sock_puts
Syntax
int sock_puts( sock_type *skType, byte *data);
Parameters
e Socket that will be used to put string data to.
data Pointer to the string that will be sent.
Description
This function sends a string to the socket. Character new line "\n", will be
attached to the end of the string.
Return Value
The length that is written to the socket.
Example
sock_type *socket;
char data [512];
int len;
. . .
See Also
sock_putc (page 104)
sock_putc
Syntax
byte sock_putc( sock_type *skType, byte character);
Parameters
skType Socket that will be used to get string data from.
character A character that is used.
Description
This function is used to put one character at a time to the socket.
Return Value
Character put in is returned.
Example
sock_type *socket;
char in;
. . .
in = sock_putc(socket, 'A');
printf("%c", in);
See Also
sock_puts (page 103)
sock_read
Syntax
int sock_read( sock_type *skType, byte *data, int len);
Parameters
skType Socket that will be used to receive data.
data Pointer to a buffer that contains data that is received.
len Length of the data specified to receive.
Description
This function reads data from the socket being passed to the function. The
function will wait until the all the data is read.
Return Value
Number of Bytes that are read to the socket or -1 if an error occurs.
Example
sock_type *socket;
char theBuffer [512];
int len, bytes_receive;
. . .
See Also
sock_fastread (page 106)
sock_fastread
Syntax
int sock_fastread( sock_type *skType, byte *data, int len);
Parameters
skType Current socket that will be used to receive data.
data Pointer to a buffer that contains data that is received to a server.
len Length of data specified to receive.
Description
This function reads data to the socket being passed to the function. The function
will not check to the data read into the socket.
Return Value
Number of bytes that are read to the socket or -1 if an error occurs.
Example
sock_type *socket;
char theBuffer [512];
int len, bytes_receive;
. . .
See Also
sock_read (page 105)
tcp_listen
Syntax
int tcp_listen( tcp_Socket *sk, word lPort, longword ina, word port,
dataHandler_t datahandler, word timeout );
Parameters
sk Pointer to the socket that has been initialized.
lPort Local port number.
datahandler Data Handler. Not used in this version. Use NULL for this parameter.
ina Host IP Address.
port Host port number.
timeout Value used to set the period of time to wait for data. 0 is set to indicate no
timeout.
Description
This function is used for listening to an incoming message. port is an option
parameter. Most of the time, port can be set to 0. The API will find an available
port number for the socket. ina is a host IP address passed as a longword.
Function resolve can be used to convert an IP address into a longword-formatted
variable. 0 can be passed as an ina value if there is no specific IP Address to
listen too.
Example
tcp_Socket *socket;
int port = 5656;
. . .
See Also
ADM_send_socket (page 70)
sock_gets
Syntax
int sock_gets( sock_type *skType, byte *data, int len);
Parameters
skType Socket that will be used to get string data from.
data Pointer to the string return.
len Specified length for the function to get the string.
Description
This function is used for obtaining a string from the socket. The len parameter
specifies how long the string will be read.
Return Value
The length read from the socket is returned.
Example
sock_type *socket;
char data [512];
int len;
. . .
See Also
sock_getc (page 109)
sock_getc
Syntax
int sock_getc( sock_type *skType);
Parameters
skType Socket that will be used to get string data from.
Description
This function gets one character at a time from the socket.
Return Value
Character read in is returned.
Example
sock_type *socket;
char in;
. . .
in = sock_getc(socket);
printf("%c", in);
See Also
sock_gets (page 108)
sock_dataready
Syntax
int sock_dataready( sock_type *skType );
Parameters
skType Current socket that will be used to check if data is ready to be read.
Description
This function is used check if there is data ready to be read.
Return Value
Number of bytes ready to be read or -1 if error occurs.
Example
int in;
sock_type *socket;
. . .
in = sock_dataready(socket);
printf("%d", in);
rip
Syntax
Char * rip( char *String );
Parameters
String Array of character string.
Description
This function is used to strip out carriage return and line feed. If there are more
than one carriage return or line feed, the first one will be replace with 0 and the
rest of them will not be defined.
Return Value
Pointer to the new string.
Example
char s;
. . .
s = sock_dataready("This is a test\n\r");
printf("%s", s);
inet_ntoa
Syntax
Char * inet_ntoa( char *String, longword IP );
Parameters
String Array of character string.
IP Decimal representation of IP address.
Description
This function builds ASCII representation of an IP address with a user supply
string from decimal representation of the IP address. The size of the buffer has to
be at least 16 byte.
Return Value
Pointer to the new string.
Example
char buffer[ 20 ];
sock_init();
inet_addr
Syntax
longword * inet_addr( char *String);
Parameters
String Array of character string.
Description
This function converts string dot address to host format.
Return Value
Host IP address format.
Example
char buffer[ ] = "[Link]";
sock_init();
In This Chapter
Contacting Technical Support ............................................................. 115
Warranty Information ........................................................................... 116
Note: For technical support calls within the United States, an after-hours answering system allows
24-hour/7-days-a-week pager access to one of our qualified Technical and/or Application Support
Engineers. Detailed contact information for all our worldwide locations is available on the following
page.
Glossary of Terms
A
API
Application Program Interface
B
Backplane
Refers to the electrical interface, or bus, to which modules connect when inserted
into the rack. The module communicates with the control processor(s) through
the processor backplane.
BIOS
Basic Input Output System. The BIOS firmware initializes the module at power
up, performs self-diagnostics, and provides a DOS-compatible interface to the
console and Flashes the ROM disk.
Byte
8-bit value
C
CIP
Control and Information Protocol. This is the messaging protocol used for
communications over the ControlLogix backplane. Refer to the ControlNet
Specification for information.
Connection
A logical binding between two objects. A connection allows more efficient use of
bandwidth, because the message path is not included after the connection is
established.
Consumer
A destination for data.
Controller
The PLC or other controlling processor that communicates with the module
directly over the backplane or via a network or remote I/O adapter.
D
DLL
Dynamic Linked Library
E
Embedded I/O
Refers to any I/O which may reside on a CAM board.
ExplicitMsg
An asynchronous message sent for information purposes to a node from the
scanner.
H
HSC
High Speed Counter
I
Input Image
Refers to a contiguous block of data that is written by the module application and
read by the controller. The input image is read by the controller once each scan.
Also referred to as the input file.
L
Library
Refers to the library file containing the API functions. The library must be linked
with the developer’s application code to create the final executable program.
Linked Library
Dynamically Linked Library. See Library.
Local I/O
Refers to any I/O contained on the CPC base unit or mezzanine board.
Long
32-bit value.
M
Module
Refers to a module attached to the backplane.
Mutex
A system object which is used to provide mutually-exclusive access to a
resource.
MVI Suite
The MVI suite consists of line products for the following platforms:
Flex I/O
ControlLogix
SLC
PLC
CompactLogix
MVI46
MVI46 is sold by ProSoft Technology under the MVI46-ADM product name.
MVI56
MVI56 is sold by ProSoft Technology under the MVI56-ADM product name.
MVI69
MVI69 is sold by ProSoft Technology under the MVI69-ADM product name.
MVI71
MVI71 is sold by ProSoft Technology under the MVI71-ADM product name.
MVI94
MVI94 and MVI94AV are the same modules. The MVI94AV is now sold by
ProSoft Technology under the MVI94-ADM product name
O
Originator
A client that establishes a connection path to a target.
Output Image
Table of output data sent to nodes on the network.
P
Producer
A source of data.
PTO
Pulse Train Output
PTQ Suite
The PTQ suite consists of line products for Schneider Electronics platforms:
Quantum (ProTalk)
S
Scanner
A DeviceNet node that scans nodes on the network to update outputs and inputs.
Side-connect
Refers to the electronic interface or connector on the side of the PLC-5, to which
modules connect directly through the PLC using a connector that provides a fast
communication path between the - module and the PLC-5.
T
Target
The end-node to which a connection is established by an originator.
Thread
Code that is executed within a process. A process may contain multiple threads.
W
Word
16-bit value
O Thread • 120
Transferring Files to and from the Module with
Operating System • 10 HyperTerminal • 43
Originator • 119
Output Image • 119 U
P udp_open • 84
udp_open_fast • 85
Package Contents • 12 Understanding the MVI-ADMNET API • 55
Pinouts • 3 Uploading files from the ADM module to a PC • 50
Port 1 and Port 2 Jumpers • 13 Using Side-Connect (Requires Side-Connect Adapter)
Preparing the MVI-ADMNET Module • 11 (MVI71) • 52
Producer • 119
PTO • 119 W
PTQ Suite • 119
Warnings • 3
R WATTCP API Functions • 77, 78
WINIMAGE
Required Software • 43 Windows Disk Image Builder • 37
resolve • 82, 83, 84, 85, 86 Word • 120
rip • 111
ROM Disk Configuration • 33 Y
S Your Feedback Please • 2
Sample Code • 56
Sample ROM Disk Image • 35
Scanner • 119
set_timeout • 91
Setting Up Your Compiler • 16
Setting Up Your Development Environment • 15
Setup Jumper • 13
Side-connect • 119
sock_abort • 97, 98
sock_close • 97, 98
sock_dataready • 110
sock_established • 88
sock_exit • 80, 96
sock_fastread • 105, 106
sock_fastwrite • 99, 100
sock_flush • 101, 102
sock_flushnext • 101, 102
sock_getc • 108, 109
sock_gets • 108, 109
sock_init • 80, 96
sock_mode • 87
sock_putc • 103, 104
sock_puts • 103, 104
sock_read • 105, 106
sock_write • 99, 100
sockerr • 93
sockstate • 94
Support, Service & Warranty • 115
T
Target • 120
tcp_listen • 107
tcp_open • 82
tcp_open_fast • 83
tcp_tick • 81
Theory of Operation • 59