Allen-Bradley documentation on the operation of the Allen-Bradley hardware. Under no conditions will ProSoft Technology, Inc. be responsible or liable for indirect or consequential damages resulting from the use or application of the product.
Theory of Operation ....................15 3.3.1 ADM API ........................15 3.3.2 ADMNET API Architecture...................15 ADM API Files ......................15 3.4.1 ADM Interface Structure ....................16 APPLICATION DEVELOPMENT FUNCTION LIBRARY: ADMNET API ........19 ADMNET API Functions ....................19 ProSoft Technology, Inc. Page 3 of 98 March 14, 2006...
Page 4
ADMNET API System Functionality ................34 tcp_tick 34 tcp_open............................ 35 tcp_open_fast ..........................36 udp_open........................... 37 udp_open_fast........................... 38 resolve 39 sock_mode ..........................40 sock_established........................41 ip_timer_init ..........................42 ip_timer_expired........................43 set_timeout ..........................44 Page 4 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 5
..........................58 sock_fastread..........................59 tcp_listen............................60 sock_gets...........................61 sock_getc...........................62 sock_dataready..........................63 inet_ntoa ............................65 inet_addr ............................66 EXAMPLE CODE ........................67 MVI_GEN.C ........................67 MAIN_APP.C.........................74 SUPPORT, SERVICE & WARRANTY .....................93 Module Service and Repair ......................93 General Warranty Policy......................94 ProSoft Technology, Inc. Page 5 of 98 March 14, 2006...
Page 6
MVI-ADMNET ♦ 'C' Programmable Contents Ethernet Module Limitation of Liability........................94 Hardware Product Warranty Details ..................95 INDEX............................... 97 Page 6 of 98 ProSoft Technology, Inc. March 14, 2006...
Flashes the ROM disk. Controller The PLC or other controlling processor that communicates with the MVI module directly over the backplane or via a network or remote I/O adapter. ProSoft Technology, Inc. Page 7 of 98 March 14, 2006...
# The gateway I wish to use gateway=192.168.0.1 # some networks (class 2) require all three parameters # gateway,network,subnetmask # gateway 192.168.0.1,192.168.0.0,255.255.255.0 # The name of my network # domainslist="mynetwork.name" Page 8 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 9
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. ProSoft Technology, Inc. Page 9 of 98 March 14, 2006...
Page 10
MVI-ADMNET ♦ 'C' Programmable Introduction Ethernet Module Page 10 of 98 ProSoft Technology, Inc. March 14, 2006...
RJ45 plug and Ethernet port located on the front of the module. Please refer to MVI ADM Developer's Guide under "Connecting Cable to Connectors" for cabling diagram on each cable protocol interface. Page 12 of 98 ProSoft Technology, Inc. March 14, 2006...
Note: The following compiler versions are intended to be compatible with the MVI module API: Borland C++ V5.02 More compilers will be added to the list as the API is tested for compatibility with them. ProSoft Technology, Inc. Page 13 of 98 March 14, 2006...
Flash ROM disk in order to be executed. Tools are provided with the API to build the disk image and download it to the module via the programming port (PRT1). Page 14 of 98 ProSoft Technology, Inc. March 14, 2006...
These files need not be present on the module when executing the application. File Name Description ADMNETAPI.H Include file ADMNETAPI.LIB Library (16-bit OMF format) ProSoft Technology, Inc. Page 15 of 98 March 14, 2006...
// other guy's window datalen; // number of bytes of data to send // must be signed unacked; // unacked data byte cwindow; // Van Jacobson's algorithm byte wwindow; Page 16 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 17
*queue; rdatalen; // must be signed word maxrdatalen; byte *rdata; byte rddata[ tcp_MaxBufSize + 1]; // if dataHandler = 0, len == 512 longword safetysig; } udp_Socket; ProSoft Technology, Inc. Page 17 of 98 March 14, 2006...
Page 18
MVI-ADMNET ♦ 'C' Programmable Understanding the MVI-ADMNET API Ethernet Module Page 18 of 98 ProSoft Technology, Inc. March 14, 2006...
Open and reopen each socket separately after socket is initialized or closed. Release all sockets that have been Release Socket ADM_release_sockets initialized using ADM_init_socket. ADM_close_sk Close each socket separately without release socket. ProSoft Technology, Inc. Page 19 of 98 March 14, 2006...
Page 20
ADM_receive_sk Receive socket with previously open with function ADM_open_sk. Miscellaneous ADM_NET_GetVersionInfo Get ADMNET API version information. ADM_is_sk_open Test if the socket is still open. Page 20 of 98 ProSoft Technology, Inc. March 14, 2006...
= 5; int portNum = 5757; int buffSize = 1000; if(ADM_init_socket(numSK, portNum, buffSize, "ReceiveSK") != SK_SUCCESS) printf("\nFailed to open ADM API... exiting program\n"); ADM_release_sockets(); See Also: ADM_release_sockets (on page 23) ProSoft Technology, Inc. Page 21 of 98 March 14, 2006...
ADM_init_socket(numSocket1, port_1, buffSize1, sockName1); while ((result = ADM_open_sk(sockName1, "0.0.0.0", USE_TCP))==SK_PROCESS_SOCKET); if (result==SK_SUCCESS) printf("successfully Opened a connection!\n"); } else { printf("Error Opening a connection! %d\n", result); See Also: ADM_close_sk (on page 24) Page 22 of 98 ProSoft Technology, Inc. March 14, 2006...
IMPORTANT: Once 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:r ADM_release_sockets(); See Also: ADM_init_socket (on page 21) ProSoft Technology, Inc. Page 23 of 98 March 14, 2006...
API could not find an initialize 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 (on page 21) Page 24 of 98 ProSoft Technology, Inc. March 14, 2006...
Socket is in the process of sending. Example: int sendLen = 10; int se; se = ADM_send_socket("sendSK", "1234567890", &sendLen, "192.168.0.148", USE_UDP); if(se == SK_SUCCESS) printf("send Success\n"); See Also: ADM_receive_socket (on page 27) ProSoft Technology, Inc. Page 25 of 98 March 14, 2006...
== 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); See Also: ADM_send_socket (on page 25) Page 28 of 98 ProSoft Technology, Inc. March 14, 2006...
APISeries[4]; short APIRevisionMajor; short APIRevisionMinor; long APIRun; }ADMNETVERSIONINFO; Return Value: None Example: ADMNETVERSIONINFO verinfo; /* print version of API library */ ADM_NET_GetVersionInfo(& verinfo); printf("Revision %d.%d\n", verinfo.APIRevisionMajor, verinfo.APIRevisionMinor); ProSoft Technology, Inc. Page 29 of 98 March 14, 2006...
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"); Page 30 of 98 ProSoft Technology, Inc. March 14, 2006...
Setup socket protocol transfer mode for the particular use (UDP or TCP). sock_established Check if connect has been established. ip_timer_init Initialize timing. ip_timer_expired Check if timer has been expired. ProSoft Technology, Inc. Page 31 of 98 March 14, 2006...
Convert string dot address to host format. ntohs Convert network word to host word htons Convert host word to network word ntohl Convert network longword to host longword htonl Convert host longword to network longword Page 32 of 98 ProSoft Technology, Inc. March 14, 2006...
//initialize the socket interface /* initialize each socket */ if(ADM_init_socket(numSK, portNum, buffSize, "ReceiveSK") != SK_SUCCESS) printf("\nFailed to open ADM API... exiting program\n"); ADM_release_sockets(); See Also: sock_exit (on page 49) ProSoft Technology, Inc. Page 33 of 98 March 14, 2006...
This function is used by an application to determine the connection status of the sockets. Return Value: disconnected or reset. >0 connected. Example: sock_type *socket; . . . if(tcp_tick(socket)) //check socket printf("Connected\n"); Page 34 of 98 ProSoft Technology, Inc. March 14, 2006...
Return Value: Connection cannot be made >0 Connection is made Example: tcp_Socket *socket; . . . if(tcp_open(socket, 0, resolve("192.168.0.1"), 5656, NULL)) printf("Open Successfully\n"); See Also: resolve (on page 39) ProSoft Technology, Inc. Page 35 of 98 March 14, 2006...
Return Value: Connection cannot be made >0 Connection is made Example: tcp_Socket *socket; . . . if(tcp_open_fast(socket, 0, resolve("192.168.0.1"), 5656, NULL)) printf("Open Successfully\n"); See Also: resolve (on page 39) Page 36 of 98 ProSoft Technology, Inc. March 14, 2006...
Return Value: Connection cannot be made >0 Connection is made Example: udp_Socket *socket; . . . if(udp_open(socket, 0, resolve("192.168.0.1"), 5656, NULL)) printf("Open Successfully\n"); See Also: resolve (on page 39) ProSoft Technology, Inc. Page 37 of 98 March 14, 2006...
IP address into a longword-formatted variable. Return Value: Connection cannot be made >0 Connection is made Example: udp_Socket *socket; . . . if(udp_open_fast(socket, 0, resolve("192.168.0.1"), 5656, NULL)) printf("Open Successfully\n"); See Also: resolve (on page 39) Page 38 of 98 ProSoft Technology, Inc. March 14, 2006...
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("192.168.0.1"); ProSoft Technology, Inc. Page 39 of 98 March 14, 2006...
TCP_NONAGLE 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); Page 40 of 98 ProSoft Technology, Inc. March 14, 2006...
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. Establish Example: sock_type *socket; . . . if(sock_established(socket)) printf("Socket has been established\n"); ProSoft Technology, Inc. Page 41 of 98 March 14, 2006...
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_init (socket, 100); Page 42 of 98 ProSoft Technology, Inc. March 14, 2006...
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: timer has been expired. Example: sock_type *socket; . . . if(ip_timer_expired (socket)) printf("time's up\n"); ProSoft Technology, Inc. Page 43 of 98 March 14, 2006...
); 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); Page 44 of 98 ProSoft Technology, Inc. March 14, 2006...
Number of timeout return from set_timerout. Description: This function is used check if the time is out. Return Value: timeout Example: int timeout = set_timeout (100); While(!chk_timeout (timeout)) printf("Not timeout yet\n"); ProSoft Technology, Inc. Page 45 of 98 March 14, 2006...
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; . . . if(p = sockerr(socket) != NULL) printf("Error: %s\n", p); Page 46 of 98 ProSoft Technology, Inc. March 14, 2006...
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; . . . if(p = sockstate(socket) != NULL) printf("State: %s\n", p); ProSoft Technology, Inc. Page 47 of 98 March 14, 2006...
This function returns value of the IP address in host format. Return Value: String IP Address. Example: sock_type *socket; char *p; . . . if(p = gethostid(socket) != NULL) printf("My IP: %s\n", p); Page 48 of 98 ProSoft Technology, Inc. March 14, 2006...
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 (on page 33) ProSoft Technology, Inc. Page 49 of 98 March 14, 2006...
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 (on page 51) Page 50 of 98 ProSoft Technology, Inc. March 14, 2006...
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 (on page 50) ProSoft Technology, Inc. Page 51 of 98 March 14, 2006...
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; . . . bytes_sent = sock_write(socket, (byte*)theBuffer, len); See Also: sock_fastwrite (on page 53) Page 52 of 98 ProSoft Technology, Inc. March 14, 2006...
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; . . . bytes_sent = sock_fastwrite(socket, (byte*)theBuffer, len); See Also: sock_write (on page 52) ProSoft Technology, Inc. Page 53 of 98 March 14, 2006...
This function has no effect for UDP, since UDP is a connectionless protocol. Return Value: None Example: sock_type *socket; . . . sock_flush(socket); // Flush the output See Also: sock_flushnext (on page 55) Page 54 of 98 ProSoft Technology, Inc. March 14, 2006...
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; . . . sock_flushnext(socket); // Flush the output See Also: sock_flush (on page 54) ProSoft Technology, Inc. Page 55 of 98 March 14, 2006...
The length that is written to the socket. Example: sock_type *socket; char data [512]; int len; . . . len = sock_puts(socket, data); printf("Put %d\n", len); See Also: sock_putc (on page 57) Page 56 of 98 ProSoft Technology, Inc. March 14, 2006...
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 (on page 56) ProSoft Technology, Inc. Page 57 of 98 March 14, 2006...
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; . . . bytes_receive = sock_read(socket, (byte*)theBuffer, len); See Also: sock_fastread (on page 59) Page 58 of 98 ProSoft Technology, Inc. March 14, 2006...
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; . . . bytes_receive = sock_fastread(socket, (byte*)theBuffer, len); See Also: sock_read (on page 58) ProSoft Technology, Inc. Page 59 of 98 March 14, 2006...
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; . . . tcp_listen(socket, port, 0L, 0, NULL, 0); See Also: ADM_send_socket (on page 25) Page 60 of 98 ProSoft Technology, Inc. March 14, 2006...
The length read from the socket is returned. Example: sock_type *socket; char data [512]; int len; . . . len = sock_gets(socket, data, 100); printf("Get %d\n", len); See Also: sock_getc (on page 62) ProSoft Technology, Inc. Page 61 of 98 March 14, 2006...
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 (on page 61) Page 62 of 98 ProSoft Technology, Inc. March 14, 2006...
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); ProSoft Technology, Inc. Page 63 of 98 March 14, 2006...
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); Page 64 of 98 ProSoft Technology, Inc. March 14, 2006...
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(); printf("My IP address is %s\n", inet_ntoa( buffer, gethostid())); ProSoft Technology, Inc. Page 65 of 98 March 14, 2006...
This function converts string dot address to host format. Return Value: Host IP address format. Example: char buffer[ ] = "192.168.0.1"; sock_init(); printf("My IP address is %ld\n", inet_addr( buffer )); Page 66 of 98 ProSoft Technology, Inc. March 14, 2006...
// HEREBY EXCLUDED. THE ENTIRE RISK ARISING OUT OF USING THE SOFTWARE IS ASSUMED // BY THE LICENSEE. // PROSOFT TECHNOLOGY, INC. AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY // DAMAGES SUFFERED BY LICENSEE OR ANY THIRD PARTY AS A RESULT OF USING OR // DISTRIBUTING SOFTWARE.
Page 68
MVI-ADMNET ♦ 'C' Programmable Example Code Ethernet Module // OR INABILITY TO USE SOFTWARE, EVEN IF PROSOFT TECHNOLOGY, INC. HAS BEEN // ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. //////////////////////////////////////////////////////////////////////////// #include <stdio.h> #include <conio.h> #include <string.h> #include <dos.h> #include <stdlib.h>...
Page 69
// install in ISR handler for CTRL-Break setcbrk(0); // force DOS to ignore Ctrl-C enable(); if(!setup_module()) // Initialize hardware and load drivers printf("Error: Can't initialize setup\n"); shutdown_module(); // if fail on init then shutdown return; ProSoft Technology, Inc. Page 69 of 98 March 14, 2006...
Page 70
// program moves data across the backplane in one transfer // in the following structure through the Input Image // Word 0 : Status word - Bit 0 : toggles on new value on port 1 Page 70 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 71
&str2[sptr2], _LF, &len2, TIMEOUT_ASAP) == MVI_SUCCESS) // following is example of moving a floating point value, w/ words // swapped for PLC format // sscanf((char *)str2,"%f",&data_buff.fl[1]); // *(wrbuff+3) = data_buff.i[3]; // *(wrbuff+4) = data_buff.i[2]; ProSoft Technology, Inc. Page 71 of 98 March 14, 2006...
Page 72
// Open serial interface API // Set comm parameters printf("Open com port%d\n", COM2); se = MVIsp_Open(COM2, BAUD_9600, PARITY_NONE, WORDLEN8, STOPBITS1); if(se != MVI_SUCCESS) printf("ERROR: Cannot open COM%d application port!\n", COM2); return 0; Page 72 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 73
// Output: The function will always return a value of 1. /////////////////////////////////////////////////////////////////////////////// int shutdown_module(void) MVIbp_SetUserLED(mod_handle, MVI_LED_USER1, MVI_LED_STATE_OFF); MVIbp_SetUserLED(mod_handle, MVI_LED_USER2, MVI_LED_STATE_OFF); MVIbp_SetModuleStatus(mod_handle, MVI_MODULE_STATUS_FAULTED); #ifdef SOCKET_ENABLE printf("Releasing Sockets.."); ADM_release_sockets(); #endif MVIbp_Close(mod_handle); MVIsp_Close(COM2); MVIsp_Close(COM3); return 1; ProSoft Technology, Inc. Page 73 of 98 March 14, 2006...
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE ** HEREBY EXCLUDED. THE ENTIRE RISK ARISING OUT OF USING THE SOFTWARE IS ASSUMED ** BY THE LICENSEE. ** PROSOFT TECHNOLOGY, INC. AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY Page 74 of 98 ProSoft Technology, Inc.
Page 75
** INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER ** CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF ** OR INABILITY TO USE SOFTWARE, EVEN IF PROSOFT TECHNOLOGY, INC. HAS BEEN ** ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Page 76
MVIBPMODULEINFO idobj; /* module info struct */ #if defined(MVI71) static MVISCVERSIONINFO scverinfo; /* side-connect API version struct */ #endif #endif static MVISPVERSIONINFO spverinfo; /* serial API version struct */ Page 76 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 77
This is the entry point of the ADM example application. This routine initializes the module, then enters the main loop where the module communicates with the PLC via the backplane, and communicates through the application serial ports. ProSoft Technology, Inc. Page 77 of 98 March 14, 2006...
Page 78
The names of the structures may be changed to suit the developer's needs. The interface structure must be initialized before it can be used. ******************************************************************* /* initialize structure pointers */ Page 78 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 79
0, sizeof(ADM_BT_DATA)); memset(interface.adm_bt_err_ptr, 0, sizeof(ADM_BLK_ERRORS)); memset(interface.adm_module_ptr, 0, sizeof(ADM_MODULE)); for(i=0;i<MAX_APP_PORTS;i++) memset(interface.adm_port_ptr[i], 0, sizeof(ADM_PORT)); for(i=0;i<MAX_APP_PORTS;i++) memset(interface.adm_port_errors_ptr[i], 0, sizeof(ADM_PORT_ERRORS)); /* clear application error flag */ interface.Apperr = 0; /************************ end of section ******************************/ ProSoft Technology, Inc. Page 79 of 98 March 14, 2006...
/* install in ISR handler for CTRL-Break */ setcbrk(0); /* force DOS to ignore Ctrl-C */ enable(); /* enable interrupts */ printf("Open Communication Ports..\n"); /* open application port 1 (COM2) */ for(i=0;i<MAX_APP_PORTS;i++) Page 80 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 81
#else if(!interface.cfg_file) //use block transfer ADM_BtFunc(adm_handle, interface_ptr, 1); //call backplane transfer logic else //use side-connect interface if((stat_db & 0x03) == 3) //data update every ~10 milliseconds ADM_ScScan(adm_handle, interface_ptr, 1); #endif ProSoft Technology, Inc. Page 81 of 98 March 14, 2006...
Page 82
'2': ADM_close_sk(sockName1); printf ("Connection Closed!\n"); break; case '3': if(ADM_is_sk_open(sockName1) != SK_SUCCESS) { printf("Socket not Opened\n"); } else { printf("Socket Opened\n"); break; case '4': while ((result=ADM_receive_sk(sockName1, holdingReg, &readLen, fromIP)) == SK_PROCESS_SOCKET); Page 82 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 83
== %d\n", readLen); for (i=0; i<readLen; i++) printf("%c", *(holdingReg+i)); break; case '7': sprintf(holdingReg,"abcdefghijklmnopqrstuvwxyz-"); sendLen = 27; while((rec = ADM_send_socket(sockName1, holdingReg, &sendLen, "192.168.0.145", USE_TCP)) == SK_PROCESS_SOCKET); if(rec == SK_SUCCESS) printf("%s\n", holdingReg); ProSoft Technology, Inc. Page 83 of 98 March 14, 2006...
Page 84
/* LED flash timer for errors */ tmlast = ADM_StartTimer(adm_handle); tmled = 100000L; App_LED(); shutdown(); ADM_SetLed(adm_handle, interface_ptr, ADM_LED_STATUS, ADM_LED_FAULT); ADM_SetLed(adm_handle, interface_ptr, ADM_LED_USER1, ADM_LED_OFF); ADM_SetLed(adm_handle, interface_ptr, ADM_LED_USER2, ADM_LED_OFF); ADM_Close(adm_handle); /* close ADM API */ Page 84 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 85
// ignore the side connect if(ADM_ReadBtCfg(adm_handle, interface_ptr, 1)) // initialize for // backplane interface. return 1; else // use the side connect. the value in the config side-connect file is // between 4-200 ProSoft Technology, Inc. Page 85 of 98 March 14, 2006...
Page 86
= 0; ADM_CheckTimer(adm_handle, &tmlast, &dummy); ShowVersion(); /* write buffer to console */ while(interface.buff_len) interface.buff_len = ADM_ConPrint(adm_handle, interface_ptr); printf("Press ? for menu help.\n\n"); ADM_SetLed(adm_handle, interface_ptr, ADM_LED_STATUS, ADM_LED_OK); ADM_SetLed(adm_handle, interface_ptr, ADM_LED_USER1, ADM_LED_OFF); Page 86 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 87
/* close the backplane driver */ printf("Closing Backplane Driver..\n"); ADM_BtClose(adm_handle, interface_ptr); /* close database */ printf("De-allocating Module Database..\n"); ADM_DBClose(adm_handle); ADM_SetLed(adm_handle, interface_ptr, ADM_LED_USER1, ADM_LED_OFF); ADM_SetLed(adm_handle, interface_ptr, ADM_LED_USER2, ADM_LED_OFF); ADM_SetLed(adm_handle, interface_ptr, ADM_LED_STATUS, ADM_LED_OK); printf("Program Terminated.\n\n"); return 0; ProSoft Technology, Inc. Page 87 of 98 March 14, 2006...
Page 88
If called outside of the debug menu the buffer must be emptied before moving on. Arguments: none External effects: Uses debug port console buffer. Return value: none **--------------------------------------------------------------------------- void ShowVersion(void) Page 88 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 89
#endif #endif MVIsp_GetVersionInfo(&spverinfo); #if defined(MVI71) if(interface.cfg_file) // ignore the side connect sprintf(interface.buff,"\nVERSION INFORMATION:\n\n\ %s\n\ (c) 1999-2001, ProSoft Technology, Inc.\n\n\ PRODUCT NAME CODE : %c%c%c%c\n\ SOFTWARE REVISION LEVEL : %c%c%c%c\n\ OPERATING SYSTEM REVISION : %c%c%c%c\n\ RUN NUMBER : %c%c%c%c\n\n\ BACKPLANE DRIVER VERSION : %d.%d\n\...
Page 90
MVI-ADMNET ♦ 'C' Programmable Example Code Ethernet Module else #endif #ifdef SOCKET_ENABLE sprintf(interface.buff,"\nVERSION INFORMATION:\n\n\ %s\n\ (c) 1999-2001, ProSoft Technology, Inc.\n\n\ PRODUCT NAME CODE : %c%c%c%c\n\ SOFTWARE REVISION LEVEL : %c%c%c%c\n\ OPERATING SYSTEM REVISION : %c%c%c%c\n\ RUN NUMBER : %c%c%c%c\n\n\ BACKPLANE DRIVER VERSION : %d.%d\n\...
Page 91
= number of byte written back to PLC. Always return at least two byte to indicate successful operation. **--------------------------------------------------------------------------- int CtrlDataBlock(unsigned short blockNo) int len; //length of byte written back to the PLC. switch(blockNo) ProSoft Technology, Inc. Page 91 of 98 March 14, 2006...
Page 92
9000: ShowVersion(); *interface.adm_bt_data_ptr->buff = 0; //first byte always set to Zero *(interface.adm_bt_data_ptr->buff+1) = 9000; //second byte indicates successful operation. len = 2; break; default: len = 0; break; return len; Page 92 of 98 ProSoft Technology, Inc. March 14, 2006...
When purchased from ProSoft Technology, Inc., the device has a 1 year parts and labor warranty (3 years for RadioLinx) according to the limits specified in the ProSoft Technology, Inc.
General Warranty Policy ProSoft Technology, Inc. (Hereinafter referred to as ProSoft) warrants that the Product shall conform to and perform in accordance with published technical specifications and the accompanying written materials, and shall be free of defects in materials and workmanship, for the period of time herein indicated, such warranty period commencing upon receipt of the Product.
ProSoft. If ProSoft determines that the Product is not under warranty, it will, at the Customer's option, repair the Product using current ProSoft standard rates for parts and labor, and return the Product freight collect. ProSoft Technology, Inc. Page 95 of 98 March 14, 2006...
Page 96
MVI-ADMNET ♦ 'C' Programmable Support, Service & Warranty Ethernet Module Page 96 of 98 ProSoft Technology, Inc. March 14, 2006...
Page 98
• 34 Theory of Operation • 15 udp_open • 37 udp_open_fast • 38 Understanding the MVI-ADMNET API • 13 WATTCP API Functions • 31 Your Feedback Please • 2 Page 98 of 98 ProSoft Technology, Inc. March 14, 2006...
Need help?
Do you have a question about the inRAx MVI-ADMNET and is the answer not in the manual?
Questions and answers