Atop ABLELink GW21 MAXI Series Programming Manual

Atop ABLELink GW21 MAXI Series Programming Manual

Serial server software development kit
Table of Contents

Advertisement

Quick Links

TM
ATOP ABLELink
Serial Server
GW21x-MAXI
Software Development Kit
Programming Guide
Version 1.511
Updated at: 2004/05/14
ATOP Technologies, Inc.
Tel: 886-3-5508137
Fax: 886-3-5508131
E-mail:
service@atop.com.tw

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ABLELink GW21 MAXI Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Atop ABLELink GW21 MAXI Series

  • Page 1 ATOP ABLELink Serial Server GW21x-MAXI Software Development Kit Programming Guide Version 1.511 Updated at: 2004/05/14 ATOP Technologies, Inc. Tel: 886-3-5508137 Fax: 886-3-5508131 E-mail: service@atop.com.tw...
  • Page 2 Ethernet-Serial Server MAXI Series IMPORTANT ANNOUNCEMENT The information contained in this document is the property of Atop Technologies, Inc. and is supplied for the sole purpose of the operation and maintenance of products of Atop Technologies, Inc. No part of this...
  • Page 3 Use only shielded cables to connect other devices to this equipment by RS-232 / RS-485 ports. Be cautioned that changes or modifications not expressly approved by the party responsible for compliance could void your authority to operate the equipment. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 4: Table Of Contents

    IGITAL UTPUT VERVIEW 5.10 R .................... 35 LOCK VERVIEW 5.11 A ......................36 CCOUNT VERVIEW 5.12 W LAN C ................36 IRELESS OMMAND VERVIEW 6. API REFERENCE .......................39 Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 5 () ........................51 ETUP () ....................... 51 ETUP ROCESS () ........................52 ECTOR () ........................52 ECTOR ().......................... 53 ERSION SYSTEM_RESET() .........................54 ........................54 ERIAL ........................54 ERIAL Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 6 ATCH () ......................74 ETUP ATCH ()........................... 74 () .......................... 74 ()........................75 TATE () ........................... 75 TATE RTCT ......................... 75 RTCD ........................76 RTCT ........................76 RITE Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 7 ................ 88 GW51W-MAXI HANNEL ONLY RFTXR .................. 88 GW51W-MAXI ONLY ..................88 GW51W-MAXI ONLY ..................89 GW51W-MAXI ONLY APPENDIX A: SERIAL PORT CONFIGURATION TABLE..........90 APPENDIX B. UPGRADE SYSTEM SOFTWARE............93 Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 8 APPENDIX D. CONFIGURATION UTILITY..............105 D.1 R ....................... 105 UN THE UTILITY D.2 D ............ 106 ETECTING PERATIONAL ONTROLLERS AND EVICES D.3 C ..............107 ONFIGURING ONTROLLERS AND EVICES Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 9: Introduction

    By using the RS-232/RS-485 ports, it functions as a gateway between field bus and Ethernet. The development toolkit is ATOP ABLELink Embedded Serial Server SDK. It contains a set of API library, sample programs, development utilities, a download utility and a configuration utility. You can develop an application program in a PC-based environment.
  • Page 10 Ethernet-Serial Server MAXI Series Figure 1.1 System Architecture of GW21x-MAXI Applications The GW21x-MAXI is one model of ATOP Embedded ABLELink Serial Servers. Please refer to Figure 1.2 GW21x-MAXI Front View. There is a Evaluation Module that provides power connector, RJ-45 connector of Ethernet, D-type 9 pin connector of RS-232, LEDs, …...
  • Page 11 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Figure 1.2 GW21x-MAXI+ Front View Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 12 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 13: Installation

    ATOP Table 2-1 Development Tools Note: 1. These compilers have been tested and found fully compatible with the ATOP ABLELink Serial Server. The final version is MSVC 1.52. 2. For debugging and simulation purpose. Please refer to section 4.1 for more details.
  • Page 14: Content

    :accessory file of DAPTCPIP.EXE, it is the HOST.CFG TCP/IP configuration file for MS-DOS :a batch file to startup TCP/IP driver in PC PC_TCPIP_START.BAT :a batch file to stop and remove TCP/IP driver in PC_TCPIP_STOP.BAT Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 15 :declare functions of serial port API COMAPI.H :for 8087 emulation mode library …\NEWLIB\ EMINIT.OBJ :make file for re-building MSC library MAKEFILE :batch file for re-build MSC library MEMU.BAT Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 16 :accessory file of MONITOR.EXE SEG.CFG :a SDK document of GW21x-MAXI … \DOC\ GW21x-MAXI Reference Guide.doc :a download firmware utility for GW21x-MAXI … \DOWNLOAD\ GWDL.EXE :accessory file of GWDL.EXE DAPDL.CFG Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 17 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series :a batch file to download firmware to GW21x-MAXI DOWNLOAD.BAT Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 18 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 19: Development Description

    GW21x-MAXI SDK. For more information, you can refer chapter 2. The process flow of developing an application program is as following: C ASM COMPILER .LIB LINK USERLOC.CMD .EXE EXE2HEX XOH86 Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 20 After writing application program, you can compile the program. The C compiler option arguments are ”/AL /Zi /Gs /c /Oi /I. /Fpi”. For example, to compile ‘userap.c’ is as following: cl /AL /Zi /Gs /c /Oi /I. /Fpi userap.c. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 21 Step 4. Run the Microsoft utility: ‘nmake’ to do compiler, link and locate procedures. And then check the ‘userap.err’ file to get the result messages. To run the nmake utility may be like followings: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 22: Locate Application Program On Ablel Ink Tm Serial Server

    After you have generated the user application programs in .exe format and before downloading them to the Serial Server, please do the following: Find the memory location of the user application program .exe file: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 23: Process Flow Of Serial Server Kernel

    You may short the JP1 (in main board) to prevent the user application program from running. This function is particularly used in the situation that you download a wrong firmware causing the GW21x-MAXI system down and the correct application program firmware cannot be downloaded. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 24 Because the time intervals between them are too short, we cannot identify each other but maybe only one. The operational flow of the system is depicted in the following picture. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 25 Upon downloading , DAP will suspend Jump to IDLE LOOP GW21S-512 will User AP Anything,and GOTO 2 (WAIT DOWNLOADING) suspend anything and (ENDLESS LOOP) RUN-LED RUN-LED Always On Always Blinking Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 26 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 27: Advance Course

    The ‘Out1’ bit of MCR (Modem Control Register) is used to control the COM LED. DOS-dependent functions Fully supported. Serial Server Only support following functions: SetIntrVector( ), GetIntrVector( ) and GetVersion( ). BIOS-dependent functions Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 28 INT10H: Video, Audio I/O and Run LED functions. (This is like INT10H of DOS) INT14H: Serial I/O functions. (This is like INT14H of DOS) INT1CH: Software timer interrupt (every 55 ms). (This is like INT1CH of DOS) Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 29: Download Multiple Application Programs

    3. The code and data segments cannot be overlapped. 4. By editing the ‘userloc.cmd’ file, you can change the code segment and data segment value as you wish. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 30 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 31: Api Overview

    Get the type of COM (RS-232/RS-485). GetConsol Get the state of console mode. eSta Getnewporttype Get the type of COM Port (RS232/RS422/RS485). GetTotalPort Get the count of serial ports. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 32: Audio & Led Function Overview

    ) function call. If the sequence is wrong, the data might be lost. The maximum data length per packet must be less than 1460 bytes. Function Descriptions Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 33 Store the pointer of the sending buffer by tcp_send and udp_send Short Store the expect to send data length of the sending buffer by Sendlen tcp_send and udp_send Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 34: Memory Function Overview

    Post routine Descriptions 1 ms timer interrupt INT 7D INT 7D is called every 1 ms 5 ms timer interrupt INT 7F INT 7F is called every 5 ms Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 35: Watch Dog Timer Overview

    ISR will get these data and send to serial port automatically. The sent queue is defined in ‘comalo.c”. You can modify this file to change the size of queue. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 36: Digital Input And Digital Output Overview

    Read system date (including: year, month, day, week) WriteRTCTime Write system time (including: hour, min, sec). WriteRTCDate Write system date (including: year, month, day, week). EnableWRProtect Allow to write system date/time. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 37: Account Overview

    Get communication channel number for BSS creation SetChannel Get net connection control characteristics GetNetWorkType Get net connection control characteristics SetNetWorkType Set net connection control characteristics GetTransmitRate Get data rate for message transmission Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 38 Get the real transmission rate when linking with Access Point GetAPName Get the name of Access Point which linking with GetAPMac Get the MAC address of Access Point which linking with Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 39 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 40: Api Reference

    Bit 3 = Delta Receive Line Signal Detect Bit 2 = Trailing Edge Ring Indicator Bit 1 = Delta Data Ready Bit 0 = Delta Clear to Send Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 41: Sendserialdata()

    This function sends one character data out to the specific serial port. GetSerialData() Description: Receive data from the serial port. Include: DAPAPI.H Usage: ushort GetSerialData (ushort port) Input Parameters: port: serial port number of Serial Server, 0: 1st port Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 42: Getserialstatus()

    EnableSerialHWintr (ushort port) Input Parameters: port: serial port number of Serial Server, 0: 1st port Return Value: None Enable the 1st serial port H/W interrupt. Example: EnableSerialHWintr( 0 ) Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 43: Disableserialhwintr()

    Set the RS-485 transceiver to TX mode. Include: DAPAPI.H Usage: void EnableRS485tx (ushort port) Input Parameters: port: serial port number of Serial Server, 0: 1st port Return Value: None Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 44: Serialintreoi()

    0 : for 1st port ,bit 1: 2nd port Return Value: None Example: Set485type(0x01) Remarks: Select RS-485 /RS-422. Bit 1 Bit 0 Com Port 2 Com Port 1 RS-422 RS-422 RS-422 RS-485 RS-485 RS-422 RS-485 RS-485 Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 45: Get485Type()

    Com Port 1 RS-485 RS-232 GetConsoleSta Description: Get the state of a jumper. It is used as console mode. Include: DAPAPI.H Usage: ushort GetConsoleSta( void); Input Parameters: None Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 46: Getnewporttype

    Get the count of serial ports. Include: DAPAPI.H ushort GetTotalPort ( void); Usage: Input Parameters: None Return Value: >=0: count of serial ports Example: ushort port_count ; port_count = GetTotalPort (); Remarks: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 47: C Onfig ()

    Serial Server, 0: 1st port buf: Give a buffer for storing received data. cnt: Size of buffer. Return Value: Count of received data in buffer, 0: no data. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 48: Com _P Ut Buf ()

    = Com_PutBuf( com_port, buf, cnt) ; //put data to com port if (ret<=0) { //error, sent buffer of ISR is not enough else { //send ok Remarks: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 49: Com_Clearrxque()

    Include: comapi.h Usage: int Com_TxQueIsEmpty (int iport) Input Parameters: iport: serial port number of Serial Server, 0: 1st port Return Value: 0:not empty, <>0:empty. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 50: Com _Dtr_A Ctive ()

    Usage: void Com_RTS_Active (int iport, int active) Input Parameters: iport: serial port number of Serial Server, 0: 1st port active: 0: inactive, 1: active Return Value: none. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 51: Com _Dsr_S Tatus ()

    // 0:COM1 Example: status = Com_CTS_Status( com_port) ; Remarks: BuzzerOn() Make a buzzer on(GW21) / Run LED blinking (GW21x-MAXI). Description: Include: DAPAPI.H Usage: void BuzzerOn ( void ) Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 52: Setupcomled()

    This function and BuzzerOn() function both control the same DO (maybe RUN LED or buzzer), except that SetupProcessLed() is a state changed function and BuzzerOn() is a trigger function. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 53: Getintrvector()

    Set ISR (Interrupt Service Routine) entry point. Include: DAPAPI.H Usage: void SetIntrVector (uchar vector, farFUNC isr ) Input Parameters: vector target interrupt vector to replace isr: the entry point of ISR Return Value: None Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 54: Getversion()

    Input Parameters: Return Value: Low byte: major version number High byte: minor version number Example: ushort dap_version; dap_version = GetVersion() Gets the Serial Server firmware version number. Remarks: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 55: System_Reset()

    30 characters then it is with 1 byte null terminator. If the AP version string is 30 characters then it is without null terminator.) Return Value: None Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 56: Getgwmodel

    TCP socket port number toIPaddr: the IP address of remote device which you want to connect to toPort: remote TCP socket port number postfunc: entry point of the post-function Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 57 This function is used by the client device to establish a connection with the server device. Upon the server issuing tcp_listen command, the connection will be established accordingly. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 58: Tcp_Listen()

    (client or server) will disconnect first and the other device will disconnect in 5 seconds for garbage processing. You can establish a new connection between these two devices again. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 59: Tcp_Send()

    The maximum data length is 1460 bytes. In the post-function, you can check whether this function is successful or not. In the tcp_send post-function, you can issue tcp_send again. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 60: Tcp_Receive()

    Normally, the first time to call tcp_receice is in the tcp_listen or tcp_connect post-function. In the tcp_receive post-function, you can issue tcp_receive again. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 61: Tcp_Getdata()

    This function is almost the same as tcp_receive. The difference between Remarks: these two functions is that tcp_getdata is without post-function. The practical received data length will store into the plen. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 62: Udp_Open()

    Return Value: SUCCESS disconnect is successful others error, the definition of ERROR number please refer to the file “tcpdef.h” Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 63: Udp_Receive()

    Return Value: SUCCESS successful others error, the definition of ERROR number please refer to the file “tcpdef.h” Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 64: Udp_Receivex()

    *pbuf, short len, farFUNC postfunc, void far *parg) Input Parameters: handle the handle of the UDP channel created by fromPort incoming data source node port number Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 65: Udp_Send()

    (int handle, short toPort, long toIPaddr, char far *pbuf, short len) Input Parameters: Handle the unique handle of the established connection toPort outgoing data destination node port number toIPaddr outgoing data destination node IP address data length Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 66: Udp Reset ()

    ( ); wait ( 5 ); // wait for 5 seconds for garbage collection Remarks: This function is used to close all of the UDP communication channels Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 67: Getlocalipaddr()

    GetLocalEthAddr (char far *buf ) Input Parameters: buffer to store the ETHERNET address Return Value: SUCCESS successful others error, the definition of ERROR number please refer to the file “tcpdef.h” Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 68: Getdefaultgateway()

    Server. A keyboard can be used to set this address. Each Serial Server has a default gateway IP address to forward the TCP/IP packet to another segment of the network. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 69: Getlocalnetmask()

    0x8000 0x8000:0000 ~ 0x8000:FFFF 0x9000 0x9000:0000 ~ 0x9000:FFFF 0xA000 0xA000:0000 ~ 0xA000:FFFF 0xB000 0xB000:0000 ~ 0xB000:FFFF 0xC000 0xC000:0000 ~ 0xC000:FFFF 0xD000 0xD000:0000 ~ 0xD000:FFFF Return Value: successful others error Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 70: Progonebyte()

    If you want to write the second times, you must call EraseSector() function to erase the sector:64K and then write the data. Return Value: successful others error Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 71: Progstring()

    2. All addresses in flash memory can be written only one times. If you want to write the second times, you must call EraseSector() function to erase the sector:64K and then write the data. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 72: Readeeprom()

    Read the 5th word data in the serial EEPROM. ushort ee_data; ee_data = ReadEEPROM ( 4 ); This function is used to read one word data stored in the serial EEPROM. Remarks: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 73: Writeeeprom()

    IP address, Router address and netmask. DAPAPI.H Include: Usage: void WriteMacEEPROM( ushort id ,ushort mac_addr) ; Input Parameters: // 10H,11H: Setup IP address // 12H,13H: Setup router address // 14H,15H: Setup netmask address Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 74: Watchdogctrl()

    When the watch dog timer is set to be controlled by user, the AP must call this function to clear watch dog timer before watch dog is timeout to reset itself. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 75: Setupwatchdogtime()

    // set channel 1 to DI SetIOMode(1,0); // set channel 2 to DO Remarks: GetIOMode() Description: Get a channel’s I/O mode. g21s3api.h Include: Usage: ushort GetIOMode( uchar channel) ; Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 76: Setoutstate()

    0:off, 1:on Example: state1 = GetInState(0); // get channel-1 DI/DO state state4 = GetInState(3); // get channel-4 DI/DO state Remarks: ReadRTCTime Description: Read the system time from the RTC. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 77: Readrtcdate

    : 0x00 ~ 0x59 (60 minutes, BCD format). second : 0x00 ~ 0x59 (60 seconds, BCD format). Return Value: None Example: //if set the time to (14:23:59) WriteRTCTime(0x14, 0x23, 0x59); Remarks: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 78: Writertcdate

    EnableWRProtect(); Remarks: DisableWRProtect Description: Disable RTC write protect. (user can read and write RTC). Include: DAPAPI.H Usage: void DisableWRProtect(void); Input Parameters: void Return Value: None Example: DisableWRProtect(); Remarks: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 79: Getstartuptime

    The max. time interval is 2^32-1 tick. It is about 2734 days (about 7.5 years). GetSysTime Description: Get a time interval from system startup. It is by second. Include: DAPAPI.H Usage: ulong GetSysTime( void); Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 80: Addaccount

    %s","admin",password); ret=AddAccount(namepwd); if (ret==0) { //overflow else { //add ok Remarks: For example: user name is “john” and password is “12345”, then the name_pwd will be “john 12345” Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 81: Delaccount

    0: error, ether user name not exist or password not correct 1: verify ok Example: char namepwd[80], password[20]; … sprintf(namepwd,"%s %s","admin",password); ret=VerifyAccount(namepwd); if (ret==0) { //error, not correct else { //verify ok Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 82: Getessid (For Gw51W-Maxi Only)

    32 bytes GetFrame (for GW51W-MAXI only) Description: Get frame length used for RTS/CTS handshake control Include: DAPAPI.H Usage: uint GetFrame (void); Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 83: Setframe (For Gw51W-Maxi Only)

    (for GW51W-MAXI only) Description: Get fragment length for unicast message transmission Include: DAPAPI.H Usage: uint GetFragment (void); Input Parameters: None Return Value: Fragment length Example: GetFragment(); Remarks: Default:2346 Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 84: Setfragment (For Gw51W-Maxi Only)

    Default:3 SetChannel (for GW51W-MAXI only) Description: Set communication channel number for BSS creation Include: DAPAPI.H Usage: void SetChannel (uchar channel_no); Input Parameters: Channel_no Return Value: None Example: SetChannel(channel_no); Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 85: Getnetworktype (For Gw51W-Maxi Only)

    Networktype : 1 or 3 Return Value: None Example: SetNetWorkType(networkrtype); Remarks: Network Type : 1:InfraStructure,3:Ad-hoc; GetTransmitRate (for GW51W-MAXI only) Description: Get data rate for message transmission Include: DAPAPI.H Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 86: Settransmitrate (For Gw51W-Maxi Only)

    Input Parameters: None Return Value: WEP flag : 0:Disable WEP, 1 : use WEP 1 2 : use WEP 2 3 : use WEP 3 4: use WEP 4 Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 87: Setxi300Wepflag (For Gw51W-Maxi Only)

    Include: DAPAPI.H Usage: ushort GetXI300WEPBit(void); Input Parameters: None Return Value: WEP Bit : 0 : 40 Bits, 1 : 128 Bits Example: Wep_bits = GetXI300WEPBit (); Remarks: Default:1 Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 88: Setxi300Wepbit (For Gw51W-Maxi Only)

    (for GW51W-MAXI only) Description: Set WEP Key Include: DAPAPI.H Usage: void void SetXI300WEPKey(ushort id, uchar *buf) ; Input Parameters: Id:No of WEP Key buf:buffer for Setting the WEP Key Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 89: Getrfrealchannel (For Gw51W-Maxi Only)

    Return Value: Transmit_rate : 1,2,3,4,8 Example: GetRFTxRate (); Remarks: Transmit Rate : 1:1Mb,2:2Mb,3:Auto 1/2,4:5.5Mb,8:11Mb, GetAPName (for GW51W-MAXI only) Description: Get the name of Access Point which linking with Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 90: Getapmac (For Gw51W-Maxi Only)

    Get the MAC address of Access Point which linking with Include: DAPAPI.H Usage: void GetAPName(uchar * buf); Input Parameters: buf:AP mac address Return Value: None Example: GetAPName(* uchar); Remarks: Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 91: Appendix A: Serial Port Configuration Table

    X: Don’t care Stop Bit Table Bit 2 Number of stop bit Data Length Table Bit 1 Number of data bit The default setting is (9600, n, 8, 1). Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 92 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series The baud rate 9600, none parity, 8-bit data, 1 stop bit 0xe3H Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 93 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 94: Appendix B. Upgrade System Software

    Step 3: Prepare the download tool. The utility program gwdl.exe and its configuration file dapdl.cfg can be found in the GW21x-MAXI product CD or diskette or from ATOP’s Web site. Step 4: Edit the "dapdl.cfg" file to fit your system and configurations. The format of the file looks like the following.
  • Page 95: Critical Issues Of Upgrading

    If everything is OK, the GW21x-MAXI's RUN LED blinks 3 times. It will then restart. Normally, it will take around 10 seconds to complete programming the flash memory. B.3 Error Messages Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 96 The GW21x-MAXI ACK Start Address Error handshaking problem The GW21x-MAXI ACK Length Error The GW21x-MAXI Response Command Error Configuration file Remote IP not found Open configuration file failure Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 97 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 98 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 99: Appendix C:sample Program

    #define MY_PORT 0x1234 #define NULL_ARG (char far *)0 int handle; int connect_f = _ERR ; int recv_f = _ERR ; int send_f = _ERR ; unsigned char recvbuf[DEF_MSS]; Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 100 = "Hello, this is GW21 series\r\n" ; ret = tcp_send( handle, ptr, strlen(ptr), send_post, NULL_ARG); if ( ret != SUCCESS) { //if connection failed tcp_disconnect( handle ) ; //diconnect break ; //try again Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 101 _loadds far recv_post( CMDBLK far *cb, void far *arg) int ret, recv_cnt ; unsigned char far *recvbuf_ptr ; //----- check receive success or not if( cb->retcode != SUCCESS ) { connect_f = _ERR; return; Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 102 (unsigned char far *)recvbuf, sizeof(recvbuf), recv_post, 0l ); void _loadds far listen_post( CMDBLK far *cb, void far *arg) //----- check listen success or not if( cb->retcode != SUCCESS ) { connect_f = _ERR ; Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 103: Serial Port Sample Program

    *You can use the 'terminal' utility to test this sample program -------------------------------------------------------------------------------------------------------*/ #include "g21s3api.h" #include "comapi.h" //============================================================= void main() int i, com_port, cnt ; ret; char buf[ 256], *ptr ; SetAPSerialNo( "COM sample program"); //set AP version Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 104 = ret ; ptr = "\r\nReceive data=" ; Com_PutBuf( com_port, ptr, strlen(ptr)) ; //send data to com port Com_PutBuf( com_port, buf, cnt) ; //send data to com port Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 105 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 106: Appendix D. Configuration Utility

    Figure D1. Main window of monitor.exe utility program Display Description The following table lists the functional descriptions for all the fields. Field Name Field Descriptions Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 107: Detecting Operational Controllers And Devices

    Select an item from the Broadcast IP list. Specify a number in the Wishes box. Click on the Invite button. This will display all the controllers and devices information you have requested. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 108: Configuring Controllers And Devices

    Cancel to abort. The default password is null. You can press the reset key of product to reset password to the default value. The target controller will return an ACK message indicating the modification is successfully Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 109 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series modified. Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.
  • Page 110 SDK Programming Guide Version 1.511 ABLELink Ethernet-Serial Server MAXI Series Copyright © 2004 Atop Technologies, Inc. All rights reserved. Designed in Taiwan.

This manual is also suitable for:

Ablelink gw21c-maxi

Table of Contents