Home
        μPAC-5000 User Manual (C Language Based)
         Contents
1.                                                                    18  1 3 1  General Series                                                                                     18  1 3 2  GPS Series                             ona aa 19  1 3 3  GPRS Series                              nnn noon nn nn nnn nnn nnn nnn nnn nn nn nnn nnn nn nnn nnn nnn nnncnne 19  1 3 4  GPS  amp  GPRS Series                           2 2 nnn nn nner eno nnn nn nnnn nn cnen en enenenecenenccerencn  19  1 4  Overview                                                                                 20  1 5  DIMENSIONS    24  1 6  Companion CD                                                                          25  2  Getting Started                                                                 26  2 1  Hardware Installation                                                                 27  2 2  Software Installation                                                                  30    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  3    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       2 3  Boot Configuration                                                                    32    2 4  Uploading WPAC 5000 Programs                                                    33  2 4 1  Establishing a connection between PC and uwPAC 5000                                  34  2 4 1 1  RS 232 connectiOn                                              
2.                                                        6  1 1  uPAC 5000  C Language Based                                                        7  1 1 1  uPAC 5000 Release Module                                                                     7  1 1 1 1  General Series                                                                                 7  1 1 1 2  GPS Series                                    nn nnn nnn nn nnn nnn nn nnn nnn nn nnn nnn nn nnn nn nn nnnnns 7  1 1 1 3  GPRS Series                                    nnn noon n nnn nnn nnn nnn nn nn ncn nnn nnn ncaa nn nccn 7  1 1 1 4  GPS  amp  GPRS SerieS                                                                   8  1 1 2  uPAC 5000 Module Naming Convention                                                      9  1 1 3  UPAC 5000 Comparison                                                                          10  1 1 3 1  General Series                                                                                10  1 1 3 2  GPS Series                              n nnn nnn n nnn nnn nnn nnn nnn nnn nnn nnn nn nn nn nn nnnnnnnns 11  1 1 3 3  GPRS Series                                    nnn none n nnn nnn nnn nn nnn nnn nn nnn nn nnn cnnnnn nnn 12  1 1 3 4  GPS  amp  GPRS Series                                                                          13   1 2  FE atures                        n nnn nnn nnn nnn nn nnn nnn nnn nnn nnn nnn nn nnn nn nnn nn nnn nn nnnnns 14  1 3  Specifications        
3.                             35  2 4 1 2  Ethernet Connection                                                                        38  2 4 2  Uploading and executing WPAC 5000 programs                                            43  2 4 3  Making programs start automatically                                                        44  2 5  Updating wPAC 5000 OS image                                                     46  3     Hello World      Your First Program                                        49  3 1  C Compiler Installation                                                                50  3 1 1  Installing the C compiler                                                                         51  3 1 2  Setting up the environment variables                                                        55  3 2  UPAC 5000 APIS                                                                        58  3 3  First Program in WPAC 5000                                                         59  4  APIs and Demo References                                                  70  4 1  API for COM Pott                                                                       74  4 1 1  Types of COM port functions                                                                   75  4 1 2  API for MiniOS7 COM port                                                                      76  4 1 3  API for standard COM port                                                                      79  4 1
4.                          115  D 1  Turbo C 2 01                                                 2nnnn nanan nnnnnnn nanan 116  D 2  BC   3 1  IDE                                                   2 2 2   222    22        119  D 3  MSC OOO 123  D 4  MSVC LOO e 125    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  5    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       1  Introduction       HPAC 5000 Family s         5 Digit LED Display i microSD           Various Local 1 0  Communications Expansion Board    iore than 10 VO XW Doard are supported    UPAC 5000 family is a palm size PAC  It can install in narrow space and survive in harsh  environment  For different applications  uPAC 5000 family offers 3 series  uPAC 5000   LP 5000 and WP 5000  Customers who needs MiniOS7  Linux  or WinCE   all can find a    product to fit their requirement      UPAC 5000 family offers two CPU types  80186  PAX270   3 OS solutions  WinCE 5 0  Linux   MiniOS7  and several software development toolkits  C  VS  NET  ISaGRAF  InduSoft  for  chosen  and all of them are featured same stability and flexibility as ICP DAS   s PAC family   This makes WPAC 5000 have a good potential to apply to factory automation  building  automation  machine automation  manufacturing management  environment monitoring     etc     Besides  combining one of the optional expansion boards  XW boards  for PACs  such as DI   DO  A D  D A  Timer Counter  communicatio
5.        Optimizations       co Command Prompt   te    Opt ions    Instruction Set    cont a Far Data hreshold    Fi Help   Detect and use coprocessor  otherwise emulate the 8087780287       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  66    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 11  Set the memory model to large       i  Select    Directories       from the    Options    menu   ii  On    Include Directories    option  specify the header file   iii  On    Library Directories    option  specify the function library file  iv  Select    OK       c  Command Prompt   te    Window  Application     Compiler  Transfer      Make     Linker a    Librarian       EEA    Environment H    Save       c  Command Prompt   te    ile Edit Search Run Compi    I  D sITC  INCLUDE    esac Directories  eee Ea    ource Directories    Fi Help   The directories to search for your include  lt  H  files                 UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  67    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 12  Select    Build all    from the    Compile    menu to build the project    c  Command Prompt   te      o    _File Edit Search Run Debug Project Options    Window Help  Alt  F   F     void    Information     Remove messages    cn Command PFrompr     File Edit Search Run Compile Debug Froject Options Window Help      1    void    Library HELLO 
6.       4 3  API for EEPROM    e The EEPROM contains 64 blocks  block 0   63   and each block has 256 bytes  address 0    255   with a total size of 16 384 bytes  16K  capacity     e The default mode for EEPROM is write protected mode     e The system program and OS are stored in EEPROM that are allocated as shown below     Block 0   6 API for writing data to the EEPROM    Block 7 O 1  EE_WriteEnable      Block 8   31 Before writing data to the EEPROM  the  Reserved for  EE_WriteEnable   must be called to  system use  write enable the EEPROM   2  EE_WriteProtect    After the data has finished being written to  Block 32   64    the EEPROM  the EE_WriteProtect   must be  called to in order to write protect the  EEPROM     For user    3  EE_ MultiWrite      After using the EE_WriteEnable   to  write enable EEPROM  the   EE MultiWrite  must be called to write the  data        API for reading data from the EEPROM    4  EE_MultiRead      The EE_WriteEnable   must be called to read data from the EEPROM no matter what  the current mode is     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  87    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  to write data to block1  address 10 of the EEPROM      include  lt stdio h gt      include    upac5000 h       void main void      int data 0x55  data2     InitLib        Initiate the upac5000 library     EE WriteEnable     EE MultiWrite 1 10 1  amp data      EE_WriteProte
7.      e Summarize of the MFS functions     Function Description    mfs_X600Fs_GetLibVersion    l Gets the size of available space that can be used to  mfs_GetFreeSize  append file     l Delete one selected file that has been written to the  mfs_DeleteFile  NAND Flash   l 1  Opens a file with a file name   mfs_OpenfFile l  2  Creates a new file     Closes a file with a file handle   mfs_CloseFile All buffers associated with the stream are flushed before    closing        uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  99       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Function Description    l l Enable the data verification   mfs_EnableWriteVerify  By default  the data verification is enabling     mfs_DisableWriteVerify Disable the data verification        UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  100    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       API for starting 64MB flash memory    1  mfs_ Init      Before using any MFS functions  the mfs_Init   must be called to initialize the 64MB    flash memory     2  mfs_Stop      If the program calls the mfs_Init   to initialize the 64MB flash memory  the mfs_Stop      must be called to allocate buffers to free upon closing     API for writing reading files from the 64MB flash memory    3  mfs_OpenFile      Before writing reading data to from the 64MB flash memory  the OpenFile   must be    called t
8.     After the Init5DigitLed   is used to initialize the 5 Digit 7 SEG LED  the Show5DigitLed    must be called to display information on the 5 Digits 7 SEG LED     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  93    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  use the following code to display    8000E    on the 5 Digit 7 SEG LED      include  lt stdio h gt      include    upac5000 h       void main void      InitLib        Initiate the upac5000 library       InitSDigitLed      Show5DigitLed 1 8     Show5DigitLed 2 0     Show5S5DigitLed 3 0     Show5S5DigitLed 4 0     Show5DigitLed 5 14       The ASCII code for the letter   E    is 14       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  94    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 7  API for Timer    e The wPAC 5000 can support a single main time tick  8 stop watch timers and 8 counts down    timers     e The uPAC 5000 uses a single 16 bit timer to perform these timer functions  with a timer    accuracy of 1 ms      API for starting the Timer    1  TimerOpen      Before using the Timer functions  the TimerOpen   must be called at the beginning of    the program     API for reading the Timer    2  TimerResetValue      Before reading the Timer  the TimerResetValue   must be called to reset the main    time ticks to O     3  TimerReadValue      After the TimerResetValue   has
9.     I   else      Print                n r         Print    char             UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  82    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com                ToCom 1 item   Putch item    printCom 1   n rASCII  c  n r     item   Print   n rASCII  c  n r     item      printCom 1    Hex  02X  n r   item   Print    Hex  02X  n r     item      I I  I I  I I  Delay 10    RestoreCom 1     I                  UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  83    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 1 5  Request Response protocol define on COM port    Request Response communication is very typical protocol architecture  If you want to design  a command set of communication protocol as table below  you can refer to    slave_com     demo     For a request response application     please refer to    slave com    demo           Response        Request           Cy  UT U a al dlp TM       Request Response                      a Debug information  Command1  Command1   a Debug information  Command2  Command2   Q Debug information  Quick program   Other command Debug information  Unknown command       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  84       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    4 2  API for I O Modules    The WPAC 5000 equip a RS 485 communic
10.    3     Hello World      Your First Program    When you learn every computer programming language you may realize that the first  program to demonstrate is  Hello World   it provides a cursory introduction to the    language s syntax and output     Below are step by step instructions on how to write your first UPAC 5000 program     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  49    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       3 1  C Compiler Installation    C is prized for its efficiency  and is the most popular programming language for writing    applications     Before writing your first tPAC 5000 program  ensure that you have the necessary C C      compiler and the corresponding functions library on your system     The following is a list of the C compilers that are commonly used in the application    development services     e Turbo C   Version 1 01   e Turbo C Version 2 01     Borland C   Versions 3 1   5 2 x  e MSC      MSVC       We recommend that you use Borland C   compiler as the libraries have been created on the    companion CD     Tips  amp  Warnings  Before compiling an application  you need to take care of the  following matters   Generate a standard DOS executable program  Set the CPU option to 80188 80186    Set the floating point option to EMULATION if floating point    computation is required   Be sure not to choose 8087     Cancel the Debug Information function as this helps to reduce   
11.    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com        gt  External power supply via a PoE switch  i  Connect PC to the PoE switch  ii  Connect PoE switch to LAN port of uwPAC 5000    iii  Connect the power supply  12   48 Vpc  to the PoE switch    Fihemnect    Cale                    a  kean MEP PoE Switch  a ck  HostPC AEE  HS 2045P SE     Cable 4    12   48 Yine  Power Supply    tthernet  t able        p              gt            PoE Switch  Host PC Ethernet  NS  205P SE  AE     Labie  gt         p 12   48 nH  fn 4 S Power Supply  Power Supply             UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  29       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    2 2  Software Installation    The Companion CD includes complete sets of APIs  demo programs and other tools for    developing your own applications     Below are step by step instructions for installing the WPAC 5000 APIs  demo programs and    tools     Step 1  Copy the    Demo    folder from the companion CD to PC       The folder is an essential resource for users developing your own applications which  contains libraries  header files  demo programs and more information as shown below     CD  Napdos    upac 5000    Demo    Basic    64MB_Flash    Ejo    modbus    XWboard          FTP_Demo_yyyymmdd zip    uPAC5000_GPRS_GPS_Demo_yyyymmdd zip    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  30    C
12.    uPAC 5000 User Manual   C Language Based     Version 1 0 1  June 2010       Service and usage information for    UPAC 5001  D    wPAC 5001P  D   UPAC 5001 FD  D    pPAC 5001 FD  D   UPAC 5002  D    uPAC 5002P  D   UPAC 5002 FD  D    uPAC 5002P FD  D   UPAC 5002 NV  D    uPAC 5002P NV  D     uPAC 5002 SM  D    uPAC 5002P SM  D     Warranty  All products manufactured by ICP DAS are under warranty regarding  defective materials for a period of one year  beginning from the date    of delivery to the original purchaser     Warning  ICP DAS assumes no liability for any damage resulting from the use of  this product ICP DAS reserves the right to change this manual at any  time without notice  The information furnished by ICP DAS is believed  to be accurate and reliable  However  no responsibility is assumed by  ICP DAS for its use  not for any infringements of patents or other    rights of third parties resulting from its use     Copyright  Copyright   2009 by ICP DAS Co   Ltd  All rights are reserved     Trademark    The names used for identification only may be registered trademarks    of their respective companies     Contact US    If you have any problem  please feel free to contact us     You can count on us for quick response     Email  service icpdas com       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  2       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Table of Contents    1  Introduction                
13.   LED indicators are on the front panel of the uPAC 5000  their functions are    summarized in the table below     Indicator State Meaning    ako   on   Ethemet link detected       uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  20    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com          5 Digit 7 SEG LED display  for display version only      lt o   oe   ee   oe    18   98   08   8   88     UPAC 5000 display series equip 5 digital 7SEG LED display that can be used to display       decimal numbers from 0 to 9 and provided a very convenient way of displaying digital    data in the form of Numbers    Top Panel    The microSD memory socket is on the top panel that provides a simple way of expanding    Capacity     microSD Socket        gt  microSD Memory Socket    uPAC 5000 equip a microSD socket and it can support up to 2 GB microSD card     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  21    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Bottom Panel    The switches and interface are on the bottom panel that provides a simple way of adjusting    the system and wiring the connection     Rotary Switch    Lock and Init     r   peor  oa  E         nico    LAN Pin Assignment     gt  Init Switch  Operating Mode Selector Switch    ON  MiniOS7 configuration mode    OFF  Firmware running mode    In the WPAC 5000 series  the Switch is always in the OFF position  
14.   PoE  microSD    64 MB Flash  microSD    uPAC 5202 FD  64 MB Flash  80 MHz 512 KB microSD    uPAC 5202 NV  1 MB NVRAM  B    microSD    uPAC 5202 SM    512 KB  Battery  Backup  SRAM       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  12       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    1 1 3 4  GPS  amp  GPRS Series    The following table provides a comparison of uPAC 5000 GPS  amp  GPRS Series specifications    Memory    Model CPU Flash SRAM GPS    Expansion    512 KB    UPAC 5301 FD    PoE  microSD    64 MB Flash  microSD    uPAC 5302 FD  64 MB Flash  80 MHz 512 KB microSD   Yes  UPAC 5302 NV  1 MB NVRAM    a    microSD    UPAC 5302 SM    512 KB  Battery  Backup       SRAM    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  13       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    1 2  Features     gt  Various CPU and OS for Choosing         gt  MiniOS7  i     30186 CPU    UPAC 5000 Series    DOS like  Boot up in 0 4   0 8 second    Build in hardware diagnostic    Standard version for C language programming    ISaGRAF version for IEC 61131 3 programming     gt  Local I O and Communication Expansion Board             The 5000 series equip an I O expansion bus to support one optional expansion board  called  XW board  It can be used to implement various I O functions such as DI  DO  A D  D A   Timer Counter and various communication interface  such as RS
15.   The following table provides a comparison of uPAC 5000 General Series specifications    Memory  Model CPU Flash SRAM    Expansion    uPAC 5001  microSD  uPAC 5001P  512 KB  uPAC 5001 FD microSD    uPAC 5001P FD 64 MB Flash    microSD      512 KB  uPAC 5002 SM    uPAC 5002P SM    Battery  Backup  SRAM       PoE GPS  UPAC 5002    microSD  UPAC 5002P Yes  UPAC 5002 FD microSD      UPAC 5002P FD 80 MHz 512 KB 64 MB Flash Yes  UPAC 5002 NV microSD      UPAC 5002P NV 768 KB 1 MB NVRAM Yes    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  10       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    1 1 3 2  GPS Series    The following table provides a comparison of uPAC 5000 GPS Series specifications    Memory  Flash SRAM GPS    Expansion  UPAC 5101  microSD  UPAC 5101P    UPAC 5101 FD microSD      UPAC 5101P FD 64 MB Flash    UPAC 5102  microSD    UPAC 5102P    me     UPAC 5102 FD microSD      UPAC 5102P FD 80 MHz 512 KB 64 MB Flash Yes Yes  UPAC 5102 NV microSD      UPAC 5102P NV 1 MB NVRAM Yes    microSD      512 KB    UPAC 5102 SM  Battery    UPAC 5102P SM  Backup    SRAM       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  11    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       1 1 3 3  GPRS Series    The following table provides a comparison of uPAC 5000 GPRS Series specifications    Memory    Model CPU Flash SRAM GPS    Expansion    512 KB    UPAC 5201 FD  
16.   lib   llibce    Creating browser database     HELLO EXE   0 error s   0 warning s     ae    ees       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  128    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       
17.   quit 1   I  I          Check if any data is in the input buffer          If    q    is received  exit the program       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1    Page  80  Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  showing data through COM1      include  lt stdio h gt      include    upac5000 h       void main void        int i        Initiate the upac5000 library     InitLib      for i 0 i lt 10 i          Print    Test  d n r    i     I       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  81    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 1 4  Port functions Comparison    For example  learning to show the ASCII code     MiniOS7 COM port functions    Standard COM port functions           include lt stdio h gt      include    upac5000 h       void main void        unsigned char item     InitLib     InstallCom 1  115200  8  0  1    printCom 1    Hits any key  n         printCom 1  Hit the ESC to exit  n         for           if IsCom 1        item ReadCom 1    if item   q          return     I    else       printCom 1                 n r       printCom 1    char              include lt stdio h gt      include    upac5000 h       void main void        unsigned char item     InitLib       Print  Hits any key  n       Print  Hits the ESC to exit   n       for           if kbhit         item Getch     if item   q          return
18.  232 422 485  CAN  FRnet     etc     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  14    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com        gt  Remote I O Module and Expansion Unit    GPS    With the built in RS 485 and Ethernet port   the 5000 series can connect  RS 485 Ethernet remote I O Units   RU 87Pn ET 87Pn  or modules   I 7000 M 7000 ET 7000   With an    XW board  the 5000 series can have more               uUPAC 5000 Series    ee   ri  nt    communication ports or different  interface to connect to other  type of devices  for example   CANOpen devices  DeviceNet Internet  devices  or FRnet I O    modules     Cell Phone     gt  Multi Communication Interface    There are several communication interfaces to expand I O and connect external devices     e Ethernet  e RS 232 422 485       e USB host   e     CAN bus   e  FRnet   e GSM GPRS  e GPS       CAN 8124 CAN 8224 CAN 8424 CAN 2018C CAN 2088C       FR 2053iT       FR 20571T    FR 2054T    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  15          Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com     gt  Various Memory Expansions    UPAC 5000 provides various memory storage options  such  as EEPROM  Flash  battery backup SRAM or microSD   Customers can choose the memory based on their    characteristics        e 16 KB EEPROM  to store not frequently changed  parameters   e microSD  to implement portable
19.  4  Port functions ComparisSon                                                                     82  4 1 5  Request Response protocol define on COM port                                         84  4 2  API for I O Modules                                                                   85  4 3  API for EEPROM                                                                        87  4 4  API for Flash Memory                                                                 89  4 5  API for NVRAIM                                                                         91  4 6  API for 5 Digital LED                                                                   93    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  4    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 7  API for Timer                                                                            95    4 8  API for WatchDog Timer  WDT                                                      97  4 9  API for MFS  For pPAC 5000 FD series only                                      99  4 10  API for microSD                                                                      105  Appendix A  What is MiniOS7                                                 110  Appendix B  What is MiniOS7 Utility                                        111  Appendix C  What is MiniOS7 File System  MFS                          112  Appendix D  More C Compiler Settings            
20.  C    i  Debug Options T Check Pointers  Listing Files  Memon Model  Optimizations    Calne Danae Cdlisciis Sets Chee ice    Cr C       Floating Point Calls  Code Generator     Use Emulator   Auto Select        Segment Names    Struct Member Byte Alignment     2 Bytes        UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  126    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 5  Change the Memory model  large for uPAC5000 lib     CAC   Compiler Options    Build Options  C Debug Specific    Release Specific    Common to Both OK     Options String  C    ance    fnologo Gs    G7 AWS AL    Oe 4D UNDEBUG     D0   DOS     FR      Help         Use Project Defaults      Category  Category Settings  Memory Model    Code Generation   Custom Options     Custom Options  C    gf   Debug Options   Listing    ail   Memory Model   Optimizations Hew Segment Data Size Threshold  Po  P Code Generation  Precompiled Headers  Preprocessor  Segment Hames      Assume    extern  and Uninitialized Data  Far     Step 6  Remove the xcr  afxcr library from the Input Category    Linker Options      Build Options  C Debug Specific     Release Specific    Common to Both OF       Options String  rc      LIB  wer ZLIB  afscr    LIB  oldnamnes       LIB  shbce       NOI STACK  5120 sales  AONERROR NOEXE OLOGO   Help        Use Project Defaults      Category     Memor Image  Miscellaneous  Output      Remove the     xcr    and    afxcr         
21.  Corp 1984 1990  All rights reserved    Hello c   C  7188XA Demo MSC Hello gt link  MA  NOE  NOI Hello      l1b 7188xal   icrosoft pe Segmented Executable Linker Version 5 10   Copyright  C  Microsoft Corp 1984 1990   lt All rights reserved    C   7L88xXA Demo MSC Hello gt del   obj    C  7188XA Demo MSC Hello gt del   map  C  7188XA Demo MSC Hel 1o gt _    Step 3  A new executable file will be created if it is successfully compiled    cy  CAWINDOWS S ystem32 cmd exe    c  7188XA Demo MSC Hel lo gt dir  Volume in drive C has no label   Volume Serial Number is 1072 89A3    Directory of C  7188xXA Demo MSC Hel lo    2006 05 29  08  lt DIR gt    2006 05 29  08   2006 05 29    03   2006 05 29  47   2006 05 29  08 i ma     3 File s  7 496 bytes   2 Dir s  22 041 571 328 bytes free    C  7188xXA Demo MSC Hel lo gt _       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  124       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    D 4  MSVC 1 50    Step 1  Run MSVC exe             lt 2 gt  DATIBSEVICPIZSER VER DEMO MSYC 1 5 IDEMONDA ISER C     include  lt string h gt   tinclude  ye   include    void Use  PijestName     Bowe           EE         L feis MAK          feds  E  S000E Sa  E gt  MINIOS      Suc       gt  DEMO ARG WD    E      LEDS      RREO  FOL    E d  ICPDATA     n    Step 2  Create a new project    mak  by entering the name of the project in the Project    Name field and then select MS DOS application  EXE  as the 
22.  DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       else  i  Print    Init microSD failed n r       iRet pc_ get errno     switch iRet   i  case PCERR_BAD_FORMAT    1  Print  Error 01  format is not FAT n r     break   case PCERR_NO CARD    2  Print  Error 02  no microSD card n r     break   default   Print  Error  02d  unknow error n r  iRet            fd pc_open    test txt     word  PO_RDONLY   word  PS_IWRITE PS_IREAD       if fd gt  0       iRet pc_read fd Buffer 10     reads 10 bytes  Buffer 10  0    adds zero end to the end of the string   pc_close fd    Print     s     Buffer     I        For more demo program about the microSD  please refer to     CD  NAPDOS uPAC 5000 Demo Basic microSD   http   ftp lcodas com pub cd 8000cd napdos upac 5000 demo basic microsd    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  109    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Appendix A  What is MiniOS7     MiniOS7 is an embedded ROM DOS operating system design by ICP DAS  It is functionally  equivalent to other brands of DOS  and can run programs that are executable under a  standard DOS     DOS  whether PC DOS  MS DOS or ROMDOS  is a set of commands or  A code that tells the computer how to process information  DOS runs  programs  manages files  controls information processing  directs    input and output  and performs many other related functions     The following table compares the features betwee
23.  Language Based  User Manual  Version 1 0 1 Page  111       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Appendix C  What is MiniOS7 File System  MFS                  MiniOS7 file system  MEFS  offers a rugged alternative to mechanical storage systems   Designed for the 64MB NAND flash memory     MFS implements a reliable file system with C language API for embedded data logger  applications on MiniOS7     Hardware Supported  UPAC 5000 FD  With 64MB Flash Memory   NVRAM  all of the 31 bytes     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  112    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Applications    Log data with timestamp  Log data and forward via the Ethernet    User s program  N N    COM Port  Functions                      DAVLA          MFS Specifications    Item Description    Disk size  File number  File size  File name    1  Read only    2  Write only  Creates a new file to write data  or overwrite a file  if  File operation modes a l  the file is already exit         3  Append  appends data to a file     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  113    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       10 max for each disk    For read mode  the 10 file handles can all be used for reading   operation on each disk  Total 20 files can be opened for reading  File handle   mode    For write a
24.  Ltd  All Rights Reserved  E mail  service icpdas com       For example  use the following code to write data to the NVRAM address 0      include  lt stdio h gt      include    upac5000 h       void main void        int data 0x55  data2    InitLib        Initiate the upac5000 library     WriteNVRAM 0 data     data2 ReadNVRAM 0      Now data2 data 0x55          For example  the following can be used to write an integer  two bytes  to NVRAM      include  lt stdio h gt      include    upac5000 h       void main void        int data 0xAA55  data2    char  dataptr  char    amp data     InitLib        Initiate the upac5000 library     WriteNVRAM O   dataptr      Write the low byte     WriteNVRAM 1   dataptr 1      Write the high byte     dataptr  char     amp data2     dataptr ReadNVRAM 0      Read the low byte       dataptr 1  ReadNVRAM 1      Read the high byte     j    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  92    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 6  API for 5 Digital LED    The wPAC 5000 contains a 5 Digit 7 SEG LED with a decimal point on the left hand side of    each digit  which be used to display numbers  IP addresses  time  and so on       o        API for starting the 5 Digit 7 SEG LED  1  InitSDigitLed      Before using any LED functions  the InitSDigitLed   must be called to initialize the  5 Digit 7 SEG LED     API for displaying a message on the 5 Digit 7 SEG LED  2  Show5DigitLed  
25.  are fixed     Baudrate   115200 bps  Data format   8 bits    Parity check   none  Start bit   1  Stop bit   1    API for checking if there is any data in the input buffer    1  Kbhit      Before reading data from standard I O port  the kbhit   must be called to check    whether there is any data currently in the input buffer     API for reading data from standard I O port    2  Getch      After kbhit   confirms that the input buffer contains data  the Getch   must be called    to read data from the input buffer     API for sending data to standard I O port    3  Puts       For sending a string    Before sending data to standard I O port  the Puts   must be called to send data to  COM Port      UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  79    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4  Putch        For sending one character    Before sending data to standard I O port  the Putch   must be called to send data to  COM Port     API for showing data from standard I O port    5  Print      Functions such as Print   in the C library allow data to be output from the COM port     For example  reading and receiving data through COM 1      include lt stdio h gt      include    upac5000 h       void main void      int quit 0  data     InitLib         Initiate the upac5000 library     while  quit       if Kbhit           data Getch       Read data from COM1     Putch data      Send data to COM1     if data     q   
26.  condensing    Power   Input Range  12    48 Voc   Power over Regular version  Ethernet  PoE  IEEE 802 3af Class 1   2 W  2 5 W for  D  version            uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  18    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       1 3 2  GPS Series    GPS Series coming soon   Please visit our products page or contact us for more information     http   www icodas com products PAC up 5000 selection guide htm    1 3 3  GPRS Series    GPRS Series coming soon   Please visit our products page or contact us for more information     http   www icodas com products PAC up 5000 selection guide htm    1 3 4  GPS  amp  GPRS Series    GPS  amp  GPRS Series coming soon   Please visit our products page or contact us for more information     http   www icodas com products PAC up 5000 selection guide htm    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  19       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    1 4  Overview    Here is a brief overview of the components and its descriptions for module status     Front Panel    The LED indicators and 5 digit 7 Segnment LED display are on the front panel that provides a    very convenient way of displaying information for faster  easier diagnostics     LED Indicators         fj mn UL i ee i    5      o Digit 7 SEG LED Display   for display version only     Tp lnnil      Ta        gt  LED Indicators  
27.  control the  xw107 board     For more detailed information regarding UPAC 5000 APIs  please refer to  CD  NAPDOS upac 5000 Demo basic   http   ftp Icodas com pub cd 8000cd napdos upac 5000 demo basic       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  73       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    4 1  API for COM Port    The wPAC 5000 provides two built in COM ports  COM1 and COM 2     e COM1    A RS 232 port can use to connect to PC   e COM2    A RS 485 port in a point to point connection              UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  74    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 1 1  Types of COM port functions    There are two types of functions below for using COM port     1  MiniOS7 COM port functions  2   C style  Standard COM port functions    Tips  amp  Warnings     C style  Standard COM port functions only can be used with the  AN COM1  if you use the COM1 port  you ll have the alternative of  MiniOS7 COM ports functions or  C style  Standard COM port    functions  If you choose the ones  then another cannot be used     Summarize the results of the comparison between MiniOS7 COM port functions and  C style   Standard COM port functions     Types of COM  Buffer Functions    Functions Port    MiniOS7  1  2  etc  1 KB 1 KB IsCom   ToCom   ReadCom     printCom    COM port        C style   Puts    Standard 1 512 B
28.  data logging  applications   max  of 2GB on the MiniOS7 platform  max  of 32 GB on Linux and WinCE platforms       e 64 MB Flash  to implement non portable data  logging applications   e 512 KB battery backup SRAM  to hold data while power lost      gt  Unique 64 bit Hardware Serial Number to Protect Your Program    A unique 64 bit serial number is assigned to each hardware device    to protect your software against piracy         gt  Small and Easy Installation    uPAC  5000 series have a slender shape  91    mm x 132 mm x 52 mm  to be install in a  narrow space with DIN Rail     ih    nn    meN    cD  Ce LATT  1  Ep a          uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  16       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com     gt  Plastic and Metal Housing    The default housing is plastic material  customers can choose metal housing if they want      gt  Redundant Power Inputs    To prevent the uPAC 5000 from failing by the power loss  the power module is designed with  two input connectors  Once a power input fails  the power module switches to the other    power input  And there is a relay output for informing the power failure      gt  Highly Reliable Under Harsh Environment    The wPAC 5000 operates in a wide  range of temperature and    humidity     e Operating Temperature    25  C    75   C   e Storage Temperature    40  C    80   C   e Humidity   10   95  RH  non condensing       UPAC 5000 Series  C La
29.  down list  type the IP address which you are assigned  and then click     OK       vs Connection    Serial Port TCP UDP    Baud Rate  115200 IP   10 0 9 52  Data Bik    Fort     Parity    DlM one     Stop Bit       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  41    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 10  The connection has already established    P   MiniOS  Utility Yerion 3 1 7  G File lb Connection      Command Configuration Fo  Tools  amp  amp    Help      ae om ii  AREE       Look in     O Minig 7 Utility    Lock in     Connection Status    Disconnected      fp Connection F2     z   ay ed Delete Fal      Refresh F3                                  UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  42    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       2 4 2  Uploading and executing WPAC 5000 programs    Before uploading and executing UPAC 5000 programs  you must firstly establish a connection  between PC and uwPAC 5000  for more detailed information about this process  please refer    to section    2 4 1  Establishing a connection       Step 1  On PC side  right click the file name that you wish to upload and then select the     Upload          P   MiniOS  Utility Verion 3 1 7 Seles    GH File  b Connection   de Command Configuration    Tools gE Help bi    LLALL LLELLE LELLE LLALL LAAL aaa aAA  f  3 m    Look in       Hello si Lock 
30.  h       void main void        int data 0xAA55  data2   char  dataptr    int  dataptr2     InitLib         Initiate the upac5000 library     dataptr  char    amp data   FlashWrite Oxd000 0x1234   dataptr      FlashWrite Oxd000 0x1235   dataptr         Read data from the Flash Memory  method 1      dataprt  char    amp data2    dataptr FlashRead Oxd000 0x1234       dataptr 1  FlashRead Oxd000 0x1235         Read data from the Flash Memory  method 2      dataptr2  int far   _ MK_FP Oxd000 0x1234    data  data    I    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  90    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 5  API for NVRAM    e The uPAC 5000 equip an RTC  Real Time Clock   31 bytes of NVRAM can be used to store  data     eNVRAM is SRAM  but it uses battery to keep the data  so the data in NVRAM does not lost    its information when the module is power off        NVRAM has no limit on the number of the re write times   Flash and EEPROM both have  the limit on re write times  If the leakage current is not happened  the battery can be    used 10 years     API for writing data to the NVRAM    1  WriteNVRAM    The WriteNVRAM   must be called in order to write data to the NVRAM     API for reading data from the NVRAM    2  ReadNVRAM    The ReadNVRAM   must be called in order to write data to the NVRAM     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  91    Copyright    2010 ICP DAS Co  
31.  on start up     Step 1  Create an autoexec bat file       i  Open the    Notepad       ii  Type the command  The command can be either the file name    HELLO exe     run the specified file  or    runexe        run the last exe file     iii  Save the file as autoexec bat     P Untitled   Notepad Sel             File Edit Format Wew Help  HELLO exe The file name     Run the specified file           P Untitled   Notepad Ses     a Runexe      Run the last exe file     Edit Format Yiew Help  runexe    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  44    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 2  Upload programs to UPAC 5000 using MiniOS7 Utility       For more detailed information about this process  please refer to section    2 4 1  Establishing    a connection       PA MiniOS  Utility   erion 3 1 7  Ga Fie   Connection   de Command Configuration T   Tools g6  Help      Look in     0 Minig S7 Utility w Lock in  Disk A    Name Size Type Name Size Modified  B bin File Folder   hello  exe 136 928 2008 6 9     Tm FIR M A E File Folder _k   autoerec     25 20057879     C05 IMAGE File Folder     icpdas 1KB  8  load  32 al SKB  EY MiniOS7_Utility chm 1 025KB  es  ODP Connect to 10 1 0 224 23 path D S TS TEM   n A  One is the    Hello  i O T application file  and the  Autodownload files  None other iS the    Current work directory  D  SYSTEM       autoexec bat    batch file   Begin Key Thread           Tips  am
32.  please note that    you must save the source code under a filename that terminates with    the extension    C        uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  62    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 6  Create a project    prj        i  Select    Open project       from the    Project    menu  ii  Type the project name    Hello      iii  Select    OK      iv  Select    Add       v  Select    Done    to exit    ey CA WINDO WS  sy  stem32temd exe   tc      File Edit Search Run Compile Debug   Options a          Close project     Add item     Delete item    Include files       File Edit Search Run Compile Debug Project Options Window Help    cs OC A WINDO WS  system2 cmd exe   te                Fi Help Enter directory path and file mask          UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  63    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 8  Add the necessary function libraries to the project    lib        i  Select    Add item       from the    Project    menu    ii  Type       LIB    to display a list of all available function libraries  iii  Choose the function libraries you require  iv  Select    Add       v  Select    Done    to exit    ey CA WINDO WS  sy  stem32tcmd exe   tc      File Edit Search Run Compile Debue Options Window Help           HELLO  CPP 1      Open project     Close project    Delete item  Inclu
33.  program size   MiniOS7 supports this feature       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  50       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    3 1 1  Installing the C compiler    If there is no compiler currently installed on your system  installation of the compiler should    be the first step     Below are step by step instructions for guiding you to install Turbo C   Version 1 01 on your    system     Step 1  Double click the Turbo C   executable file to start setup wizard       INSTALL       Step 2  Press    Enter    to continue    e  CADOCUME 1 OUserie eppil UNS TALL EXE  Turbo C   2nd Edition Installation Utility    Copyright tc  1991 by Borland International  Inc     Install Utility  Welcome to the Turbo G   installation program  This  program will copy the files needed to install Turbo C   on  your system  You will need about 7 5 megabytes of  available disk space if you wish to install all the memory    nn Tae wa examples  and copy the Tour files     Press ENTER to continue  ESC to quit     w      ENTER Continue ESC    Cancel       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  51    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 3  Enter the letter of the hard drive you wish to install the software             Enter the drive from which you wish the INSTALL utility to copy files   Typically  this is the drive that contains t
34.  reset the main time ticks to 0  the TimerReadValue      must be called to read the main time tick     API for stopping the Timer    4  TimerClose      Before ending the program  the TimerClose   must be called to stop the Timer     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  95    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  the following code can be used to read the main time ticks from 0     include  lt stdio h gt      include    upac5000 h       void main void        Unsigned long time iTime     InitLib        Initiate the upac5000 library     TimerOpen      While  quit        If Kbhit       TimerResetValue       Reset the main time ticks to O       iTime TimerReadValue       Read the main time ticks from O          TimerClose         Stop using the uPAC5000 timer function            UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  96    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 8  API for WatchDog Timer  WDT     e The uPAC 5000 equips the MiniOS7  the small cored operating system  MiniOS7 uses the  Timer 2  A CPU internal timer  as system Timer  It is 16 bits Timer  and generate interrupt    every 1 ms  So the accuracy of system is 1 ms     e The Watch Dog Timer is always enabled  and the system Timer ISR  Interrupt Service    Routine  refreshes it     e The system is reset by WatchDog  The timeout period of WatchDog is 
35.  the forward declarations of subroutines  variables  and other identifiers  used for the MiniOS7 API     COM Ports    EEPROM        Standard IO  p t y    MiniOS7  API    Progra  Functions  mmable IO    Timer    and    WatchDogT    imer    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  71    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For full usage information regarding the description  prototype and the arguments of the    functions  please refer to the    MiniOS7 API Functions User Manual    located at     CD  Napdos MiniOS7 Document    http   ftp lcodas com pub cd 8000cd napdos minios7 document    zje Options   X    PS 1  Library Selection for All  7 1867 80      EHDA 2  COM Ports Functions   Beau          File Edit View Document Tools Window Help         x        El   Bi cwes con SB da socn lj Ib sa  A21 Common Functionsariables  al  A 2 1 1 InstallCom   A 2 1 2 bCtsChanged x   A 2 1 3 CurCTs x   A 2 1 4 CurRTS_ x      2 1 3 curcts_x  A 2 1 5 fCtsControlMode x   A 2 1 4 CurRTS_x an    T   2 1 5 fCtsControlMode_x F 2 1 6 fRtsControlMode x   A 2 1 6 fRtsControlMode_x   BS 2 1 7 ClearCom F 2 1 7 ClearCom  B 2 1 8 ClearTx Buffer  T 2 1 9 DataSizelnCom Is 2 1 5 Clearl xBufter  D   2 1 10 GetTxBufferFreeSize   F 219 DataSizelncom   A 2 1 11 GetCtsStatus   A 2 1 10 GetTxBufferFreeSize    D 2 1 12 InstallComlnputData  D5 2 1 11 GetCtsStatus    J  Adobe Reader   MaimOS _API pdf     Bookmarks                 e Opti
36. 0 8 seconds     API for refreshing WDT    1  EnableWDT      The WDT is always enabled  before user   s programming to refresh it  the  EnableWDT   must be called to stop refreshing WDT     2  RefreshWDT      After EnableWDT   stop refreshing WDT  the RefreshWDT   must be called to  refresh the WDT     3  DisableWDT      After user   s programming to refresh WDT  the DisableWDT   should be called  to automatically refresh the WDT     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  97       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    For example  to refresh the Watchdog Timer      include  lt stdio h gt      include    upac5000 h       void main void          Unsigned long time iTime     InitLib        Initiate the upac5000 library     Enable WDT      While  quit        RefreshWDT      User_function      I   DisableWDT       I    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  98    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 9  API for MFS  For pPAC 5000 FD series only     Required library and header files   MFS_V212 LIB and MFS h    The wPAC 5000 FD series products equip an extra  64MB flash memory  the MFS is designed to read write  file from to the 64MB flash memory        For full usage information regarding the hardware supported  applications  and the  specification  please refer to section    Appendix C  What is MiniOS7 File System  MFS   
37. 0 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  writing data to the microSD     include  lt string h gt    include  lt stdio h gt    include    upac5000 h      include    microSD h          int fd  iRet     InitLib     If pc_init        Print    Init microSD ok n r       j  else     Print    Init microSD failed n r       iRet pc_get_errno     switch iRet      case PCERR_BAD_FORMAT    1  Print  Error 01  format is not FAT n r     break   case PCERR_NO CARD    2  Print  Error 02  no microSD card n r     break   default     Print  Error  02d  unknow error n r  iRet      uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  107    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       fd pc_open    test txt     word  PO _WRONLY PO_CREAT PO_APPEND   word  PS_IW  RITE PS_IREAD       if fd gt  0      pc_write fd    1234567890    10     write 10 bytes  pc_close fd    I  I    API for reading data from the microSD    6  pc_read      After using PC_open   to open the file  PC_read   must be called to read data from the    microSD     For example  reading data from the microSD      include  lt string h gt    include  lt stdio h gt    include    upac5000 h      include    microSD h         int fd  iRet     unsigned char Buffer 80      InitLib     lf pc_init        Print    Init microSD ok n r         I    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  108    Copyright    2010 ICP
38. 3  Select    New    from the    File    menu to create a new source file       Open    F   Save Fz   Save as       Cane all       W Compile Debug Project Options   NONAMEGG   CPP                UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  60       j I O E a A J re I  J d    e LS  i   JINN ATC  JartavayavVsiava e  MAAIL CAFrVICOA  C  Val ava Lea lal    f  o   Ltd  All Rights Reserved  E mail  service icpdas com       Step 4  Type the following code  Note that the code is case sensitive     include          Demo basic Lib UPAC5000 h        Include the header file that allows UPAC5000 lib functions to be used       void main void      InitLib        Initiate the uPAC5000 library     Print    Hello world  r n          Print the message on the screen       I    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  61       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Step 5  Save the source file       i  Select    Save    from the    File    menu  ii  Type the file name    Hello     iii  Select    OK       ey  CAWINDO WSteystem 2 cmd exe   te    Project Options    Print   Get info      DOS shell   Quit Alt   k    oc  CARINDO WS tsystem32cmd exe   te  File Edit Search Run Project Options       TEE    mh a      C2STCSHELLO CPP       a a EE          Fi Help Enter directory path and file mask       Tips  amp  Warnings  A You can write the code as shown below with your familiar text editor  or other tools 
39. Borland C   3 1    Step 2  Creating a new project file    prj     c   Command Prompt   be      File Edit Search Run Compile Dg ag iT  C  DOCUME   1 ADMIN  Mis  Open project           re item      i  am  pa File    F          Step 3  Add all the necessary files to the project    c Command Prompt   be       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  119       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Step 4  Change the Memory model  Large for uPAC5000 lib                 File Edit    Assume  amp  amp  ii DS    fin  M    Step 5  Set the Advanced code generation options and Set the Floating Point to  Emulation and the Instruction Set to 80186    cs bata ae exe   be    Optimizations       oe Ba oh    Far Data hreshold EEHAJ       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  120    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 6  Set the Entry Exit Code Generation option and setting the DOS standard    ce  CAWINDO WSS ystem32 cmd exe   be    pile Debug  NONAMERG  CPP            ett options       i e i i     hot Lm         _  Source     CS See    Pandan    Step 7  Choosing the Debugger   and set the Source Debugging to None    ct C AWINDOWSts   B  x      e Chee   essas Gon ccm vetmr fendeso Window Help  C  DOCUME   1   ADMIMI    1  lt NONAMERG         Application     Compiler  Transfer       Inspectors    Program Heap Size  Fi Help EG K byte
40. Distinguish Letter Case                         uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  127    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 7  Remove the OLOGO option from the miscellancous Category     Linker Options    Build Options  C Debug Specific   Release Specific C Common to Both  Options String    Cancel     ALIB   wer     LIBS afscr     LIB  oldnames       LIBS slibee     NOL AS TACK  5120  fONERROR NOEXE OLOGO Help    Use Project Defaults      Category  Categor Settings  Miscellaneous    Memory Image  l Suppress apenes    Miscellaneous    Output Other Dp i    Remove the  OLOGO     Step 8  Rebuild the project       Dz Microsoft Yisual C     HELLO MAE           File Edit View  jee  Browse  Debug Tools Options Window Help       HELLO MAE    Compile Pale  Build HELLO EXE  Rebuild AU HELLO EXE AlHFE  ao Build  Execute HE            Ctlt FS    a gt   lt 1 gt  Output    Initializing     Compiling      c  7188zas demos mecshelloShello c  Linking            Microsoft  R  Segmented Executable Linker Version 5 60 339 Dec 5 1994  Copyright  C  Microsoft Corp 1984 1993  All rights reserved               Object Modules   obj      NOI  STACK 5120     ONERROR  NOEXE HELLO OBJ    Object Modules   o0bj     Run File  HELLO exe   HELLO  EXE   List File  c HELLO map   nul   Libraries   lib   c  msvec libs    Libraries   lib   c  msve mfc libs    j j  lib      SLIBN 7188XAL LIB     lib   oldnames   Libraries 
41. Fil Pa    05 IMAGE   es pall  A   Tet a  p  7 vs i or ia Ma ae a DOD ai O iia ea ke    Step 4  Select the latest version of the MiniOS7 OS image    Select MinsOS 7 Image file  Savem      O5_Image     gt    mP A c 500i 20090903 img   i FA  s000 20100310 img  eee uP AC SO000 20100324 ime    Desktop    p      My Network Save as hype  OS Image       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  47       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Step 5  Click the    OK       MiniOS7 Utility Ferion 3     X     Please wait a while for rebooting        Step 6  Click the    Info    from the    Command    menu to check the version of the OS  image       Minis  Utility Ferion 3 2 1      as  Fie   gt  Connection r   Command    1 Configuration   Tools 8 Help sd  SORE OTERO          DiskTool F6     bockin  DiskA w     Look  ir     Refresh F9    Cabin B autoexec    16 2005 71       FIRMWARE       _     6 VCB_323    84236 2008 7 2         Q0S_IMAGE EEPROM      EB 7188eu F4 Pack Disk  icpdas Foes nie    Bjload232 dl Reset    EE Mini0 S7_Utilty  chm    UMini0S7_Utilty  exe   S Mini S7_Utilty  ini     Suara    tt      Hame SIze       10PD5 720 1P 10 1 0 45 Port 10000 via TCP  2 filesle        Connection F2   E UploadiF5      DiskToolFe   E InfolF7   E DeletelFal       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  48    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    
42. LIB  Adding HELLO OBJ    Total File  Lines compiled  1573 A    Warnings  B A  Errors   amp   5       Available Sanne 1i 78K    Fi Help   Alt F8 Next Msg ALt FY Prev Msg Al1t F  Compile F  Make Fill Menu    Step 13  Configure the operating mode       Make sure the switch of the Lock placed in the    OFF    position  and the switch of the Init  placed in the    ON    position        UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  68    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 14  Create an autoexec bat file           Untitled   Notepad Maf   File Edit Format    view Help i  Open the    Notepad       HELLO  exel ii  Type the    HELLO exe       iii  Save the file as autoexec bat       Step 15  Upload programs to WPAC 5000 using MiniOS7 Utility       For more detailed information about this process  please refer to section    2 4 1  Establishing    a connection       P   MiniOS  Utility Verion 3 1 7       ol Eg  3 Ga Fie   Connection   de Command Configuration T   Tools  lt 2 Help      Look in     0 Mini0 S7 _ Utility kd Lock in  Disk A    Mame Size Type Name Size Modified    O bin File Folder hello  exe 138 9206 2008 6 9        9 FIRMWARE File Folder B  AULOEXEC     25 2005 8 5      9 05_IMAGE File Folder    icpdas 1KE    load232 dll    EY Minis  Utility  chm 1 045K 6    es  ODP Connect to 10 1 0 224 25 path D 873 TEM    u      One is the    Hello    AutoRun  HELLO  EXE application file  and the  Autodownl
43. Only when updating  the wPAC 5000 firmware or OS  the switch can be moved from the OFF position to the  ON position     Move the Switch to the OFF position after the update is complete      gt  Lock Switch  Flash Memory Write Protection Switch    ON  Enable Write Protection  OFF  Disable Write Protection    UPAC 5000 Flash memory with Write Protection can physically lock that prevents    modification or erasure of valuable data on uPAC 5000     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  22    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com        gt  LAN    An Ethernet port is an opening on uPAC 5000 network equipment that Ethernet cables  plug into  Ethernet ports accept cables with RJ 45 connectors      gt  Pin Assignment    The pin assignments of the connector are as follows     Pin Signal Description    N C Unassigned  GND Ground  CTS   RTS   RxD   TxD   GND   D  RS 485    PWR2 Power Input 1  P GND  PWR1 Power Input 2  P GND    Frame Ground       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  23    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       1 5  Dimensions    All dimensions are in millimeters     basal  E i N i DHr UUPUU ED           ee ee ve ee Ee  Se oe oo ee oee       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  24    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       1 6  Compa
44. Project type                      New Project      rosanne  Bowe X  Project Type    Windows application  EXE  x    M Use Microsoft          HHE    ci L68xaldemowmner hello     Soc   o gt  TBS    gt  DEMO       gt  MSC Habe CPD       5 HELLO                      List Files of Type  feet CY     Project    mak         EJ c  T      UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  125       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 3  Add the user s program and the necessary library files to the project    Edit   HELLO MAE    File Hame  Directories     1 88al lib cou ledeademomecslib  T1 88xal lib E och  T188ga5 lib E  7188A       gt  DEMO    gt  MSC  E lib  CG    Board    List Files of Type  Drives       Library    lib         E c          i cM  1 86xa demoymechellohello  c  cAr ogsasdemosmeactlibs  1 odsal  lib    Step 4  Set the Code Generation on the Compiler              Project Type    MS DOS application  EXE     Ok     T Use Microsoft Foundation Classes Cancel      Customize Build Options Build Mode a  Help    Compiler          Debug      mea   CiCl   Compiler Options x  Build Options  C Debug Specific    Release Specific    Common to Both  Options String  i  l Cancel         nologo Gs  G1 AVS AL Os  D    NDEBUG   D  _ DOS  FA E   Help    Use Project Defaults                         Resources                Category  Category Settings  Code Generation    Code Generation  Custom Options  Custom Options 
45. an Administrator to make most of these changes     Performance    Visual effects  processor scheduling  memory usage  and virtual memory  Settings    User Protiles    Desktop settings related to your logon    settings    Environment Variables       Startup and Recovery       System startup  syste failure  an4  User variables For Administrator       Variable Value    TEMP C  Documents and Settings 4dministrat     TMF C Documents and Settings 4dministrat            o             System variables       Variable  value  Compu WINDOW Si systems2icmd  exe  NUMBER 1  ms Windows MT  C OW INOC SS    Stem HENE Th     PATHEST COM  ESE  Bat  CMD   VBS   VBE  a                   UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  56    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 4  Add the target directory to the end of the variable value field       A semi colon is used as the separator between variable values   For example      c  TC BIN  c  TC INCLUDE        Edit System Variable    Variable name     Variable value     Step 5  Restart the computer to allow your changes to take effect       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  57       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    3 2  uPAC 5000 APIs    There are several APIs for customizing the standard features and integrating with other    applications  devices and services     For more detailed 
46. ation interface  COM2  to access I 7K  series   O modules for a wide range of RS 485 network application  as shown    below     RS 485             Steps to communicate with i 7K series I O modules     Step 1  Use Installcom   to install the COM port driver   Step 2  Use SendCmdTo7000 2      to send commands  Step 3  Use ReceiveResponseFrom7000_ms   to get the response     Step 4  Use RestoreCom   to restore the COM port driver       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  85    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  to send a command    S01M    to I 7K I O module for getting the module name      include  lt stdio h gt      include    upac5000 h       void main void      unsigned char InBufO 60      InitLib        Initiate the upac5000 library       InstallCom 1 115200 8 0 1      Install the COM1 driver     InstallCom 2 115200 8 0 1      Install the COM2 driver       SendCmdTo7000 2    S01M    0      Senda command to COM2          Timeout   50ms  check sum disabled       ReceiveResponseFrom7000_ms 2 InBuf0 50 0    printCom 1     Module Name    s     InBufO    Delay 10       Wait for all data are transmitted to COM port       RestoreCom 1        Uninstall the COM1 driver       RestoreCom 2       Uninstall the COM2 driver          UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  86    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com 
47. ct       EE MultiRead 1 10 1  amp data2      Now data2 data 0x55       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  88    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 4  API for Flash Memory    e The WPAC 5000 module contains 512 Kbytes of Flash memory     e MiniOS7 uses the last 64K bytes  the other parts of the memory are used to store user  programs or data        Each bit of the Flash memory only e can be written from 1 to O and cannot be written from  Oto 1        Before any data can be written to the Flash memory  the flash must be erased  first which  returns all data to OxFF  meaning that all data bits are set to    1     Once there is completed   new data can be written     O x 8000    O x 9000    A  Free  448 K bytes 0 x A000    MiniOS7  64 K bytes  Total Size  512 K bytes    O x BOOO    O x C000    O x DOOO    O x E000    O x FOOO       API for writing data to the Flash Memory    1  FlashWrite      The FlashWrite   must be called to write data to the Flash Memory     API for reading data from the Flash Memory    2  FlashRead    The FlashRead   must be called to read data from the Flash Memory     uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  89    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  to write an integer to segnment OxDOOO  offset 0x1234 of the Flash memory      include  lt stdio h gt      include    upac5000
48. de files       c CA WINDO WS  sy  stem32tcemd exe   tc      File Edit Search Run Compile Debug Project Options Window Hely  HELLO    GPRe       _ F         N _  HO    BASTIC   LIBSUPACSHBA  LIB ae  iles       Fi Help   Enter directory path and file mask  gt  2 2 2 2 2 2       uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  64    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 9  Set the memory model to large       i  Select    Compiler    from the    Options    menu and then select    Code generation        ii  On    Model    option  select    Large     iii  Select    OK       cs Command Prompt   te    Window      ee ee   ee  Code generation        Advanced code generation     Entry      Exit Code     C   options     Optimizations       c  Command Prompt   te    Assume  5 Equals DS    fine  M       Use large memory model   iMb for code  i  b for static data     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  65    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 10  Set the memory model to large       i  Select    Compiler    from the    Options    menu and then select    Advanced code generation        ii  On    Floating Point    option  select    Emulation      iii  On    Instruction Set    option  select    80186      iv  Select    OK       cy Command Prompt   te    Window      Hale pee   f     Code ARNET  Entry    Exit Code     C   options
49. ected to PC     The upload process has the following main steps     1  Establishing a connection between PC and uwPAC 5000  2  Uploading and executing programs on wPAC 5000    3  Making programs start automatically    All of these main steps will be described in detail later     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  33       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    2 4 1  Establishing a connection between PC and pPAC 5000    There are two ways to establish a connection between PC and uwPAC 5000         1  RS 232 connection    2  Ethernet connection           Ef        a  Ef     E        ES EN     mm  a  a       Eg  3  Ef  Ei     Ef       ikikikiki  PTT       Each of the connection types will be described in detail later     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  34    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       2 4 1 1  RS 232 connection    Below are step by step instructions on how to connect to PC using a RS 232 connection     Step 1  Turn the switch of the Lock to    OFF    position  and the switch of Init to    ON       position    Step 2  Use the RS 232 Cable  CA 0910  to connect to PC    CMM    Cy   J   __       T eaa           uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  35       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Step 3  Run the MiniOS7 Utilit
50. er   e MSVC 1 50 Compiler    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  115    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       D 1  Turbo C 2 01    You have a couple of choices here  you can   1  Using a command line    For more information  please refer to  CD  8000 NAPDOS 8000 841x881x Demo hello Hello_C gotc bat  tcc  Ic  tc include  Lc  tc lib hello1 c       Demo basic Lib uPAC5S000 lib    2  Using the TC Integrated Environment    Step 1  Executing the TC 2 01    Step 2  Editing the Project file       Adding the necessary library and file to the project    cy C  WINDO WS ystem32tcemd exe   d  ie20 ite  dat Run Compile Project Options Debug Break watch             1t        Cob 19 Insert Indent Tab Fill Unindent   D NOMAMNE C       Message                          Fi Help F5 Zoom F   Switch F  Trace F  8 Step F 9 Make Fill Menu  l    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  116       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Step 3  Save the project and entering a name  such as LED prj    ey C  RWINDO WS ystem3 emd exe   d  tce20 te   of x   File Edit Run Compile Pro ject Options De bus Break    watch  Col 19 Insert indent  Tah Firs indent   D NOMAME C    1  0s shell  Quit Alt        Step 4  Load the Project    File Edit Run  Line 1    cy CAWINDO WS System32 cmd exe    2          p   B         Remove MESS ages    Step 5  Change the Me
51. g up the environment variables    After installing the compiler  several compilers will be available from the Windows Command  line  You can set the path environment variable so that you can execute this compiler on the    command line by entering simple names  rather than by using their full path names     Step 1  Right click on the    My Computer    icon on your desktop and select the       Properties    menu option       ye Right click    My    My Computer       Computer    and then  select    Properties            Search     Manage    Map Network DRESE LAE fx     Disconnect        mm  A System Restore   Automatic Updates    Remote      General Computer Hame Hardware Advanced       System   Microsoft Windows F  Professional  Version 2002    Registered to        pthuang  icp  p527 4 640 0000356 23006    Computer   AMD  K6ftm  3D processor  451 MHz  192 ME of RAM    Lx    Appl    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  55       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Step 2  On the    System Properties    dialog box  click the    Environment Variables    button    located under the    Advanced    sheet    Step 3  On the    Environment Variables    dialog box  click the    Edit    button located in    the    System variables    option       system Properties aE    System Restore iii I Automatic Updates  l Remote             General   Computer Name   Hardware    Advanced       You must be logged on as 
52. he 64MB flash memory     For example  reading data from the 64MB flash memory      include  lt stdio h gt    include    upac5000 h      include    MFS h       H define DISK A     H define DISK B  1    int main void        int iFileHandle  iRet     InitLib         Initiate the upac5000 library     iRet mfs_Init       if iRet lt  0  return     iFileHandle mfs_OpenFile _DISK_A    Test txt       r        if iFileHandle gt O        Print    Read from Test txt    n r        iRet mfs_Gets iFileHandle Data  80      max length is 80 bytes     if iRet gt 0  Print    Data  s n r    Data      mfs_CloseFile iFileHandle      UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  103    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Print    done           j   else   Print    Open file error n r       mfs_Stop       return     For more demo program about the Flash memory  please refer to     CD  NAPDOS uPAC 5000 Demo Basic 64MB_Flash   http   ftp lcodas com pub cd 8000cd napdos upac 5000 demo basic 64mb_ flash    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  104       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    4 10  API for microSD    Required library and header files   SD_V102 LIB and microSD h  a oS The uPAC 5000 series can support one microSD card and    the size can be 1GB or 2 GB        e Summarize of the microSD functions     Function Description    Initializes t
53. he COM1 driver       while  quit        if IsCom 1       Check if there is any data in the COM port input buffer         data ReadCom 1      Read data from COM1 port      ToCom 1  data      Send data via COM1 port       if data    q     quit 1     If    q    is received  exit the program             RestoreCom 1        Uninstall the COM1 driver          UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  77       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    API for showing data from COM ports    6  printCom      Functions such as printfCom   in the C library allow data to be output from COM  ports     For example  showing data from the COM 1 port      include  lt stdio h gt      include    upac5000 h       void main void        int i        Initiate the upac5000 library      InitLib      InstallCom 1  115200  8 0  1       Install the COM1 driver     for  i 0 i lt 10 i          printCom 1     Test  d n r     i         Delay 10       Wait for all data are transmitted to COM port       RestoreCom 1           UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  78    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 1 3  API for standard COM port    The standard COM port is used to upload program from PC to the wPAC 5000   Tips  amp  Warnings     C style  Standard COM port functions only can be used with the  COM1 port  the following configurations of the COM1 port
54. he INSTALL disk     Step 4  Enter the path to the directory you wish to install files to                      Turbo G   2nd Edition Installation Utility    1 5 D r n A NN EEE Path     n     1cppiai_ _    Description    Enter the path to the directory containing the Turbo C   files           UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  52         2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 5  Select    Start Installation    to begin the install process    cs CADOCUME  1 Osere ftcpp101 UNS TALL EXE  Turbo G   2nd Edition Installation Utility    Turbo G   Directory   BaSe   Hinary Files Subdirectory  C 2 TC BIMN   Header Files Subdirectory  C2 TC TNCLUDE   Library Subdirectory  C2 TC LIB   BGI Subdirectory  C 2 TC BGI   Tour Subdirectory  C2  TC TOUR   Class Library Subdirectory  G2 TC CLASSLIE   Examples Subdirectory  C 2 TC ERAMPLES   Install Tour  Yes  TOL GAanpace   Yes    LS MCLH J       Start Installation   88 __ Description  Selecting trit   Opeion Will begin copying Files to your hard drive into the  directories specified above     Fi Help F  Start the installation ENMTER Select ESC    Previous    Step 6  Press any key to continue    es CADOCUME 1 O0sertstiitcpp101UNS TALL EXE    Turbo C   2nd Edition Installation Utility    Turbo G   is now installed on your system  All  the necessary Files have been copied to your  hard drive and a configuration file has heen  created for the command line version of the  com
55. he microSD socket library    1  Open an existing file and return a file handle  c_open  an 2  Creates a new file     Closes a file and release a file handle     7 Moves the file pointer to relative offset from the current  pc_see  offset    Renames an existing file or a directory  including the  pc_move l  subdirectory    uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  105          Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Function Description    pc_get_freeSize_KB Gets the free space of the SD memory card  pc_get_usedSize_KB Gets the used space of the SD memory card  pc_get_totalSize KB Gets the total size of the SD memory card    pc_get_attributes Gets the file attributes  pc_set_attributes Sets the file attributes       API for starting microSD    1  pc_ Init      Before using any miscroSD functions  PC_Init   must be called to initialize the    microSD     API for enabling disabling microSD    3  pc_open      Before writing reading data to from the microSD card  PC_open   must be called to    open the file     4  pc_close      After the data has finished being written read to from the microSD  PC_close   must    be called to close the file with a file handle     API for writing data to the microSD  5  pc_write      After using PC_open   to open the file  PC_write   must be called to read data from    the microSD     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  106    Copyright    201
56. in  DiskA   Ta    EFPPFFFFTTTEFTFTEFTETTTETTFTTTTFTTTETTTTTTTETTETETTTTTTETTTTTTTTTTTETTETETTTETTFTTTTETTTTTTETTETEFTTTTTTTTTTETTTTTTTTTTTTTTTTTTTTTTTTTT     Hame Size Modified              Name Size Type      Hello 187KB Application    Upload Fo    Upload 4  Execute R AM        Update Mims  Image    rii    hea           PC side cee a module side  z       EERE LERRELORRELERREL CREEL OE EER OL EES ORES S CELE CM CERES EE RESE LES E ELSES ee       Step 2  On the module side  right click the file name that you wish to execute and then    select the    Run             2 MiniOS  Utility Verion 3 1 7 Sele    GH File  j Connection   ae Command Configuration D   Tools  amp 2 Help a    Tr EEEE EEEE EEEE OOOO COO OOO OO OOOO OO OO OOOO OO Onn  H3      if  if  a           Name Size Tope    E  Heslo 187KB Application Eo roes erry    Run with parameters       Reset MimiGe F4         COLLLLLLLLLLLLLLLLILLLLLELLLLLLLLLLLLLLLLLLLLLLLLLEL    T aa Eras Disk    uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  43    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       2 4 3  Making programs start automatically    After upload programs on the wPAC 5000  if you need programs to start automatically after  the uPAC 5000 start up  it is easy to achieve it  to create a batch file called autoexec bat and  then upload it to the wPAC 5000  the program will start automatically in the next start up     For example  to make the program    hello    run
57. information regarding uPAC 5000 APIs  please refer to  CD  NAPDOS upac 5000 Demo basic Lib 01_Lib Update _History_20100507 txt  http   ftp icodas com pub cd 8000cd napdos upac 5000 demo basic lib 01 Lib Update    History 20100507 txt    Before creating the application  ensure them that you have installed  If they are not installed     please refer to    section 2 2  Software Installation        UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  58       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    3 3  First Program in hPAC 5000    Here we assume you have installed the Turbo C   1 01  as the section    3 1  C Compiler  Installation     and the uwPAC 5000 APIs  as the section    2 2  Software Installation     under the    C driver root folder     Below are step by step instructions for writing your first program     Step 1  Open a MS DOS command prompt       i  Select    Run    from the    Start    menu  ii  On the    Run    dialog box  type    cmd     iii  Click the    OK    button    Windows XP Professional       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  59    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 2  At the command prompt  type    TC    and then press    Enter          cx     O  x     Microsoft Windows KP CUersion 5 1 2600   fC  Copyright 1985 2681 Microsoft Corp              C Documents and Settings Administrator  gt IC_       Step 
58. mory model  Large for uPAC5000 lib  and set the Code  Generation to 80186 80286       File Edit Run Compile Project UELLE Debug Break watch  Edit    Line i Col i Insert Indent Ta NONAME C    Model Large  Defines    Code generation    Calling convention C  Instruction set 80186780286  Floating point Emulation  Default char type Signed  Alignment   Generate underbars   Merge duplicate triny   standard atach    OBJ ae information On         UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  117      Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 6  Building the project    cy CAWINDO WS Systems   cmd exe   d ie20 tec  File Edit Run 9 fly ee Project Options Debug Break    watch    Line i      Gol      to OF  NONAME    D NONAME C  T Link EXE file    Build all    Primary C file           cy CAWINDO WSS ystem32temd exe   d Vte20 tie    File Edit Run Compile Project Options De bug Break watch    Edit  Line 1 re on i Insert Indent Tab Fill Unindent D NOHANE C    EXE file LED  EXE  Linking STC24 LIESCL LIB    Total Link  Lines compiled  1335 PASS 2  Warnings    4  Errors  H 4    Available memory  235K      SUCCESS   Press an       Message    Fi Help F5 Zoom F6 Switch FY Trace F amp  Step F9 Make Fili Menu HUM       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  118    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       D 2  BC   3 1  IDE    Step 1  Executing the 
59. n   http   www icpdas com products PAC up 5000 selection guide htm    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  8       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    1 1 2   wPAC 5000 Module Naming Convention    As you examine this manual  you   ll notice there are many different products available   Sometimes it is difficult to remember the specifications for any given product  However  if  you take a few minutes to understand the module naming conventions  it may save you  some time and confusion  The figure below shows how the module naming conventions  work for eachuPAC 5000 product                 GPS  amp  GPRS Power Saving Pre installed S W Pot LED Display Memory    0  Witcut OFS A GPRS     Ne L 312 KB SRAM P  Tes Ce Ves FO  GA Me Aash   1  Wih Ges l  Yes 2  768 KB SRAM i  1 HB ALM  2  Wih GPRS SIM340  7  GaGRar SM   12 KB Battery  3  With GPs  amp  GPRS SIMIO  Backup SRAM                         HPAC 5 X   X  XJ  P   GPS  amp  GPRS Power Saving Pre installed S W Pot Metal Casing Memory  0  Without GS    GPRS G No l  512 KB SRAM P  Ta FO  64 MB Fesh  L  With Gs i  Yea 2  768 KB SRAM Ni 1 MB NRAN  2  With Pas S1M340  7  SeGRaF SM  512 KB Battery  3  With Gs A GPRS SIM 40  Beckup SRAM    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  9    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       1 1 3  pPAC 5000 Comparison    1 1 3 1  General Series  
60. n MiniOS7 and ROM DOS     Feature MiniOS7 XO   V  Ea DIOS    ves NO  Yes NO    ves NO  ves NO  ves NO  ves NO  Yes NO  ves NO       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  110    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Appendix B  What is MiniOS7 Utility           ve ale on    Pr EES D Cahen ITE    Sy MiniOS7 Utility is a tool for configuring      e             Er jo   MET   I yin              uploading files to all products embedded with  ICP DAS MiniOS 7       b   5 6 9 8  Sj   r g   4 rpe per  7       4               oN  5  Gwag    Since version 3 1 1  the Utility can allow users    TeRTTTIRG  2 o gt           Sie SMe ecceoc  E E SEE  Ss ae        remotely access the controllers  7188E  8000E           Si ana etc  through the Ethernet         Out Tent     J hear   e Ka h  Functions Including frequently used tools  e Supported connection ways a   188XW  1  COM port connection  RS 232  b  7188EU  2  Ethernet connection  TCP  amp  UDP  c  7188E   Supported since version 3 1 1  9 ww nen nnn n nn nn  2              d  SendTCP     Maintenance    e  Send232  1  Upload file s  T  f  VxComm Utility  2  Delete file s   3  Update MiniOS7 image    e Configuration     Date and Time     IP address     COM port     Disk size  Disk A  Disk B     e WN e    e Check product information    CPU type     Flash Size     SRAM Size     COM port number    e U N e         CCC     Upload location        UPAC 5000 Series  C
61. n from the    Connection    menu          30  File  gt  Connection     a Command  Z  Configuration    Tools   7 H       New connection F2         Look i  Last Connection Ak  F2 yO       Disconnect Ctri F2    Name   Size Type     bin File Foldes  O FIRMWARE File Folder    C OS_IMAGE File Foldes    PA kateti IKE cunt    Step 5  On the    MiniOS7 Scan    dialog box  choose the module name from the list and    then choose    IP setting    from the toolbar    IF setting          uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  39       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Step 6  On the    IP Setting    dialog  configure the    IP    settings and then click the    Set     button    DHL      Disable     Enable    Step 7  On the    Confirm    dialog box  click    Yes       TP   ttine success   Do you want to leave IP tting dialog        UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  40    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 8  Click the    New connection    function from the    Connection    menu          7   MiniOS7 Utility Verion 3 1 7           33  File   gt  Connection     d Command Config                       n New connection 2 ff    Look   7 wi  Senia Last Connection Alt F2      Disconnect Ctrl F2   z    Search    Fiz       Step 9  On the    Connection    tab of the    Connection    dialog box  select    UDP    from the    drop
62. n interface  RS 232 422 485  CAN  FRnet   etc    customers can customize the hardware specification of their uPAC 5000 for different    situations     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  6    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       1 1  wPAC 5000  C Language Based     1 1 1   PAC 5000 Release Module    The wPAC 5000 Series are divided into the General series  GPS series and GPRS series     1 1 1 1  General Series    UPAC 5000 can be divided into five types  according to their features      gt   uPAC 5001 uPAC 5001P  UPAC 5001 FD pPAC 5001P FD  UPAC 5002 uPAC 5002P  UPAC 5002 FD pPAC 5002P FD  UPAC 5002 NV uPAC 5002P NV  UPAC 5002 SM  1PAC 5002P SM    VV VV V    For their comparison  please refer to section    1 1 3 1  General Series       1 1 1 2  GPS Series    GPS Series coming soon   Please visit our products page or contact us for more information     http   www icodas com products PAC up 5000 selection guide htm    1 1 1 3  GPRS Series    GPRS Series coming soon   Please visit our products page or contact us for more information     http   www icodas com products PAC up 5000 selection guide htm    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  7       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    1 1 1 4  GPS  amp  GPRS Series    GPS  amp  GPRS Series coming soon   Please visit our products page or contact us for more informatio
63. nd append mode  only 1 file handle can be used for   writing operation on all disks     Yes  Default is enabled     Writing verification Calling mfs_EnableWriteVerification and       mfs_DisableWriteVerification can change the setting    Yes    If an unexpected reset or power loss occurs  closed files  and files  Automate file system opened for reading are never at risk  Only data written since the  recovery last writing operation  mfs_WriteFile    might be lost  When the file   system reboots  it restores the file system to its state at the time of    the last writing operation     mfs_WriteFile   147 5 KB Sec  verification enabled   default   244 0 KB Sec  verification disabled    Writing speed  mfs_ Puts   142 1 KB Sec  verification enabled   default   229 5 KB Sec  verification disabled     mfs_ReadFile  734 7 KB Sec  Reading speed   mfs_ Gets  414 2 KB Sec  Max  length of writing   32767 bytes   data  Max  length of reading   32767 bytes   data    Resources upload          MES SDKs   http   ftp lcodas com pub cd 8000cd napdos upac 5000 demo basic lib       MFS Demos   http   ftp lcodas com pub cd 8000cd napdos upac 5000 demo basic 64mb_ flash    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  114       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    Appendix D  More C Compiler Settings    This section describes the setting of the following compilers     e Turbo C 2 01 Compiler  e BC   3 1 IDE   e MSC 6 00 Compil
64. nguage Based  User Manual  Version 1 0 1 Page  17    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       1 3  Specifications    1 3 1  General Series    Regular Version PAC5001 D  uPAC5001 FD D  uPAC5002 D  uPAC5002 FD D  uPAC5002 NV D  uPAC5002 SM D     Models  PoE Version uPAC5001P D  uPAC5001P FD D  T700 PA  D  uPAC5002P FD D  uPAC5002P NV D  uPAC5002P SM D        System Software    MiniOS7  DOS like embedded operating system     Program Upload Interface RS 232  COM1  or Ethernet    Programming Language C language    Compilers to Create  exe Files TC   1 01 TC2 01  Freeware  BC  3 1   5 2x MSC 6 0 MSVC    before version 1 5 2     CPU Module    CPU 80186 or compatible  16 bit and 80MHz     SRAM 512 KB 768 KB    Flash    512 KB  erase unit is on sector  64 K bytes   100 000 erase write cycles    microSD Expansion Yes  can support 1 or 2 GB microSD    C     Yes ve    1 MB NVRAM    e    Yes    512 KB Battery Backup SRAM  16 KB  NVRAM 31 Bytes  battery backup  data valid up to 5 year     RTC  Real Time Clock  RTC provide seconds  minutes  hours  date of week month  month and year  valid from 1980 to 2079     lt   wn    64 bit Hardware Serial Number Yes    Watchdog Timers Yes  0 8 second     Communication Ports    Ethernet RJ 45 x 1  10 100 Base TX  Auto negotiating  Auto MDI MDI X  LED indicators     LED Indicator    Hardware Expansion              I O Expansion Bus Yes    Mechanical    instalation o omeen  Environmental   10   90   RH  non
65. nion CD    This package comes with a CD that provides drivers  software utility  all of the required    documentations     etc  All of them are listed below     CD  Napdos    upac 5000    Demo    Basic       Demos related to uPAC 5000    Document       data sheet       Documents related to uPAC 5000    OS_Image       OS images related to uPAC 5000    PC_ Tool    MiniOS7 _Utility          Tools related to uPAC 5000    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  25    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       2  Getting Started    If you are a new user  begin with this chapter  it includes a guided tour that provides a basic    overview of installing  configuring and using the wPAC 5000     Before beginning any installation  please check the package contents  If any items are    damaged or missing  please contact us     In addition to Quick Start Guide  the package includes the following items        FF       uPAC 5000 Software Utility CD RS 232 cable Screw Driver   CA 0910   10016     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  26       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    2 1  Hardware Installation    Before installing the hardware  you should have a basic understanding of hardware  specification  such as the size of hard drive  the usable input voltage range of the power  supply  and the type of communication interfaces     For c
66. o open the file     4  mfs_CloseFile      After the data has finished being written read to from the 64MB flash memory  the    mfs_CloseFile   must be called to close the file with a file handle     API for writing data to the 64MB flash memory  5  mfs_Puts      After using the mfs_OpenFile   to open the file  the FlashRead   must be called to    read data from the Flash Memory     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  101    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  writing data to the 64MB flash memory      include  lt stdio h gt    include    upac5000 h      include    MFS h       H define DISK A     H define DISK B  1    int main void      int iFileHandle  iRet     InitLib        Initiate the upac5000 library     iRet mfs_Init     if iRet lt  0  return     iFileHandle mfs_OpenFile _ DISK_A    Test txt       w       if iFileHandle gt O        Print    Write string to Test txt          mfs_Puts iFileHandle    test mfs on 64MB flash       mfs_CloseFile iFileHandle     Print    done           else  Print    Open file error n r       mfs_Stop       return     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  102    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       API for reading data from the 64MB flash memory    6  mfs_Gets      After using the mfs_OpenFile   to open the file  the mfs_Gets   must be called to read  data from t
67. oad Files  Mone other is the    Current work directory  D S8Y8STEM        autoexec bat    batch file   Begin Key Thread            UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  69       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    4  APls and Demo References    There are several APIs and demo programs that have been designed for WPAC 5000   You can examine the APIs and demo source code  which includes numerous functions and  comments  to familiarize yourself with the MiniOS7 APIs and quickly develop your own    applications quickly by modifying these demo programs     The following table lists the APIs grouped by functional category     API Description Header File Library       For more detailed information regarding UPAC 5000 APIs  please refer to  CD  NAPDOS upac 5000 Demo basic Lib 01_Lib Update History _20100507 txt  http   ftp icodas com pub cd 8000cd napdos upac 5000 demo basic lib O1 Lib Update    History 20100507 txt    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  70    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       The following introduces the core API  MiniOS7 API  which is integrated into the uPAC5000  API set     Functions Library     uPAC5000 lib    This file contains the MiniOS7 API  Application Programming Interface  and has hundreds of  pre defined functions related to uwPAC 5000    Header File     uPAC5000 h    This file contains
68. omplete hardware details  please refer to section    1 2  Specifications       Below are step by step instructions for deploying the basic UPAC 5000 system     Step 1  Mount the hardware       The wPAC 5000 can be mounted with the bottom of the chassis on the DIN rail or piggyback      gt  DIN Rail mounting         The wPAC 5000 has simple rail clips for  mounting reliably on a  standard 35 mm DIN rail     Ww TO ai i m    E wo EIA UN    es   Ea ge    i  SEG W     _  Ww C       Tt    Mounting on DIN rail Removing from DIN rail    SHH TTL  A NIT AI NN    STL TH A  Aah     N S    A       uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  27    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com        gt  Piggyback mounting         The wPAC 5000 has two holes on both sides for  piggyback mounting     Step 2  Connect the wPAC 5000 to PC and setting up the power supply       The WPAC 5000 equip an RJ 45 Ethernet port for connection to an Ethernet hub switch and  PC  and powered by a standard 12 Vpc power supply or Power over Ethernet  PoE  switch    which powers all components      gt  External power supply via a standard 12 Vpc power supply  i  Connect PC to LAN port of wPAC 5000     ii  Connect the power supply  12   48 V  to PWR1 and GND  terminals of UPAC 5000    Ethernet  Cable d    Hub Switch  Frnemnet    Cable    ae    12   48 Voc        Power Supply    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  28 
69. ons   xX       BT Library Selection for All  7188  80       EHA 2  COM Ports Functions    B 2 1 Common FunctionsVariables       A 2 1 1 InstallCorn  B 2 1 2 bCtsChanged_x        A 2 1 13 IsCom   A 2 1 14 IsTxBufEmpty   DS 2 1 15 IsComOutBufEmpty             OT  A 2 1 12 lInstallComlnputData  3  DY 2 1 17 printCom     A 2 1 18 RestoreCom    a 2 1 13 Isom  Bj   221 Reton  A 2 1 14 IsTxBufEmpty  5 4 2 1 20 ReadComn        2 1 21 SetComTimeout r  A 2 1 15 IsCamOutBufEmpty  O ane SE   R2418 IsDetectBreak  v E     z DA 2 1 17 printCom ar       py 2 1 18 RestoreCoam    A 2 1 19 ReadCom    A 2 1 20 ReadComn    A 2 1 21 SetComTimeout    A 2 1 22 SetComPortBufferSize  5 2 1 23 SetCtsControlMode       M    gt        4  j   T        o  i        Pn    uPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  72       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    The following table lists the demo programs grouped by functional category     Folder Demo Explanation    MISC o Shows how to control the LED display     switch   the 64MB flash memory    Quality assurance program for the    MiniOS7 File System  Including function    test  read write performance test     the 64MB flash memory   aa en Include Dir  Read  Write  etc     microSD sda _qa Shows how to connect and control the    microSD  modbus Shows how to use a standard Modbus  hier oed    MTDemo05 _  MTDemo05_Modbus_TCP_Master_2 _TCP_Master_2    XWboard xw107 Shows how to connect and
70. opyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 2  Installing the MiniOS7 Utility       Mine  Utility    221 exe  ae  Minis  Utility Yer 3 21  Setup       MiniOS7 Utility is a suite of tool for managing MiniOS7 devices  uPAC 5000  iPAC 8000   UPAC 7186   etc    It   s comprised of four components     System monitor  communication  manager  file manager and OS loader     The MiniOS7 Utility can be obtained from companion CD or our FTP site   CD  Napdos minios7 utility minios7_utility        UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  31       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    2 3  Boot Configuration    Before you upload some programs to WPAC 5000  you need to enter the Init mode and  disable the Write Protection     Make sure the switch of the Lock placed in the    OFF    position  and the switch of the Init  placed in the    ON    position        UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  32    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       2 4  Uploading uPAC 5000 Programs    MiniOS7 Utility is a suite of tool for managing MiniOS7 devices  uPAC 5000  iPAC 8000   UPAC 7186   etc    It   s comprised of four components     System monitor  communication    manager  file manager and OS loader     Before you begin using the MiniOS7 Utility to upload programs  ensure that WPAC 5000 is    conn
71. p  Warnings    AN Before restaring the module for settings    to take effect  you must firstly turn the    switch of Init to    OFF    position        UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  45       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    2 5  Updating PAC 5000 OS image    ICP DAS will continue to add additional features to UPAC 5000 in the future  we advise you  periodically check the ICP DAS web site for the latest update to uPAC 5000     Step 1  Get the latest version of the uPAC 5000 OS image       The latest version of the uPAC 5000 OS image can be obtained from   CD  NAPDOS upac 5000 0S_image   http   ftp lcodas com pub cd 8000cd napdos upac 5000 os image    So o  uPAC 5000 20090903 img         Module Name    Release Date    Step 2  Establish a connection       For more detailed information about this process  please refer to section    2 4 1  Establishing    a connection       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  46    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 3  Click the    Update MiniOS7 Image        from the    File    menu           P   MiniOS7 Utility Yerion 3 1         G File   Connection      Command Configuration T  Tools gE Help      J  Update Minio57 Image                      d   Lock in  Disk 4 F              Hot List Ctrl D        Size T  No Name   T       Exit Alk   7     io Fil 4      FIRMWARE 
72. piler  You should now read the README file hy  typing README and pressing ENTER in your Turbo  G   directory  Mext  make sure the line   FILES   28  GCoSICS BI  is in your CONFLO SilGesieeieeenmda T CIH  Executing  your path   oPtr example   GC   IC EBI PATH CA EINSC 2 TC BIN  Executing  Press any key to continue  C  TC BI  Executing   C 2 TC  BINSUNZIP EXE TC 41P CATP  Executing   C  TC BIMSTHELP COM  FC  TC BINSTCHELP TCH ZH       Any Key Continue    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  53    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 7  Press any key to continue    es CADOCUME  1 0serLe ceppi INSTALL EXE      Turbo C   2nd Edition Installation Utility    Turbo G   Directory  PERN i  Binary Files Subdirector C 5SIC BIH    For a tutorial on the Turbo C   integrated  environment  change to the Turbo G   Tour  directory and run the Turbo G   Tour    For example      Change to       TC Tole   C 5IC BI And type  JATI RK  Executing    C 5ICBI Fress any key to continue  Executing  e   C  TC BIMSTHELP COM     FC  TC BIN TCHELP  TCH  Executing    C 2 TC BIMSUNZIP ERE TC ZIF C   TC  BIN  Executing    G  IC BIMSIHELP COM    FC  IC BINSTICGHELP TCH zU                   Any Key Cont inue    Step 8  Installation is complete       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  54    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       3 1 2  Settin
73. s       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  121    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 8  Make the project    EXE file   HELLO1 EKE    Linking     BC31 LIB CL LIB  Total Link  Lines compiled  1257  PASS 2  Warnings  B 4  Errors     5     Available memory  197YE    Fi Help Bring target up to date by compiling and linking  as necessary       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  122       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    D 3  MSC 6 00    Step 1  In the source file folder  create a batch file called Gomsc bat using the text  editor       Untitled   Notepad    el ve  Gs  FPae Fm  G1  SL HELLG c    link  Ma    NOE    NOI  HELLO      1lib 7188xbh1   del   obj    1  The source code   2  The object file name   3  The path of the functions library        Tip  amp  Warnings    A  C Don t strip comments  GS No stack checking     Fpa  Calls with altmath  Fm      map file      G1  186 instructions  AL Large model    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1    Page  123  Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 2  Run the Gomsc bat file    os CAWINDO ASS ystem32 cmd exe    C  7188XA Demo MSC Hel 1o gt Gomsc   C  7188XA Demo MSC Helloscl  c  Gs  FPa  Fm  G1  AL Hello c  icrosoft  R  C Optimizing Compiler Version 6 00   Copyright  c  Microsoft
74. y    Step 4  Click the    New connection    function from the    Connection    menu    3 G File     Connection   de Command z     Last Connection Alt F2  Disconnect Chrl F2    Search       Step 5  On the    Connection    tab of the    Connection    dialog box  select    COM1    from  the drop down list  and then click    OK       fe Connection    Connection   History     COM  TCP    Cancel       UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  36    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 6  The connection has already established    P   MiniOS  Utility Verion 3 1 7      G File lb Connection      Command Configuration T  Tools Help           Look in     o Mini 7 Utility      Name jee i odified      Gabin     EQ FIRMWAR                 gt  Connection F J E Refresh FS      UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  37       Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com    2 4 1 2  Ethernet Connection    Below are step by step instructions on how to connect to PC using a Ethernet connection     Step 1  Turn the switch of the Lock to    OFF    position  and the switch of Init to    ON       position            UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  38    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       Step 3  Run the MiniOS7 Utility    Step 4  Click the    Search    functio
75. ytes 256 Bytes Kbhit   Getch   Print    Putch    COM port    UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  75    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       4 1 2  API for MiniOS7 COM port    API for using COM ports    1  InstallCom      Before any COM Port can be used  the driver must be installed by calling InstallCom       2  RestoreCom      If the program calls InstallCom    the RestoreCom  must be called to restore the COM    Port driver     API for checking if there is any data in the COM port input buffer  3  IsCom      Before reading data from COM port  the IsCom   must be called to check whether    there is any data currently in the COM port input buffer     API for reading data from COM ports  4  ReadCom      After IsCom   confirms that the input buffer contains data  the ReadCom   must be  called to read the data from the COM port input buffer     API for sending data to COM ports  5  ToCom      Before sending data to COM ports  the ToCom   must be called to send data to COM    ports     UPAC 5000 Series  C Language Based  User Manual  Version 1 0 1 Page  76    Copyright    2010 ICP DAS Co   Ltd  All Rights Reserved  E mail  service icpdas com       For example  reading and receiving data through the COM 1      include  lt stdio h gt      include    upac5000 h       void main void      int quit 0  data     InitLib        Initiate the upac5000 library     InstallCom 1  115200  8 0  1      Install t
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
Model: PF1102 FREEZE PROTECTION CONTROL  STANDMIXER MIXER FRULLATORE BLENDER  Samsung Samsung Ch@t S3353 دليل المستخدم  Segma NEX - HL 201 Use and Care Manual    rs232/rs485 to rj45&wifi convert server  User Manual - Summationtechnology.com  WIN-TRACK presentation - SAV  Black Box KV822A User's Manual      Copyright © All rights reserved. 
   Failed to retrieve file