Home

iPAC-8000 User Manual (C Language Based)

image

Contents

1. 14 1 4 Dimension 15 1 4 1 4 SlOtS 15 1 4 2 8 SlOtS 16 1 5 Companion CD 18 2 Getting Started 19 2 1 Hardware Installation 20 2 2 Software Installation 24 2 3 Boot Configuration 26 2 4 Uploading iPAC 8000 Programs 27 2 4 1 Establishing a connection between PC and iPAC 8000 28 2 4 1 1 COM1 Connection 29 2 4 1 2 USB Connection 32 2 4 1 3 Ethernet Connection 35 2 4 2 Uploading and executing iPAC 8000 programs 40 2 4 3 Making programs start automatically 41 2 5 Updating iPAC 8000 OS image 43 3 Hello World
2. Step 6 The connection has already established 72 MiniOS7 Utility Yerion 3 1 7 EF fu Connection de coumans z MESE Tools E Help FR D KINO E EM DEL E E LORD Vere rreroncrer rente rn LLLCUCELECLELEELEELELELEELERLELEUEELELELELELLELELELEELECLELELEELCL ELE ELELELEEE EEELCLELE ERG EL EL ELE ER ELELEELELELELE ERG ELELELLEGELECLELLER Look in 7 Mini S 7 utility TOL Connection Status 2 4 1 2 USB Connection If the PC Laptop is not fitted with a COM port you can use the I 7560 USB to RS 232 converter for connection between iPAC 8000 and PC Laptop Below are step by step instructions on how to connect to PC using a USB connection Step 1 Turn the switch to Init position LI LI i UCM fl a tema s Cnm en E 7 2 fesses rH 7 oe Before using the USB connection ensure the l 7560 driver that you have installed If they are not installed please refer to section 2 1 Hardware Installation Step 3 Run the MiniOS7 Utility Step 4 Click the New connection function from the Connection menu New connection Ww Last Connection Alt F2 Disconnect Chrl F2 Look in Name 5 bin Search FIZ ja 7 Step 5 On the Connection tab of the Connection dialog box select COM3 from the drop down list and then click OK TA Connecton Connection H istor COMI COM Jk vi COMA UDF Data Bit 8
3. System variables Variable Value Compu WINDOWS system32lcmd exe 1 Windows MT T VVIRMDC ny n Ss skemi C JA TTA Ji PATHEST COM ESE BAT CMD VES NE 35s 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 value stema3zWWbem me Step 5 Restart the computer to allow your changes to take effect 3 2 IPAC 8000 APIs There are several APIs for customizing the standard features and integrating with other applications devices and services Before creating the application ensure them that you have installed If they are not installed please refer to section 2 2 Software Installation The following introduces the core API MiniOS7 API which is integrated into the iPAC 8000 API set Functions Library 8000a lib This file contains the MiniOS7 API Application Programming Interface and has hundreds of pre defined functions related to iPAC 8000 Header File 8000a h This file contains the forward declarations of subroutines variables and other identifiers used for the MiniOS7 API Standard IO MiniOS7 API mmable IO Timer and WatchDogT imer For full usage information regarding the description prototype and the arguments of the functions please refer to the MiniOS7 API Functions User Manual loca
4. dataptr 1 ReadNVRAM 1 Read the high byte j 4 6 API for 5 Digital LED The iPAC 8000 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 amm 7 API for starting the 5 Digit 7 SEG LED 1 InitsDigitLed Before using any LED functions the Init5DigitLed 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 After the InitsDigitLed 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 For example use the following code to display 8000E on the 5 Digit 7 SEG LED include lt stdio h gt include 8000a h void main void InitLib X Initiate the 8000a library InitsDigitLed Show5DigitLed 1 8 Show5dDigitLed 2 0 Show5DigitLed 3 0 Showb5DigitLed 4 0 Showb5DigitLed 5 14 The ASCII code for the letter E is 14 4 API for Timer e The iPAC 8000 can support a single main time tick 8 stop watch timers and 8 counts down timers e The iPAC 8000 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 TimerRese
5. A slave COM Port demo for request reply or Slv COM mE command response applications Illustrates how to Read Write byte data via ToCom In Out COM Port For more information about these demo programs please refer to CD NAPDOS iPAC8000 Demo Basic http ftp icpdas com pub cd 8000cd napdos ipac8000 demo basic gt 8k and I 87k I O series modules for I O Slot Applications IO in Slot Folder Demo Explanation 8K DI This demo program is used by 8K series DI H modules such as 8040 8051 etc 8073 This demo program is used for 8073 General Functions 87K DI This demo program is used by 87K series DI H modules in Com0 such as 87040 87051 etc This demo program is used by the 87024 AO 87024 module more demo programs 7K and I 87k series modules for RS 485 Network Applications Folder 7K 87K for Com Demo 7K87K_DI for Com 7K87K_DO_ for Co m K87K Al for Com AO 22 26 for Com AO 024 for Com Explanation COM Port can be used to connect and control I 7k or I 87k series modules For iPAC 8000 module and can use COM2 COM3 For iPAC 8000 module and CPU 40 and 80M can use COMS COMA For more information about these demo programs please refer to CD NAPDOS iPAC8000 DemoBasic7K87K for COM http ttp icodas com ub cd 8000cd napdos ipac8000 demo basic 7K87K for COM 4 1 API for COM Port T
6. 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 For example writing data to the microSD include lt string h gt include lt stdio h gt include 8000a h include microSD h int fd iRet InitLib If pc init Print Init microSD ok n r else Print Init microSD failed iIRet pc get errno switch iRet case PCERR BAD FORMAT 1 Print Error 01 format is not FAT Wr break case PCEHR 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_WRONLY PO_CREAT PO_APPEND word YXPS IWRITEIPS IREAD if fd gt 0 pc_write fd 1234567890 10 write 10 bytes pc close fd j j 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
7. IPAC 8000 User Manual C Language Based Version 1 0 1 June 2010 Service and usage information for iIP 8411 iIP 8811 iP 8441 iP 8441 FD iP 8841 iP 8841 FD 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 question please feel free to contact us We will give you a quick response within 2 workdays Email service icpdas com Table of Contents 1 Introduction 6 1 1 Features 7 1 2 Specification 12 1 3 Overview
8. 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 For example to refresh the Watchdog Timer include lt stdio h gt include 8000a h void main void Unsigned long time iTime InitLib X Initiate the 8000a library Enable WDT While lquit RefreshWDT User_function j DisableWDT 4 9 API for MES For iPAc 8000 FD series only Required library and header files MFS_V212 LIB and MFS h The iPAC 8000 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 e Summarize of the MFS functions Function Description Gets the total number of files stored in the NAND mfs_GetFileNo Flash Gets the size of available space that can be used to mfs GetFreeSize append file mfs GetBadSize Gets the size of non available space mfs GetUsedSize Gets the size of used space mfs GetFileSize Gets the size of file stored in the NAND Flash Uses the specified filename to retrieve file m s GetFilelntoByName cp information Uses the file number index to retrieve file mf
9. A 2 1 23 SetCtsControlMode v E A 2 16 IsDetectBreak v E E D Py 2 1 17 printCam uU H py 2 1 18 RestareCom A 2 1 18 ReadCam A 2 1 20 ReadCamn A 2 1 21 SetComTimenut A 2 1 22 SetComPortBufferSize 3 2 1 23 SetCtsControlMode Il gt i j n 5 C 3 3 First Program in iPAC 8000 Here we assume you have installed the Turbo C 1 01 as the section 3 1 C Compiler Installation and the PAC 8000 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 kJ 2 Type cmd J document or pill open it For you Internet rz o Window A zu M UT open Progra N ancel Browse Professional a Run Shut Down f a Fi c 1 WIRDGO WS Syste m sa Windows XP Step 2 At the command prompt type TC and then press Enter ICA Microsoft Windows RP Version 5 1 2600 fC Copyright 1985 2681 Microsoft Corp C Documents and Settings Administrator gt IC_ Step 3 Select New from the File menu to create a new source file O x Window Help Edit E y j X s pen RSS Save Save as Cano all
10. Edit Search Run Window Help I Compile Debus Opt ions D DEMOHELL0 Close project Add item Delete item Lnral nntinnz c Command Prompt tc File Edit Search Run Window Help Compile Debug Project Options 1 tI gt D DEMO HELLO CPP 1 void C s TC He llo PRJ iles Fi Help Enter directory path and file name mask 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 cx Command Prompt tc Open project Close project Delete item Local options Include files c Command Prompt tc H HELLO CPP w iles Qi E I 0 108 Aug 7 2098 10 49am Fi Help Enter directory path and file name mask 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 cx Command Prompt tc Window Help eS ce Application Advanced code generation Entry Exit Code C options Optimizations c Command Prompt tc Assume 5 Equals DS efines Fi Help Use large memory model iMb for code iMb for static data Step 11 Set the memory model to large
11. Properties menu option p Right click My My Computer Computer and then select Properties Search Manage Pik System Restore Automatic Updates Hemote General Computer Hame Hardware Advanced System Microsoft Windows mF Professional Properties Version 2002 Registered to pthuang icp 852 4 640 0000356 23006 Computer AMD Eb tm 3D processor 451 MHz 132 MB of RAM Apply 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 EJE3 X Remote Advanced HLRRRRSERRRASEESSASEHRSAHRSSEAHRESSIAHRRARARRRAE G ystem Restore j Automatic Updates General Computer Mame Hardware fou must be logged an as an Administrator ta make mast of these changes Performance Visual effects processor scheduling memory usage and virtual memory Settings User Protiles Desktop settings related to your logon Settings nyironment Variables Startup and Recovery System startup system Failure arvz User variables For Administrator variable Value TEMP C Documents and Settings 4dministrat TMP C Documents and Settings 4dministrat Environment Variables
12. Yes es Customer ODM functions Free of charge Appendix B What is MiniOS7 Utility MiniOS7 Utility is a tool for configuring me uploading files to all products embedded with ICP DAS MiniOS7 Since version 3 1 1 the Utility can allow users remotely access the controllers 7188E 8000E etc through the Ethernet BU Slacec ccs E 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 188E Supported since version 3 1 1 7 d SendTCP e Maintenance e Send232 1 Upload file s 2 Delete file s 3 Update MiniOS7 image f VxComm Utility e Configuration Date and Time IP address COM port Disk size Disk A Disk B A U N e Check product information CPU type Flash Size SRAM Size COM port number etc pw o R Upload location http ftp Icpdas com pub cd 8000cd napdos minios 7 utility minios 7 utility Appendix C What is MiniOS7 File System MFS 5000 FD MiniOS7 file system MFS 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 iPAC 8000 FD With 64MB Flash Memory NVRAM all of the 31 bytes Applications Log
13. int far MK FP 0xd000 0x1234 data data 4 5 API for NVRAM e The iPAC 8000 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 eNVRAM 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 For example use the following code to write data to the NVRAM address 0 include lt stdio h gt include 8000a h void main void int data 0x55 data2 InitLib X Initiate the 8000a library WriteNVRAM 0 data data22HeadNVRAM 0 Now data2 data 0x55 j For example the following can be used to write an integer two bytes to NVRAM include lt stdio h gt include 8000a h void main void int data 0xAA55 data2 char dataptr char amp data InitLib X Initiate the 8000a library WriteNVRAM 0 dataptr Write the low byte WriteNVRAM 1 dataptr 1 Write the high byte dataptr char amp data2 dataptr zReadNVRAM 0 Read the low byte
14. 6 On the IP Setting dialog configure the IP settings and then click the Set button Eak DHCP Disable Enable Cancel Step 7 On the Confirm dialog box click Yes gt P setting success 0 Do you want to leave IP setting dialog Step 8 Click the New connection function from the Connection menu 7 MiniOS7 Utility Verion 3 1 7 QR File Connection 4 Command Config New connection Look in had Last Connection Alt F2 Disconnect Chrl F2 7 Mame l e bin Search d Byn va Step 9 On the Connection tab of the Connection dialog box select UDP from the drop down list type the IP address which you are assigned and then click OK RP D Connecton Connection History UDP m Serial Port TCP UDP Baud Rate IL IF 10 0 9 52 Data Bit Fort Parity Stop Bit Step 10 The connection has already established 72 MiniOS7 Utility Verion 3 1 7 xx File Connection Command Configuration T Tools amp Help FEE E LEE PUNUE NNUNU rnnt er reme ERE EE PST SUC get Tta ertt TT ETT AAAA AAAA UGG E CE GIG CIC GIG EG CEU UICE GIC CECI EGG AAAA AA AAAA AAAA AAA AAAA AAAA AAA AAAA AAA AEEA A AAAA L Gi cof Look in O Mini S 7 Utility b L onnection F Z mul D elete F8 es Hefresh F 3 s 2 4 2 Uploading and executing iPAC 8000 programs Before uploadi
15. 734 7 KB Sec Heading speed mfs Gets 414 2 KB Sec Max length of writing 32767 bytes data Max length of reading 32767 bytes data Resources upload e MES SDKs http ftp Icpdas com pub cd 8000cd napdos ipac8000 demo basic lib e MFS Demos http ftp Icpdas com pub cd 8000cd napdos ipac8000 demo basic 64mb flash 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 Compiler e MSVC 1 50 Compiler 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 841 x881x Demo hello Hello_C gotc bat tcc Ic tc include Lc tc lib hello1 c Demo basic Lib iPAC 8000 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 ey CAWINDOWS G ystem3Z7wmd exe d McZ ic LLL Run Compile Project pt ions Debug Break watch lt Cob i9 Insert Indent Tab Fill Unindent D NOMAME C Message Fi Help F5 Zoom F6 Switch F Trace F8 Step F9 Make Fi Menu lll Step 3 Save the project and entering a name such as LED prj cx CAWINDOWS GS ystem32wmd exe d McZ Nc File Edit Run Compile Project Options Debug Ereakruatch Col 19 Insert Indent Tab Fimi indent D
16. API for Flash Memory e The iPAC 8000 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 e Each bit of the Flash memory only can be written from 1 to O0 and cannot be written from O to 1 e 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 Free 448 K bytes MiniOS7 64 K bytes EUN Total Size 512 K bytes 0 x C000 0 x D000 0 x E000 0 x F000 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 For example to write an integer to segnment OxDOOO offset 0x1234 of the Flash memory include lt stdio h gt include 8000a h void main void int data 0xAA55 data2 char dataptr int dataptr2 InitLib Initiate the 8000a library dataptr char amp data FlashWrite 0xd000 0x1 234 dataptr FlashWrite 0xd000 0x1 235 dataptr Read data from the Flash Memory method 1 dataprt char amp data2 dataptr FlashRead 0xd000 0x1234 dataptr 1 FlashRead 0xd000 0x1235 Read data from the Flash Memory method 2 dataptr2
17. CAN communication module in local slot FRnet I O and CAN devices are easy to be integrated Dual Ethernet Ports for iP 8441 and iP 8841 modules only iPAC 8000 provides two Ethernet ports The two Ethernet ports can be used to implement redundant Ethernet communication and separate Ethernet communication one for global Internet one for private Ethernet Redundant Power Inputs To prevent theiPAC 8000 from failing by the power loss the power module is designed with two inputs The iPAC 8000 can keep working even one power input fails and mean while there is a relay output for informing the power failure Ventilated Housing Design Allows Operation Between 25 75 C Each iPAC 8000 is housed in a plastic based box with a column like ventilator that can help to cool the working environment inside the box and allow the iIPAC 8000 operating between 25 C and 75 C 1 2 Specification Models iP 8411 iP 8441 iP 8441 FD iP 8811 iP 8841 iP 8841 FD System Software MiniOS7 DOS like embedded operating system RS 232 RS 232 Program Download Interface RS 232 COM1 or Ethernet RS 232 COM1 or Ethernet COM1 COM1 Programming Language C Language TC 1 01 Freeware TC 2 01 Freeware Compilers to create exe files BC 3 1 5 2x MSC 6 0 MSVC before version 1 5 2 CPU Module cu 80186 or compatible 16 bit and 80 MHz SRAM 512 KB 768 KB 512 KB 768 KB Flash 512 KB 100 000 erase write cycles with Flash pr
18. NONAME C gt dir O amp shell Quit Alt x Step 4 Load the Project c CAWINDOWS System37wmd exe d MceZ ve File Edit Run Line 1 Col 1 Inserti Project name LED PRJ Break mari on Errors Remove MESS ages Step 5 Change the Memory model Large for iPAC 8000 lib and set the Code Generation to 80186 80286 Run Compile Project Opt ions De hug Break uatch Edit Col i Insert Indent Ta NONAME C Model Large Defines Code generation Calling convention C Instruction set 66166780256 Floating point Emulation Default char type Signed Alignment Generate underbars Merge duplicate triny EE EEEE atach OBJ E information On C Step 6 Building the project cx CAWINDOWS System32wmd exe d ie20 tec File Edit Hun fy eet Project Options Debus Line 1 Col Build all Primary C file ML I cy CAWINDOWS System32wmd exe d Vte20 tie File Edit Run Compile Project Opt ions De buc Edit Line 1 Gnl 1 Insert Indent Tab Fill Unindent Linking EXE file LED EXE Linking STCZ2BH LIB CL LIB Total Link Lines compiled 1335 PASS 2 Warnings H H Errors H H Available memory Success Press an Message Break watch D HOHRHE tC Break watch D NOMANME C Fi Help F5 Zoom F6 Switch FY Trace F8 5tep F Make Fi Menu D 2 BC 3 1 IDE Step 1 Executing the Borland C 3 1 Step 2 Creating a new project file prj c Command Prompt be File Edit Search an Compile n TE Re
19. SS se m Nm dis E Project Options Window Help at IS Compile Debug NONAMEGG CPP T a Pi Help Alt F8 Next Msg Alt P Prev Msg Alt F9 Compile Step 4 Type the following code Note that the code is case sensitive include Demo basic Lib 8000a h Include the header file that allows 8000a lib functions to be used void main void InitLib Initiate the 8000a library Print Hello 8000 r n Print the message on the screen Step 5 Save the source file i Select Save from the File menu ii Type the file name Hello iii Select OK ef VE RIT REY CTRFATRITN S CR tc Edit Search Hun Compile Debug E HELLO CPP Hew Open Save as Save all Change dir Print cs Command Prompt tc File Edit Search Run Compile Debug Project Options Window Hely void g G TC HELLO CPP iles Fi Help Enter directory path and file name mask Tips amp Warnings You can write the code as shown below with your familiar text editor or other tools please note that you must save the source code under a filename that terminates with the extension C Step 6 Create a project prj i Select Open project from the Project menu li Type the project name Hello ii Select OK iv Select Add v Select Done to exit ci Command Prompt tc
20. Your First Program 46 3 1 C Compiler Installation 47 3 1 1 Installing the C compiler 48 3 1 2 Setting up the environment variables 52 3 2 IPAC 8000 APIS 55 3 3 First Program in iPAC 8000 58 4 APIs and Demo References 69 4 1 API for COM Port 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 Port functions Comparison 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 NVRAM 91 4 6 A
21. data with timestamp Log data and forward via the Ethernet User s program CN N COM Port Functions DAV MFS Specifications Item Description 1 2 size of the flash memory size 456 files max for each disk Disk Size max for each file 12 bytes max case sensitive 1 Read only 2 Write only Creates a new file to write data or overwrite a File operation modes P ME file if the file is already exit 3 Append appends data to a file 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 File handle reading mode For write and 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 Automate file system files opened for reading are never at risk Only data written recovery since the 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
22. i Select Directories from the Options menu ii On Include Directories option specify the header file ii On Library Directories option specify the function library file iv Select OK Step 12 Select Build all from the Compile menu to build the project c Command Prompt tc Edit Search Run Debug Project Opt ions Window Help Alt F F Information Remove messages cy Command Prompr File Edit Search Run Compile Debug Project Options Window Help void Library HELLO LIB Adding HELLO OBJ Total File Lines compiled 1573 BH Warnings H BH Errors H i Available memory 1978K Fi Help hf 1t 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 Step 14 Create an autoexec bat file Untitled Notepad Maf File Edit Format wiew Help i Open the Notepad HELLO Exel ii Type the HELLO exe iii Save the file as autoexec bat Step 15 Upload programs to iPAC 8000 using MiniOS7 Utility For more detailed information about this process please refer to section 2 4 1 Establishing a connection 7 MiniOS 7 Utility Verion 3 1 7 33 File Connection de Command Configuration Tools lt 2 Help Look in 9 Mini0 S7 Utility v Lock in Disk A Mame Sie Type ame Size Modified O
23. 041 571 328 bytes free C 7188xXA Demo MSC Hel lo gt _ D 4 MSVC 1 50 Step 1 Run MSVC exe z a Microsoft Visual C DEMOS MAE File Edit View Project Browse ebu Options Window Help lt 2 gt DATIBSEVICPIZSER VER DEMO MSYC 1 SIDEMOD4 USER C H include lt string h gt fizcivde ME EE void Use Project Name L Browse rs a br Browse J E x BAT HEEE EE rm fedS MAK dX dminios demolmectled5 B BDDDE 43 BAH aes OW xy x List Files of Type O RREO vnl Project mak n ICFDATA a SUE 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 Project type Hew Project eene X 8 Project Type Windows application EXE Use Microsoft Bese Fy co 1SBxademoswnschhella Soc gt 7188X gt DEMO gt MSC ifi QW f HELLO List Files of Tope SERERE C Project mak E c Step 3 Add the user s program and the necessary library files to the project Edit HELLO MAE x File Mame Directories Close FT 882al lib E 71 888a demasmscib 188zal lib E ck Cancel 188845 lib GS 7180A gt DEMO Help gt MSC f lib HES Board List Files of Type Drives Library lib EI c c AT188sa demo mschhelleshella c x A
24. C 8000 in the future we advise you periodically check the ICP DAS web site for the latest update to iPAC 8000 Step 1 Get the latest version of the iPAC 8000 OS image The latest version of the iPAC 8000 OS image can be obtained from CD NAPDOS iPAC8000 0S_ Image http ftp Icodas com pub cd 8000cd napdos ipac8000 os imaae 837 2M U DP 20090903 imMg 000 O CPU Type Number of MAC Protocol Type e Release Date Step 2 Establish a connection For more detailed information about this process please refer to section 2 4 1 Establishing a connection Step 3 Click the Update MiniOS7 Image from the File menu 7 Mini0S7 Utility Verion 3 1 7 il File D Connection a Command Configuration T Tools amp Help Update Mini Image E Fi M Lack in Disk 4 Hot List Cii Exit amp E 4 x Laon O FIRMWARE i Pa 305 IMAGE i Ec o wm x aa JU imt n a mme um auf Step 4 Select the latest version of the MiniOS7 OS image Select MintOS 7 Image file Saver O 05 Image 4 Sold te ESjCB37 2M UDP 20090603 ime My Recent Document Step 5 Click the OK MiniOS7 Utility Ferion 3 X Please wait a while for rebootimng Step 6 Click the Info from the Command menu to check the version of the OS image T MiniOS7 Utility Ferion 3 2 1 y Fie b Connection Command Z Configuration To
25. E HELLO OBJ Object Modules obj Run File HELLO exe HELLO EXE List File c HELLO map nul Libraries lib c msvc lib Libraries lib c msvc nfc lib j j lib SLIBN 7188XAL LIB Peas lib oldnames Libraries lib llibce Creating browser database HELLO EXE 0 error s 0 warning s L1
26. In the source file folder create a batch file called Gomsc bat using the text editor E Untitled Notepad File Edit Format view Help cl fe Gs FPa Fm G1 aL HELLO c link H NOE HOI HELLO 1 lib 7188xbhbl del ahj 1 The source code 2 he object file name 3 The path of the functions library Tip amp Warnings C Don t strip comments GS No stack checking Fpa Calls with altmath Fm map file G1 186 instructions AL Large model 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 Gl AL Hello c icrosoft R C Optimizing Compiler Version 6 00 Copyright c Microsoft Corp 1984 1990 All rights reserved Hello c C 7188XA Demo MSC Hello gt link MA NOE NOI Hello XMlibX7188xal icrosoft i 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 Anew executable file will be created if it is successfully compiled cy CAWINDOWSZ G ystem32 cmd exe c 7188XA Demo MSC Hel lo gt dir Volume in drive C has no label Volume Serial Number 1s 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 3 File s 7 496 bytes 2 Dir s 22
27. M port RestoreCom 1 Uninstall the COM driver RestoreCom 2 Uninstall the COMe driver 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 inii API for writing data to the EEPROM 1 EE WriteEnable Block 8 31 Before writing data to the EEPROM the Heserved for EE WriteEnable must be called to system use write enable the EEPROM 2 EE WriteProtect After the data has finished being written Block 32 64 to 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 For example to write data to block1 address 10 of the EEPROM include lt stdio h gt include 8000a h void main void int data 0x55 data2 InitLio X Initiate the 8000a library EE WriteEnable EE MultiWrite 1 10 1 amp data EE WriteProtect EE MultiRead 1 10 1 amp data2 A Now data2 data 0x55 j 4 4
28. PI for 5 Digital LED 93 4 7 API for Timer 95 4 8 API for WatchDog Timer WDT 97 4 9 API for microSD 101 Appendix A What is MiniOS7 101 Appendix B What is MiniOS7 Utility 107 Appendix C What is MiniOS7 File System MFS 108 Appendix D More C Compiler Settings 114 D Tubo C O Oe eee 112 D2 o QNID cR 115 SERVER a VENTES Rc 5 ee eee ee ee ei a 1 Introduction iPAC 8000 Compact Embedded Controller Contents The iPAC 8000 is a new family of compaet modular intelligent and rugged distributed O input output systems C j L iPAC 8000 is a compact size PAC Programmable Automation Controller It equips an 80186 CPU 16bits and 80MHz running a MiniOS7 operating system several communication interface Ethernet RS 232 485 and 4 8 slots to expand I O modules The operating system MiniOS7 can boot up in a very short time 0 4 0 8 seconds It has a built in hardware diagnostic function and supports the full range of functions required to access all high profile I 8K and I 87K series I O modules such as DI DO DIO Al AO Counter Frequency motion control modules etc And to
29. TE Bexa demna smsce Mib 188 al lib x Project Type MS DOS application EXE Ok Use Microsoft Foundation Classes Cancel Customize Build Options Build Mode Compiler Linker Help t Debug Cil Compiler Options x Build Options Debug Specific Release Specific Common to Both Options String c ance fnologo Gs G17 AWS AL 70s JD NDEBUG D DOS FR Help Use Project Defaults Category Category Settings Code Generation Code Generation Custom Options Custom Options C Debug Options 20186 r 80188 hd Check Pointers Listing Files al 7 iv Disable Stack Checking Calling Lonve P Code Generation Cr C Precompiled Headers Preprocessor Floating Point Calls Code Generator Segment Names Use Emulator Auto Select Struct Member Byte Alignment 2 Bytes EN Step 5 Change the Memory model large for iPAC 8000 lib CAC Compiler Options x Build Options t Debug Specific Release Specific Common to Bath Options String Cancel fnologo Gs G7 WS AL 70s 7D NDEBLIG D DOS FA Help Use Project Defaults Category Category Settings Memory Model Code Generation _ Custom Options ment Setup Custom Options C Debug Options Listing Files Memory Model z Optimizations Hew Segment Data Size Threshold Po P Code Generation Frecompiled Headers Preprocessor Segment Hames A
30. a SEN EE o m Frec E c File F HELLO1 FRJ Step 3 Add all the necessary files to the project cs Command Prompt be Step 4 Change the Memory model Large for iPAC 8000 lib oi CAWINDO WStsystem32 emd exe be File Edit Search im Compile Assume amp amp yon DS fin M Step 5 Set the Advanced code generation options and Set the Floating Point to Emulation and the Instruction Set to 80186 CA ibid due o exe bc Fi Help ES Data hreshold EERS Step 6 Set the Entry Exit Code Generation option and setting the DOS standard ci CAWINDOWSS ystem32icod exe bc File Edit Search Run o mpile Debug Proje Window HONAMERH CPP Dae Application Sj AES eoe E G T Source EXTA d lt gt DOS standard Step 7 Choosing the Debugger and set the Source Debugging to None CAWINDO WStsystem32 cmd_exe b 0 x File Edit Tre Run Compile Debug Proj ect Window Help C DOCUME 1 ADMINI 1 HONANERS Application Compiler Transfer Inspectors program Heap Size KZ X bytes Step 8 Make the project B bu Project Options Window Hel Compile Alt F ink ESE file HELLO EXE Linking SBC31 LIB CL LIB Total Link Lines compiled 1257 Ph55 2 Warnings H BH Errors H fluailahle mmm Fi Help Bring target up to date by compiling and linking as necessary xj m m S S x a D 3 MSC 6 00 Step 1
31. be provided Step 2 Connect the iPAC 8000 to PC and setting up the power supply The iPAC 8000 equips an RJ 45 Ethernet port for connection to an Ethernet hub switch and PC and powered by a standard 12 VDC power supply v M e eom N k PEE An 10 30 Voc If the PC Laptop is not fitted with a COM port you can use the l 7560 USB to RS 232 converter for connection between iPAC 8000 and PC Laptop i l 7560 Laptop Power Supply 10 30 Voc The l 7560 driver need be installed before starting to use it You can obtain the driver from enclosed CD CD Napdos 7000 756x_ or FIP site ftp ftp icodas com pub cd 8000cd napdos 000 756x After installing the USB driver please check the Device Manager to make sure the driver has been installed and the COM port number which is assigned to the l 7560 ig Monibors BB Network adapters Ports COM amp LPT X Communications Port COMI of Communications Port COM2 Jy PCP Printer Port LPT1 BEA ICPOAS 1 756 Converter COM3 a Processor 4m SCSI and RAID controllers Step 3 Insert I O modules There are various types of I O expansion modules for interfacing many different field devices to the iPAC 8000 system For more information about I O expansion module please refer to http www icpdas com products PAC xpac remote_io support list htm These modules have their own manuals so if you are us
32. bin File Folder hello exe 138 328 2008 6 9 O FIRMWARE File Folder autaegec 25 2005 8 5 9 05_IMAGE File Folder amp icpdas amp Inad232 dll One is the Hello application file and the other is the autoexec bat batch fila 4 APIs and Demo References There are several APIs and demo programs that have been designed for iPAC 8000 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 CPU driver 8000a h 8000a lib DCON driver DCON_FUN h DCON_8KL LIB Tepip32 h tepadm32 lib MEW MFW09313 LIB SD_V100 LIB VXCOMM H V8a_3230 lib The following introduces the core API MiniOS7 API which is integrated into the iPAC 8000 API set Functions Library 8000a lib This file contains the MiniOS7 API Application Programming Interface and has hundreds of pre defined functions related to iPAC 8000 Header File 8000a h This file contains the forward declarations of subroutines variables and other identifiers used for the MiniOS7 API Standard IO MiniOS7 API mmable IO Timer and WatchDogT imer For full usage information regarding the description prototype and the arguments of the functions please refer to
33. dard COM port functions only can be used with the COM port the following configurations of the COM1 port 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 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 COM1 include lt stdio h gt include 8000a h void main void int quit 0 data InitLib X Initiate the 8000a library while quit if Kbhit Check if any data is in the input buffer data Getch Read data from COM1 Putch data Send data to COM1 if data q quit 1 If q is receiv
34. ed exit the program For example showing data through COM1 include lt stdio h gt include 8000a h void main void Int i Initiate the 8000a library InitLib for i 0 i lt 10 i Print Test d n r i j 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 8000a 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 in for if IsCom 1 item ReadCom 1 if item q return else printCom 1 n r include lt stdio h gt include 8000a 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 j else Print n r printCom 1 char Print char Putch item Print n rASCII c n r item Print Hex 02X n r item ToCom 1 item printCom 1 n rASCII c n r item printCom 1 Hex 9602X n item j j j Delay 10 RestoreCom 1 j 4 1 5 Request Response protocol define on COM port Request Response communication is very typical protocol architecture If you want to des
35. er it includes a guided tour that provides a basic overview of installing configuring and using the iPAC 8000 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 iPAC 8000 software Utility CD RS 232 Cable Screw Driver IP 8xxx CA 0915 1C016 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 complete hardware details please refer to section 1 2 Specifications You also need to know the expansion capacities in order to choose the best expansion module for achieving maximal efficiency For more information about expansion module that are compatible with the iPAC 8000 please refer to http www icpdas com products PAC 1 8000 8000 IO modules htm Below are step by step instructions for deploying the basic iPAC 8000 system Step 1 Mount the hardware The iPAC 8000 can be mounted with the bottom of the chassis on the DIN rail The iPAC 8000 installation must provide proper ventilation spacing and grounding to ensure the equipment will operate as specified A minimum clearance of 50mm between the iPAC 8000 and the top and bottom side of the enclosure panels must
36. for iP 8441 and iP 8841 modules only With the dual LAN features of iPAC 8000 user s software on PCs or other controllers can implement redundant Ethernet communication With VxComm technique the redundant Ethernet communication is ready One virtual COM port on PC can map to one COM port of iPAC 8000 via two IP address When the communication is failed or timeout the VxComm driver can automatically and quickly switch the virtual COM port mapping to another IP address to keep the communication Easy Use Software Development Template Xserver for TCP IP Application To simplify the TCP IP software developing process we designed a software develop template called XServer It is a reliable opened expandable all purposed and easily to be used library The Xserver implements 9096 functionalities of Ethernet communication Refer the rich demo programs we provided software engineer can easily finish the 1096 remaining funtionalities and greatly shorten the developing time Slave I O firmware options for DCON or Modbus TCP protocol In some simple Ethernet I O applications users just want to know how to send a command to the I O to get back a response They don t want to develop a firmware That is too difficult to them Thus we also provide two firmware for this purpose A DCON firmware DCON firmware supports an ASCII string based command set called DCON protocol B Modbus firmware Modbus firmware supports the standard Modbus TCP prot
37. he iPAC 8000 provides five built in COM ports psessf 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 Functions Port MiniOS7 ReadCom 1 2 etc 1 KB 1 KB IsCom ToCom printCom COM port Buffer Functions C style Standard 1 512 Bytes 256 Bytes Kbhit Getch Print COM port 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
38. ign 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 Request Response Debug information Command1 Commandf1 co Debug information Command2 Command2 Q Debug information Quick program Other command Debug information Unknown command 4 2 API for I O Modules The iPAC 8000 equip a RS 485 communication interface COM2 to access I 7K series I O modules for a wide range of RS 485 network application as shown below esee 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 For example to send a command 01M to I 7K I O module for getting the module name include lt stdio h gt include 8000a h void main void unsigned char InBufO 60 InitLib X Initiate the 8000a library InstallCom 1 115200 8 0 1 Install the COM1 driver InstallCom 2 115200 8 0 1 Install the COMe driver SendCmdTo7000 2 01M 0 Send a command to COM Timeout 50ms check sum disabled HeceiveResponseFrom7000 ms 2 InBuf0 50 0 printCom 1 Module Name s InBufO Delay 10 Wait for all data are transmitted to CO
39. include lt stdio h gt include 8000a h include microSD h int fd iRet unsigned char Buffer 80 InitLib If pc init Print Init microSD ok n r else Print Init microSD failed iRet pc get errno switch iRet case PCERR BAD FORMAT 1 Print Error 01 format is not FAT Wr break case PCEHRH 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 20 adds zero end to the end of the string pc close fd Print yos Buffer j j For more demo program about the microSD please refer to CD NAPDOS iPAC8000 Demo Basic microsd http fto codas com pub cd 8000cd napdos ipac8000 demo basic microsd 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 N DOS whether PC DOS MS DOS or ROMDOS is a set of commands or 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 between MiniOS7 and ROM DOS Feature MiniOS7 2X0 S BIO NS Yes Yes
40. ing them you should supplement this manual with the manual specifically designed for the special module 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 iPAC 8000 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 IPAC8000 Demo Basic 7K8 7K_for_COM COM_ Ports Timer Framework Xserver Readme txt Step 2 Installing the MiniOS7 Utility Manis Utility 221 exe E Mims Utility Ver 3 21 Setup MiniOS7 Utility is a suite of tool for managing MiniOS7 devices uPAC 5000 iPAC 8000 pPAC 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 FIP site CD Napdos minios utility minios7_utility ftp ttp icodas com pub cd 8000cd napdos minios 7 utility minios7_utility 2 3 Boot Configuration Before you upload some programs to iPAC 8000 you need to enter the Init mode to stop the program running Make sure the switch of the Lock placed in the Init position 2 4 Uploading iPAC 8000 Programs M
41. iniOS7 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 iIPAC 8000 is connected to PC The upload process has the following main steps 1 Establishing a connection between PC and iPAC 8000 2 Uploading and executing programs on iPAC 8000 3 Making programs start automatically All of these main steps will be described in detail later 2 4 1 Establishing a connection between PC and iPAC 8000 Connect the Host PC to the iPAC 8000 with the following connection types 1 RS 232 connection 2 USB connection 3 Ethernet connection for iP 8441 and iP 8841 modules only 2 4 1 1 COM1 Connection Below are step by step instructions on how to connect to PC using a RS 232 connection Step 1 Turn the switch to Init position esses Hx Step 3 Run the MiniOS7 Utility Step 4 Click the New connection function from the Connection menu Be File p Connection de Command Config Last Connection Alt F2 Disconnect Chrl F2 Search Fl Step 5 On the Connection tab of the Connection dialog box select COM1 from the drop down list and then click OK JE ma Connection Connection History Data Bit Parity DM one v SpBiT M
42. ity backplane 5 51 A 5 V supply to backplane 5 1 A 5 V supply to I O I O expansion slots 30 W in total expansion slots 30 W in total 67 W 0 28 A 24 Voc 1 3 Overview Here is a brief overview of the components and its descriptions for module status 8 8 8 8 8 5 Digits 7 SEG LED display 3 Programmable LED Indicators 4 Push Bottons SMMI microsD Socket Init Init mode LRun Protect mode Run Normal mode DIP Switch LAN2 I O Slots LAN 1 and LAN 2 for iP 8441 and iP 8811 modules only Connector Redundant Power Lr Relay Output M Sow as45 COM2 RS 485 ime jm ime jm jmq D ime ime jm Frame Ground F G 1 4 Dimension There are several series of iPAC 8000 modules whose dimensions depended on the quantity of the slot 1 4 1 4 Slots Top View TUA gt Front View Side View 1 4 2 8 Slots Top View 5 295 8mm g J a d d gt Front View TN Side View A MIS i MM A ERUIT S i AMI 1 5 Companion 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 iPAC8000 Document Firmware OS Image PC_Tool USB_Driver c language guide chinese html c language guide eng html 2 Getting Started If you are a new user begin with this chapt
43. mpty MS dM F 4 1 15 IslomlutBufEmpty TE D 2 1 16 IsDetectBreak 2 1 17 printCam 3 2 1 10 RestoreCoam A 2 1 18 ReadCam A 2 1 20 ReadCamn A 2 1 21 SetComTimenut A 2 1 22 SetComPortBufferSize 3 2 1 23 SetCtsControlMode Ili gt Comments Attachments i j n 5 C The following table lists the demo programs grouped by functional category Basic Folder Demo Explanation Fil Config 1 Basic Reads information from a text file basic ile Config 2 Advanced Reads a contig file text file advanced Hello C Hello Reads the library version and flash memory size Hello C Resets the software Illustrates how to select an item and run it l Illustrates how to retrieve 64 bit hardware unique serial Misc Serial number Enables the WDT or bypasses the enable Watchdog WatchDog function Shows how to operate the systemkey function SystemKey simply and easily Smmi Led Shows how to control the red LED and 7 segment e display Battery Backup SH Shows how to read or write to the 256K 512K byte Memory M battery backup Shows how to read and write the date and time from the RTC 1 Shows how to write a function to input data DateTime DateTime 2 Shows how to receive a string C Style IO 3 Shows how to use a C function sscanf or just use Scanf Receives data from COM port Com port Receive Slv COM c is in non blocked mode Receive c is in blocked mode
44. ng and executing iPAC 8000 programs you must firstly establish a connection between PC and iPAC 8000 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 7 MiniOS Utility Verion 3 1 7 3 5 File gt Connection de Command Configuration Tools amp 5 Help Look in Hello we ER Disk a T Mo Mame Size Modified Mame Size Type B Hello 157KB Application U plua Upload 4 Execute E AM Update Mims Image E hea al PC side i module side bate 9 Step 2 On the module side right click the file name that you wish to execute and then select the Run 7 MiniOS7 Utility Verion 3 1 7 Look in Hello v PSU risk A a ga Size Type Ma Mame Size Modified 187EB Application m I 1 m S fea Fal eee Run Eun with parameters Reset Manis F4 be an m augus eau ts am 4 Pound e LJ 2 4 3 Making programs start automatically After upload programs on the iPAC 8000 if you need programs to start automatically after the iPAC 8000 start up it is easy to achieve it to create a batch file called autoexec bat and then upload it to the iPAC 8000 the program will start automatically in the next start up For example to make the program hello run on start up Step 1 Create an autoexec bat file i O
45. ocol SCADA software can easily access the I O module plugged in the iPAC 8000 gt Hardware Features 80186 CPU 16bit and 80MHz with 512KB Flash and 768KB SRAM The 512KB flash is for storing files and the 768KB SRAM is for running programs 64 bit Hardware Serial Number The 64 bit hardware serial number is unique and individual Every serial number of iPAC 8000 is different Users can add a checking mechanism to their AP to prevent software from pirating Dual Battery Backup SRAM 512KB To maintain important data while power off non volatile memory is the ideal design The iPAC 8000 equips a 512KB SRAM with two Li batteries to maintain data while power off The two Li batteries can continually supply power to the 512KB SRAM to retain the data for 5 years and the dual battery design can avoid data lost while replacing a new battery I O Module Hot Swap Ability Plug amp Play The iPAC 8000 features hot swap which means that there is no need to power off the iPAC 8000 for replacing modules And the OS provides a function sending plug in and removing messages to user s applications Using this feature users can design its own plug and play applications Rich I O Expansion Ability RS 232 485 Ethernet FRnet CAN HLS Sanias I SD Beside the local I O slots iPAC 8000 also equips several RS 232 485 ports two Ethernet ports to connect serial I O and Ethernet I O And with FRnet and
46. ols amp amp Help 7 E n Upload FR Look ir 9 Minis _Utilit DiskTool FE Lock in Disk A Refresh Fa 3 Mame dis B No Mame Size Cabin T INE 3o autoexec 15 2005 7 E FIRMWARE 2 Bi vce xax 84236 20D8 7 2 308 IMAGE EEPROM E F188eu F4 Pack Disk icpdas Exe Dh S load232 dli Best F S MiniDS 7 Utility chm e EPI MiniD5 7 Lltility exe 2 256K b MiniD57 Lltility ini El uart dll TT 10PD5 7205IP 1 1 0 45 Port 10000 via TCP 2 files i ComectionfE2 E Unload 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 IPAC 8000 program 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 iPAC 8000 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 e Borland C Versions 3 1 5 2 x e MSC e MSVC We recommend that you use Borland C compiler as the libraries have been c
47. on Utility Enter the SOURCE drive to use Enter the drive from which you wish the INSTALL utility to copy files Typically this is the drive that contains the INSTALL disk ENTER Se lect Step 4 Enter the path to the directory you wish to install files to Turbo C 2nd Edition Installation Utility e on the Turbo G files ENTER Select ESC Cancel Step 5 Select Start Installation to begin the install process c CADOCUME IMIserum inucppl 1NMNSTALL EXE Turbo G 2nd Edition Installation Utility Turbo G Directory G XTGC Binary Files Subdirectory C 2 TC BRIN Header Files Subdirectory G EXTO SINGLUDE Library Subdirectory C2 TC LIB BGI Subdirectory G XTOC BGI Tour Subdirectory G XSTO STOUR Glass Library Subdirectory G2 TC CLASSLIE Examples Subdirectory C 2 TC ERAMPLES Install Tour Yes Duo xn Yes IS MCLH J 9 Description Selecting tnis oupeion will begin copying Files to your hard drive into the directories specified above Fi Help F Start the installation EHTER 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 compiler You should now read the README file h
48. otection switch Expansion Flash Memory microSD socket can support 1 2 GB microSD microSD socket can support 1 2 GB microSD 64MB NAND FlashDisk fess E o 512 KB for 5 years data retention 16 KB data retention 40 years 1 000 000 erase write cycles 31 bytes battery backup data valid up to 5 years Provide second minute hour date day of week month year 64 bit Hardware Serial Number Watchdog Timers Yes 0 8 second NET ID 8 pin DIP switch to assign NET ID as 1 255 Communication Ports o RJ 45 x 2 10 100 RJ 45 x 2 10 100 Base TX Base TX Ethernet Auto negotiating auto Auto negotiating auto MDI MDI X LED MDI MDI X LED indicators indicators COMO Internal communication with the high profile I 87K series modules in slots COM1 RS 232 to update firmware RxD TxD and GND non isolated COM2 RS 485 D2 D2 self tuner ASIC inside ae RS 232 RS 485 RxD TxD CTS RTS and GND for RS 232 Data and 3 Data for RS 485 non isolated RS 232 RxD TxD CTS RTS DSR DTR CD RI and GND non isolated SMMI LED 3 Programmable Yes Indicators I O Expansion Slots DATAE to Bo For high profile I 8K and l 87K modules only Mechanical Operating Environment 10 90 RH non condensing Power Yes with one power relay 1 A 24 Vbo for alarm 0 85 A 5 V supply to CPU and 0 9 A 5 V supply to CPU and Capac
49. oyi Parity N one v Av Stop Bit 1 Step 6 The connection has already established 72 MiniOS7 Utility Verion 3 1 7 a n n n n a a a a n n n n n n n n n E RR E Fie L Connection he couman z SUMUS E Tools x Help oes eee n n n m n 2 2 E m RR a a a a a a a a a n n n n n n n n n n ER E wx dr Dou LULUCELECLELELEELECLELEELELELELECLLELELELEELLELELELELLECLELELEELCLEL EG EEELECLELEEELLELELEEGELEL ELE ERELELEERELELCLEERGELELELL ERG ELECLELILER Look in O Mini S 7 Utility Mame bin EH c Size Twpe Connection Status Disconnected L ennectien F 2 d Refresh F3 2 4 1 3 Ethernet Connection for iP 8441 and iP 8841 modules only Below are step by step instructions on how to connect to PC using an Ethernet connection Step 1 Turn the switch to Init position t m fesses A o TO i7 T7 gt T Step 3 Run the MiniOS7 Utility Step 4 Click the Search function from the Connection menu zog MimiOS Utility Verion 3 1 1 build 3 1 1 1 ay File gt Connection gt a Command Z Configuration J Tools i New connection F2 LOOK Ft Last Connection AR F2 97 Disconnect Ctrl F2 Name Size Type O bin m File Folder amp FIRMWARE File Folde 40S IMAGE File Fold Step 5 On the MiniOS7 Scan dialog box choose the module name from the list and then choose IP setting from the toolbar 19216982551 DISESHU Step
50. pen 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 D Untitled Notepad Seles File Edit Format View Help on The file name m Run the specitied file PD Untitled Notepad Sele File Edit Format View Help Runexe a Run the last exe file runexe Step 2 Upload programs to iPAC 8000 using MiniOS7 Utility For more detailed information about this process please refer to section 2 4 1 Establishing a connection 7 MiniOS7 Utility Verion 3 1 7 Ga File Connection de Command Configuration T Tools amp Help 7 Look in 0 Minig 7 Lltilitu w Lock in Disk A Name Size Type Name Size Modified bin File Folder hello exe 138 828 2008 6 5 9 FIRMWARE File Folder B autaexec 5 2005 8 9 5305 IMAGE File Falder icpdas 1KB 5 load 32 al SKB E Mini0S7_Utility chm 1 025KB cx UDP Connect to 10 1 0 224 23 path D EYS TEM One is the Hello TEMERE application file and the Autodownload Files Mone other IS the Current work directoruy D SYSTEM autoexec bat batch file Begin Key Thread Tips amp Warnings Before restaring the module for settings to take effect you must firstly turn the switch to Init position 2 5 Updating iPAC 8000 OS image ICP DAS will continue to add additional features to iPA
51. reated 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 gt Set the CPU option to 80188 80186 gt Set the floating point option to EMULATION if floating point computation is required Be sure not to choose 8087 gt Cancel the Debug Information function as this helps to reduce program size MiniOS7 supports this feature 3 1 1 Installing the C compiler lf 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 es CADOCUME IMUserVm inWtcppl lWINSTALL EXE Turbo C 2nd Edition Installation Utility Copyright c 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 nus SEU a examples and copy the Tour files Press ENTER to continue ESC to quit EHTER Gontinue E amp 5G Gancel Step 3 Enter the letter of the hard drive you wish to install the software Turbo G 2nd Edition Installati
52. s GetFilelnfoByNo information mfs DeleteAllFiles Delete all files stored in the NAND Flash Delete one selected file that has been written to the mfs DeleteFile NAND Flash mfs OpenFile 1 Opens a file with a file name Function Description fe Oreaesanewfle 0 Closes a file with a file handle mfs CloseFile All buffers associated with the stream are flushed before closing Repositions the file pointer of a file mfs Tell Returns the current file pointer Macro that tests if end of file has been reached on a mfs EOF file Enable the data verification mfs EnableWrite Verify Outs a string a file By default the data verification is enabling mfs DisableWrite Verify Disable the data verification 4 10 API for microSD Required library and header files SD V102 LIB and microSD h E I5 The iPAC 8000 series can support one microSD card and the size can be 1GB or 2 GB e Summarize of the microSD functions Function Description Initializes the microSD socket library 2 Creates a new file Writes the specified file e Seek Moves the file pointer to relative offset from the m current offset Sow Renames an existing file or a directory including the iim subdirectory Function Description Moves the pointer to the last element 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 API for starting microSD 1 pc Init
53. simplify the TCP IP software developing process a software development template X Server is provided It implements 9096 functionalities of Ethernet communication Software engineer can easily finish the 1096 remaining functionality and greatly shorten the developing time The iPAC 8000 is designed for applications to industrial monitoring measurement and controlling therefore we made it with redundant power inputs with 1KV isolation from noise and surges and a wide range of operating temperature 25 C 75 C It is tough enough to service in harsh and rough environments 1 1 Features gt Software Features MiniOS7 embedded operating system MiniOS7 was introduced in 1996 as an MS DOS like operating system for embedded controller developers The features of MiniOS7 include A Small kernel size 64KB B Fast boot speed 0 4 0 8 second C Hardware diagnostic functions D Simple command line operation over RS 232 or Ethernet E Load files via RS 232 or Ethernet VxComm Technique Supported VxComm technique is used to create virtual COM ports on PC for windows 2K XP to map remote COM ports of PDS 700 I 7188E l 8000 and iPAC 8000 over the Ethernet Using the technique RS 232 485 software can access devices locally via the physical RS 232 485 bus or remotely via the Ethernet The RS 232 485 software only needs to change COM port number from the physical COM port to virtual COM port Redundant Ethernet Communication
54. ssume extern and Uninitialized D ata far Step 6 Remove the xcr afxcr library from the Input Category Linker Options Build Options t Debug Specific Release Specific Common to Bath Options String LIB scr ILIB afscr LIB oldnames LIB slibee MOI PS TACK 8121 fONERROR NOEXE OLOGO Category Category Settings Input Memory Image Miscellaneous Output Remove the Xcr and afxcr I Distinguish Letter Case Step 7 Remove the OLOGO option from the miscellancous Category Linker Options Build Options Debug Specific Release Specific C Common to Both Options String Cancel LIB wer ILIB afscr LIB aldnames LIB slibee NOL 5 ACE 5120 fONERROR NOEXE OLOGO Help Use Project Defaults Category Category Settings Miscellaneous Input Memory Image Miscellaneous Output Remove the OLOGO Step 8 Rebuild the project iba Microsoft Yisual C HELLO HAE Debug Tool Optons Window Help File Edit View BUS Browse HELLO MAE Compile Fils Bvid HELLO EXE Rebuild AU HELLO EXE A t F8 iD E vild Execute HELLU Cth F5 ap 1 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 NOEX
55. tValue Before reading the Timer the TimerResetValue must be called to reset the main time ticks to 0 3 TimerReadValue After the TimerResetValue has 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 For example the following code can be used to read the main time ticks from 0 include lt stdio h gt include 8000a h void main void Unsigned long time iTime InitLib Initiate the 8000a library TimerOpen While lquit If Kbhit TimerResetValue Reset the main time ticks to O iTime TimerReadValue Read the main time ticks from O j TimerClose Stop using the iPAC 8000 timer function 4 8 API for WatchDog Timer WDT e The iPAC 8000 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 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
56. ted at CD Napdos MiniOS7 Document http ftp codas com pub cd 8000cd napdos minios 7 document ze Options x e E 5 1 Library Selection for AI l 7186 l 6 s 4 Adobe Reader MiniOS7_API pdf Fe 2 COM Ports Functions aaga Fi i iiw Documen o0 indow He e a EHD 2 1 Common Functions v arables e TFI Save a Copy a P Search n p Select amp amy aca 4 DES A 2 1 1 InstallCam E 1 Library Selection for All 7188 80 DA 2 1 2 bCtsChanged x HA 2 COM Ports Functions EH 2 1 Common Functions Variables FE 2 1 J CurcTIS x p A 2 1 1 InstallCom 5 2 1 2 bCtsChanged x Ip 2 1 4 CurRTa x s i 2 1 3 CurCTS 3 A 2 1 5 fCtsControlMode x g 2 1 4 CurRTS_x E DY 2 1 5 fCtsControlMode x 3 2 1 6 fRtsControlMode x Dy 2 1 6 fRtsControlMode_x 2 1 7 ClearCom ps 2 1 7 ClearCom DS 2 1 8 ClearTxBuffer D 2 1 9 DataSizelnCom Ip 2 1 a ClearTxBuffer 03 2 1 10 GetTxBufferFreeSize F 2183 DataSizelnCam A 2 1 11 GetCtsStatus 03 2 1 12 InstallCominputData Ire 2 1 10 Get l xButferFreesize DS 2 1 13 IsCom I 2 1 14 IsTxBufEmpty Ife 2 1 11 GetCtsstatus DS 2 1 15 IsComOutBufEmpty f Deo 6 ok B 2 1 12 InstallcamlnputDiata 3 A 2 1 17 printCom 3 213 leCam A 2 1 18 RestoreCom d 2 1 19 Readcom DS 2 1 14 ISTxBufEmpty t 2 1 20 ReadComn E BY 2 1 24 SetComTimeout F 4 1 15 IslomlutBufEmpty Q Mi A 2 1 22 SetComPortBufferSize E
57. the MiniOS7 API Functions User Manual located at CD Napdos MiniOS7 Document http ftp Icpdas com pub cd 8000cd napdos minios7 document ze Options x Fe 1 Library Selection for AI l 7186 l 6 ED 2 COM Ports Functions Eia 9 Adobe Reader MiniOS7 API pdf ys File Edit View Document Tools Window Help Al Save a Copy EK a B Search ep Select gj ze Options xX Bookmarks 2 X E Fe 2 1 Common Functions Vatiables sg A 2 1 1 InstallCom A 2 1 2 bCtsChanged x 3 2 1 3 CurCTS x A 2 1 4 CurRTS x A 2 1 5 fCtsControlMode x U By 1 Library Selection for All 7188 80 FS 2 COM Ports Functions E B 2 1 Common Functions Variables A 2 1 1 InstallCom DS 2 1 2 bCtsChanged x D3 2 1 3 CurCTS x D3 2 1 4 CurRTS x o X e o oe Qe _ D gt G D a G a A 2 1 5 fCtsControlMode x 3 a I fRtsContralldade x A 2 1 6 fRtsControlMode x DS 2 1 7 ClearCom F 2 1 7 Clearlom 3 2 1 8 ClearTxBuffer D 2 1 9 DataSizelnCom FE 2 1 0 ClearlxButter DS 2 1 10 GetTxBufferFreeSize i F 219 DataSizelnCom D 2 1 11 GetCtsStatus B 2 1 12 InstallComlnputData DS 2 1 13 IsCom 2 1 14 IsTxBufEmpty 2 1 10 GetTxBufferFreeSize S 2 1 11 GetCtsStatus Ee A 2 1 15 IsComOutBufEmpty E No de ened py 2 1 12 InstallCominputData E DS 2 1 17 printCom J 1 13 laetam x DS 2 1 18 RestoreCom Ip AEN DS 2 1 19 ReadCom p 5 2 1 14 IsTxBufE
58. 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 For example reading and receiving data through the COM1 include lt stdio h gt include 8000a h void main void int quit 0 data InitLib X Initiate the 8000a library InstallCom 1 115200 8 0 1 Install the COM 1 driver while quit if ISCom 1 Check if there is any data in the COM port input buffer data RHeadCom 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 j j RestoreCom 1 Uninstall the COM 1 driver 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 COM1 port include lt stdio h gt include 8000a h void main void int i Initiate the 8000a library InitLib InstallCom 1 115200 8 0 1 Install the COM 1 driver for 120 1 10 14 4 printCom 1 Test d n r i j Delay 10 Wait for all data are transmitted to COM port RestoreCom 1 4 1 3 API for standard COM port The standard COM port is used to upload program from PC to the iPAC 8000 Tips amp Warnings C style Stan
59. v typing README and pressing ENTER in your Turbo G directory Mext make sure the line FILES 20 GCoSIC BI is in your CONFLO Often TCH Executing your path efur example GC IC EBI PATH C9 BINSC TC BIN Executing Press any key to continue C TCBI Executing G XIGC SBIN UHZIP ESE TC ZIP C PIP Executing C TC BIMSTHELP COM FC TC BINSTCHELP TCH ZH Any Key Continue Step 7 Press any key to continue cv CADOCUME IN serum eppil INSTALL EXE Turbo C 2nd Edition Installation Utility Turbo G Directory G XTIG Binary Files Subdirector G XTC BIMN 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 Toamn HERES 1 And type TZruUuH Executing HERES Press any key to continue Executing au C TC BIMSTHELP COM FC TC BIN TCHELP TCH Executing C 2 TC BRIMSUMZIP ERE TC ZIP C TC BIN Executing G IC BIMSIHELP COM FC IC BINSTICGHELP TCH z4 Any Key Continue Step 8 Installation is complete 3 1 2 Setting 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

Download Pdf Manuals

image

Related Search

Related Contents

Atelier 1 b - ADN élémentaire watson  Mode d`emploi  Installation and Care Instructions  Digitaler Farb-Quadrantenteiler  QTFX-V1 - Billebro    Brochure  Kontakt 4 Sound Set User Manual  FIAlab-3000 Operations Manual  ノロライズ応急キット(フォーム)  

Copyright © All rights reserved.
Failed to retrieve file