Home
μPAC-7186E Series User Manual
Contents
1. e fONERROR NOESE OLOGO Help Use Project Defaults Category Category Settings Input hemory Image Miscellaneous Output Remove the Xcr and afxcr v Distinguish Letter Case UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 7 Remove the OLOGO option from the miscellancous Category Linker Options Build Options Debug Specific Release Specific C Common to Both Options String MLIB wer YLIB afer LIB aldnames LIB slibee NOL 5 ACE 5120 fONERROR NOEXE OLOGO Help Use Project Defaults Category Category Settings Miscellaneous Memory Image Miscellaneous Output Step 8 Rebuild the project Edit View igen Browse Debug Tool Options Window Help HELLO MAE Ctlt FS Qj 1 Output Initializing Compiling c N7188xa demo msc hello hello 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 obj Run File HELLO exe HELLO EXE List File c HELLO map nul Libraries lib c msvc 1libs Libraries lib c msvc nfc lib j j lib LIB 7188XAL LIB lib oldnames Libraries lib llibce Creating browser database HELLO EXE 0 error s 0 warning s 4l mirr uPAC 7186E Series User M
2. Step 1 Use Installcom to install the COM port driver Step 2 Use SendCmdTo7000 2 to send commands Step 3 Use ReceiveResponseFrom7000 msY to get the response Step 4 Use RestoreCom to restore the COM port driver UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example to send a command 01M to I 7K I O module for getting the module name include lt stdio h gt include 7186e h void main void unsigned char InBufO 60 InitLib Initiate the 7186e library InstallCom 1 115200 8 0 1 Install the COM 1 driver InstallCom 2 115200 8 0 1 Install the COMe driver SendCmdTo 000 2 01M 0 A Send a command to COM2 Timeout 50ms check sum disabled HeceiveResponseFrom7000 ms 2 InBuf0 50 0 printCom 1 Module Name s InBuf0 Delay 10 Wait for all data are transmitted to COM port RestoreCom 1 Uninstall the COM driver RestoreCom 2 Uninstall the COMe driver UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 1 EE Writ
3. P nu On the controller side right click the file name that you wish to execute and then select the Run 7 MiniOS Utility Verion 3 1 7 EF File gt Connection f Command Configuration Tools 53 Help E Look in o Hella he Lack in Disk A v ga Mame Size Type Ma Mame Size Modified Hello 187KE Application Fe hello exe 9 952 2008 6717 T Eun with parameters Reset Manis F4 Erase Disk d um f uem m P as rs E EP n m C837 U2 2 UDP run 6 Hello 8666 lt Flash memory is 512 K C837 U2 2 UDP UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 2 4 3 Making programs start automatically After download programs on the UPAC 7186E if you need programs to start automatically after the uPAC 7186E start up it is easy to achieve it to create a batch file called autoexec bat and then upload it on the UPAC 7186E the program will start automatically in the next start up For example to make the program hello run on start up MiniOS7 Utility Verion 3 1 7 Sele i35 File D Connection 4 Command Configuration 77 Tools amp Help Mame Size Modified x hello exe 138 928 2008 69 i I t 25 2005 8 9 One is the Hello e eee application file and the other is the autoexec bat batch file Lookim Sy Mini0S7 Lltiity v Mame Tips amp Warnings AN Before restaring the module for setting
4. done j else Print Open file errori mfs Stop return UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 the 64MB flash memory For example reading data from the 64MB flash memory include lt stdio h gt include 7186e h include MFS h define DISK A O0 define DISK B 1 int main void int iFileHandle iRet InitLib Initiate the 7186e library iRetemfs Init if iRet lt 0 return iFileHandle2mfs OpenFile DISK A Test txt r if iFileHandle gt 0 Print Read from Test txt An 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 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Print done j else Print Open file error mfs Stop return For more demo program about the Flash memory please refer to CD NAPDOS 7186e Demo Basic bc_tc 7186FD http ftp Icpdas com pub cd 8000cd napdos 7 186e demo basic bc tc 7186fd UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Appendix A Frame Ground Electronic circuits are constantly vulnerable to Electro Static Discharge ESD which become worse in a continental climate area UPAC
5. Relative Humidity 5 90 RH non condensing Power Protection Power reverse polarity protection Frame Ground for ESD Protection Yes Required Supply Voltage 10 30 Vpc non regulated Power consumption 1 5 W for uPAC 7186EX 2 5 W for uPAC 7186EXD UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 2 2 uPAC 7186PEX uPAC 7186PEXD CPU CPU 80186 or compatible 16 bit and 80 MHz SRAM 512 KB Flash 512 KB erase unit is one sector 64K bytes 100 000 erase write cycles EEPROM 16 KB data retention 40 years 1 000 000 erase write cycles NVRAM 31 Bytes Battery backup data valid up to 10 years RTC Real Time Clock RTC Provide seconds minutes hours date of week month month and year valid from 1980 to 2079 64 bit Hardware Serial Number Yes Built in Watchdog Timer Yes 0 8 second Communication Interface COM1 RS 232 TxD RxD CTS RTS and GND Non isolated COM2 RS 485 D2 D2 self tuner ASIC inside Non isolated Ethernet Port 10 100Base TX Ethernet Controller Auto negotiating Auto MDIX LED indicator COM Port Formats Data bit Parity Even Odd None Stop bit LED Display 5 Digit 7 Segment LED Display Yes for uPAC 7186PEXD only System PoE LED Indicator Yes Red Green UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Hardware Expansion I O Expansion Bus Yes User Defined I O Pins 14 Pins Dimensions WxHxD 72mm x 123 mm x
6. 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 02X n r item j j j j Delay 10 RestoreCom 1 j MH 022 01 UPAC 7186E Series User Manual Version 1 2 December 2009 4 1 5 Request Response protocol define on COM port Hequest 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 mmo UPAC 7186EX Request ee SBEeEee2ezB See Request Response Debug information Command1 c1 Commandt1 Debug information Command2 c2 Command2 Q Debug information Quick program Other command Debug information Unknown command For more demo program about the COM port please refer to CD NAPDOS 7186e Demo Basic COM_Ports http ftp Icodas com pub cd 8000cd napdos 7186e demo basic bc tc com ort uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 2 API for I O Modules The pPAC 7186E is equipped with a RS 485 communication interface COMO to access I 7K series I O modules for a wide range of RS 485 network application as shown below RS 485 X39814 Okdt 38d Steps to communicate with i 7K series I O modules
7. etc All of them are listed below DRINE Too 0R 186e DIETA Basic Framework Xserver Document Firmware VoComm OS Image PC_ Tool MiniOS7 Studio MiniOS7 Utility PC Test Program PCDiag Vxcomm_ Utility UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 uPAC 7186E 2 1 Hardware Installation 2 1 1 Mounting the Hardware The uPAC 7186E can be mounted with the bottom of the chassis on the DIN rail the wall or piggyback DIN Rail mounting The uPAC 7186E has simple rail clips for mounting reliably on a standard 35 mm DIN rail UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Mounting on DIN Rail Remounting from DIN Rail Din Rail Mountable Model Three Din rail mountable models are available to mount a variety of ICP DAS devices Each is made of stainless steel and has a ground wire at the end Part number Maximum number of modules Dimensions UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Piggyback Mounting The uPAC 7186E has two holes on both sides for piggyback mounting UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 2 1 2 Setting up the Power Supply and Networking to PC The uPAC 7186E is equipped with an RJ 45 Ethernet p
8. 35 mm Operating Environment Operating Temperature 25 C 4 75 C Storage Temperature 40 C 80 C Relative Humidity 5 90 RH non condensing Power IEEE 802 3af Class 1 Protection Power reverse polarity protection Required Supply Voltage Powered by Power Over Ethernet PoE or auxiliary power 12 48 Vpc non regulated Power consumption 1 5 W for uPAC 7186PEX 2 5 W for uPAC 7186PEXD UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 2 3 uPAC 7186EX SM uPAC 7186EXD SM CPU CPU 80186 or compatible 16 bit and 80 MHz SRAM 640 KB Flash 512 KB erase unit is one sector 64K bytes 100 000 erase write cycles EEPROM 16 KB data retention 40 years 1 000 000 erase write cycles NVRAM 31 Bytes Battery backup data valid up to 10 years RTC Real Time Clock RTC Provide seconds minutes hours date of week month month and year valid from 1980 to 2079 64 bit Hardware Serial Number Yes Built in Watchdog Timer Yes 0 8 second Communication Interface COM1 RS 232 TxD RxD CTS RTS and GND Non isolated COM2 RS 485 D2 D2 self tuner ASIC inside Non isolated Ethernet Port 10 100Base TX Ethernet Controller Auto negotiating Auto MDIX LED indicator COM Port Formats Data bit Parity Even Odd None Stop bit LED Display 5 Digit 7 Segment LED Display Yes for uPAC 7186EXD SM only System LED Indicator Yes UPAC 7186E Series User Manual Version 1 2 Decem
9. 7186E modules feature a new design for the frame ground which provides a path for bypassing ESD allowing enhanced static protection ESD capability and ensures that the module is more reliable The following options will provide a better protection for the module The pn PAC 7186E has a metallic board attached to the back of the plastic basket as shown in the figure below point 1 When mounted to the DIN rail connect the DIN rail to the earth ground because the DIN rail is in contact with the upper frame ground as shown in the figure below point 2 2 Frame Ground o Frame Ground UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Appendix B 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 N 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 210 ADI OR Power up time 4 5 sec More compact size lt 64 K bytes 64 K bytes Support for I O expansion bus Yes No Support for ASIC key Yes No Flash ROM management Yes No OS update Download Yes No Built in hardw
10. 7186e library WriteNVRAM 0 data data2 ReadNVRAM 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 7186e h void main void int data 0xAA55 data2 char dataptr char amp data InitLib Initiate the 7186e 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 dataptr 1 ReadNVRAM 1 Read the high byte j UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For more demo program about the NVRAM please refer to CD NAPDOS 7186e Demo Basic Memory http ftp Icpdas com pub cd 8000cd napdos 7186e demo basic bc tc memory UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 6 API for 5 Digital LED The wPAC 7186E 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 API for starting the 5 Digit 7 SEG LED 1 InitbDigitLed 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 After the InitsDigitLed is used to initialize the 5 Digit 7 SEG LED the Show5DigitLed must be called to
11. Display Yes for UPAC 7186EXD FD only System LED Indicator Yes Hardware Expansion I O Expansion Bus Yes User Defined I O Pins 14 Pins Dimensions WxHxD 72mm x 123 mm x 35 mm Operating Environment Operating Temperature 25 C 75 Storage Temperature 40 C 80 C Relative Humidity 5 90 RH non condensing Power I L LLLODOSJ Power consumption UPAC 7186EX FD 2W UPAC 7186EXD FD 3W UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 3 Overview The pPAC 7186E front panel contains the Ethernet port connectors and LEDs User defined pins UPAC 7186EX Green PoE LED indicator Red System LED indicator CPU 80186 80 E1 Ethernet 10 100 Base TX COM1 RS 232 COM2 RS 485 10 23 User Defined I O Pins 5 Digital 7 SEG LED for display series only a Programmable Automation Controller Ethernet Port COM1 RS 232 COM RS 485 Power Connector uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 The uPAC 7186E back panel contains the frame ground and Init Normal Switch Frame Ground Init Normal Switch UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 4 Dimensions Front View Left Side View Rear View uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 5 Companion CD This package comes with a CD that provides drivers software utility all of the required documentations
12. 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 int far MK FP 0xd000 0x1234 data data For more demo program about the flash memory please refer to CD NAPDOS 7186e Demo Basic Memory http ftp Icpdas com pub cd 8000cd napdos 7186e demo basic bc tc memory uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 5 API for NVRAM e The uPAC 7186E is equipped with 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 WriteNVRAMY 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 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example use the following code to write data to the NVRAM address O include lt stdio h gt include 7186e h void main void int data 0x55 data2 InitLib Initiate the
13. Jj File p Connection gt de Command Config IM New connection F2 Look ir i vo Pp Last Connection Alt F2 2j Disconnect Ctrl F2 H Name bn Search FIZ je 7 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 ET e ve Connection Serial Port TCP UDP Baud Rate 1 15400 IP 10 09 52 Data Bit Part Parity Mone Stop Bit Cancel UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 10 The connection has already established Sele Mini0S7 Utility Verion 3 1 7 1 File D Connection Command Configuration Fo Tools x Help Look in 7j Mini0S7_Ltility Lock in Disk amp vw e Mame Size Type No Cabin ls 3 FIRMWARE big Connection Status UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 2 4 1 3 Steps to use a TCP connection TCP IP connection only can be created when the module runs VxComm driver the steps to upload firmware and execute are illustrated in section 2 4 2 Uploading and executing programs on UPAC 7186E To connect to the PC using a TCP connection please follow the instructions below Step 1 Turn the switch to Init position Step 2 Use an Ethernet cable to connect to PC 5 208 3 3 Oo 5 UPAC 7186E Series User Manual Versi
14. MiniOS7 file system MFS offers an 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 MiniOS7 Family Products applications on MiniOS7 Hardware Supported UPAC 7186EX FD With 64MB Flash Memory NVRAM all of the 31 bytes Applications Log data with timestamp Log data and forward via the Ethernet n COM Port Functions Devices f UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 MFS Specifications Item Description Disksize 1 2 size of the flash memory size 0000 Flle number 456 fles max foreach disk 000000 Filesize Disk Size max tor eachfio 0000 Filename 12 bytes max ease sonatvey 00000000 1 Read only 2 Write only Creates a new file to write data or overwrite a file if the file is already exit File operation modes 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 File handle opened for 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 fil
15. TimerClose Before ending the program the TimerClose must be called to stop the Timer UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example the following code can be used to read the main time ticks from O include lt stdio h gt include 7186e h void main void Unsigned long time iTime InitLib Initiate the 7186e library TimerOpen While quit If Kbhit TimerResetValue Reset the main time ticks to O iTime TimerReadValue Read the main time ticks from 0 TimerClose 5 Stop using the 8000e timer function For more demo program about the timer please refer to CD NAPDOS 7186e Demo Basic Timer http fto Icodas com pub cd 8000cd napdos 7186e demo basic bc tc timer UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 8 API for WatchDog Timer WDT e The uPAC 7186E is equipped with 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 EnableWDTY The WDT is always enabled before user s programming to refresh it the EnableWDT
16. You can examine the demo source code which includes numerous comments to familiarize yourself with the MiniOS7 APIs and quickly develop your own applications quickly by modifying these demo programs Basic Folder Demo Explanation Reads information from a text file Config_1_ Basic basic Contig 2 Advanced Reads a config file text file Contig 2 Advanced 2 Advanced advanced Hello C Reads the library version and Hello C 000 Hello C 000 flash memory size Resets the software Illustrates how to select an item Runprog and run it Illustrates how to retrieve 64 bit Serial hardware unique serial number Enables the WDT or bypasses the Watchdog enable WatchDog function T EEPROM Shows how to write a value to the y EEPROM Shows how to write and erase the Memory Flash Flash bee Shows how to control the red LED displa LED pay Shows how to control the red Seg7led 7 segment display TN DateTime Shows how to read and write the date and time from the RTC 7K87K Module 7K87K_DI for Com Shows how to connect and UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Folder Explanation 7K87K_DO_for_ Com K87K Al for Com AO 22 26 for Com AO 024 for Com Demo control the 7K or 87K series modules via COM2 1 Shows how to write a function to input data 2 Shows how to receive a string a 3 Shows how to use a C function sscanf or just use oScanf
17. amp Warnings You have the alternative of MiniOS7 COM ports functions or C N 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 i Buffer Functions Kinds of COM Functions Port MiniOS7 1 2 ns 1KB 1KB IsCom ToCom ReadCom printCom COM port etc EH 512 256 Standard Note Bytes Bytes Kbhit Getch Print COM port d uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 7186E Series User Man
18. 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 received exit the program j j uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example showing data through COM1 include lt stdio h gt include 7186e h void main void int i Initiate the 7186e library InitLib for i 0 i lt 10 i Print Test d n r i j j UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 1 4 Comparison between MiniOS7 and Standard COM port function For example learning to show the ASCII code MiniOS7 COM port functions include lt stdio h gt include 7186e 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 Standard COM port functions include lt stdio h gt include 7186e h void main void unsigned char item InitLib Print Hits any key n Print Hits the ESC to exit n for for if IsCom 1 if kbhit item ReadCom 1 item Getch if item q if item q return return j j else else printCom 1 n r Print n r UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 printCom 1 char Print
19. fto ftp icodas com pub cd 8000cd napdos minios utility minios7 utility UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 2 3 Configuring the Boot Mode The uPAC 7186E has two operating modes that can be determined by the switch mechanism on the chassis Init Mode Init mode is a way to use MiniOS7 configuration mode Init Normal Normal Mode Normal mode Firmware running mode Init Normal Normal mode is the default mode of operation and the one you will use most of the time Use this mode for more tasks and configurations Programs also are executed in this mode Move the switch to the Normal position after the update is complete UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 2 4 Using MiniOS7 Utility to download programs Before you begin using the MiniOS7 Utility to download programs ensure that the controller is connected to the Host PC The download process has the following main steps 1 Establishing a connection 2 Download and executing programs on the controller 3 Making programs start automatically All of these main steps will be described in detail later 2 4 1 Establishing a connection between the PC and the pPAC 7186E There are three ways to establish a connection between the PC and the UPAC 7186E 1 COM1 connection 2 UDP connection 3 TCP connection em a ou C ES x Each of the connection types will be described in d
20. the Project menu ii Type the project name Hello ii Select OK iv Select Add v Select Done to exit cx Command Prompt tc pu Open project Close project Fi Help Enter directory path and file name mask UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 te Th f Run Compi Options ius m dobhstinhhhianiainits s i Open project Close project AS Delete item Local options Include files UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 Advanced code generation Entry Exit Code C options Optimizations c Command Prompt tc Assume amp amp 5 ii DS efines Use large memory model amp 1Mb for code iMb for static data UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 10 Set the memory model to large i Select Compiler from the Optio
21. 022 01 4 1 3 API for standard COM port The standard COM port is used to download program from PC to the uPAC 7186E Tips amp Warnings A The following configurations of the standard COM 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 UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 Putch For sending one character Before sending data to standard l 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 7186e h void main void int quit 0 data InitLib Initiate the 7186e library while quit if Kohit Check if
22. 08 Appendix B What is MiniOS7 109 Appendix C What is MiniOS7 Utility 110 Appendix D What is MiniOS7 File System MFS 111 Appendix F More C Compiler Settings 114 iM 18330 114 F 2 BO 4 3 1 IDE nnne nnn nnne nnn 117 Fo MSG OOO 121 FAN IO 123 Appendix G Application of RS 485 Network 127 3 1 Basie5495 MCIW Ol ee E E E DR MP OI 020 DaUe 127 G 2 Daisy chain RS 485 network ccccccseececeeeeeceeeeeseeeesseeeesseeeesaeeeesaaees 128 UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 G 3 Star type RS 485 network seesssssssessseeeeeeee nennen 129 G 4 Random RS 485 network cccccccccssseecceeseeeceeeeeceeeeeceeeeeesseeeeessegeeeseas 131 G 5 UPAC 7186E Master Slave Mode ccccccccsseceeeeeeeeeceeeeeesaeeeeeseeeeeeeens 132 2 5 05 UPAG 7 COE as al MAS ICM a 133 2 52 UPAO FICO as Asa ey e 135 UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 Introduction The wPAC 7186E is a palm size programmable automation controller that with Ethernet RS 232 RS 485 communication ICP DAS provides easy to use software development tool kits Xserver
23. 10 Pull High Disable JP11 Pull Low Disable LAC OM Jw a0 C oW UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01
24. 661 Microsoft Corp C Documents and Settings fidministrator TG Step 3 Select New from the File menu to create a new source file y Project O tions E n x BSS File Edit Search kus Compile Debug Project Options Window Help Step 4 Type the following code Note that the code is case sensitive include 7186e h Include the header file that allows 8000e lib functions to be used void main void InitLib Initiate the 7186e library Print Hello world r n Print the message on the screen UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 5 Save the source file i Select Save from the File menu ii Type the file name Hello iii Select OK cw CEWWINDOWSYSystem3 Zcmd exe tc Edit Search Run Compile Debug Project Options E HELLO CFF New Open Save as Save all gt c Command Prompt tc File Edit Search Run ompile Debug Project Options Window Help void 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 UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 66 Step 6 Create a project prj i Select Open project from
25. 7186E For more detailed information about this process please refer to section 2 3 1 Establishing a connection T MiniOS7 Utility Verion 3 1 7 File fp Connection 4 Command Z Configuration T Tools amp Help Look im C Hello M Lock in Disk A v a Name See Type No Name Size Modihed Hello 187KB Application zwi HW 1 31 COM1 115200 N 8 1 FC 0 CTS 1 DIR C Dg d Begin Key Thread Current set Use COMI AutoRun Nn utodounload files None Current work directory C Documents and Se ngs Wser Hello Hello_C C837 U2 2 UDP run 6 Hello 8606 Flash memory is 512 K gt 837 U2 2 UDP m anmguradon tools amp Help Look in 2 MiniQS7_Utility v car DE 3 aE Mame Size Type Ma Name Size Modified bin File Folder lo hello exe 138 928 2008 6 9 E FIRMWARE File Folder autaexec 25 2005 879 O 05_MAGE File Folde 2 Icpdas KB Internal 55 Inad232 dl SEKE cA ap dini T7 Lene l 4 norvn S au ji 4 TEC 708k 1 31 Comt 115200 ne is the Hello SA yap Begin Key Thread JCurrent set Use a file and AutoRun Hutodownload Files Hone the other S the autoexec bat batch EE file Leo ee DP en I Hello BABA Plash memory is 512 W aCe _U2 2_UDE UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 API and Demo Reference There are several demo programs that have been designed for uPAC 7186E
26. A 2 1 5 fCtsControlMode x A 2 1 4 CurRTS x B 2 1 6 fRtsControlMode x DS 2 1 7 ClearCom IFE 2 1 7 ClearCom Woo UM DS 2 1 8 ClearTxBuffer Dy 2 1 10 GetTxBufferFreeSize F 2198 DataEizelnCam A 2 1 11 GetCtsStatus 2 1 10 GetTxBufferFreeSize D 2 1 13 IsCom DS 2 1 14 IsTxBufEmpty No de ened A 2 1 12 lInstallComlnputData S 2 1 13 IsCorm A 2 1 15 IsComOutBufEmpty 2 1 18 IsDetectBreak 3 2 1 10 RestoreCoam S 2 1 18 ReadCam S 2 1 21 SetCamTimeaut 5 2 1 22 SetComPartBufferSize lii 3 3 2 1 5 fCtsControlMode x 3 216 fRtsCaontralldade x DP 2 1 9 DataSizelnCom D 2 1 12 InstallCominputData A 2 1 11 GetCtsStatus A 2 1 15 IsComOutBufEmpty A 2 1 14 IsTxBufEmpty DA 2 1 17 printCam S 2 1 20 ReadCamn 3 2 1 23 SetCtsControlMode UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 3 3 Build and run your first program If you don t use the TC Turbo C to write a program please take the following steps 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 2 Type cmd document or ill open iE Far vau Windows XP Professional UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 2 At the command prompt type TC and then press Enter 5 E Elx Microsoft Windows XP Uersion 5 1 2600 M Copyright 1985 2
27. BED esnssususcxa se uucih tante tbVupeetNE Ve tet Rx UU sUeaas 12 1 2 2 uPAC 7186PEX uPAC 7186PEXD sseseeeeeeeeeeeee 14 1 2 3 uPAC 7186EX SM uPAC 7186EXD SM seseeeeeeeeeeeeeeeee 16 1 24 pPAC 7196EX FD BPAC 7195EXD FD cccasaazascusiazascuxt as eeeuxsa astocuxus 18 Inc wei H 20 I MB RSEN T UT 22 UE S oneiion1opm 23 2 STUNG lal i i NORTE TE E 24 2 1 marewere InstaladoD xis ces s c o ebie tiat bet bia louis Appia autista nd iss eins 24 2 1 1 Mounting the Hardware cccccscccsseeceeeeeeeeseeeseeeeneeeseeeeeueeneeeseeesaes 24 2 1 2 Setting up the Power Supply and Networking 27 2 2 DON Ware INStANAUIO eeaeee R E R E 28 2 3 Configuring the Boot Mode seeesseeessseeeneeeennennnn nennen 30 2 4 Using MiniOS7 Utility to download programs esses 31 2 4 1 Establishing a connection between the PC and the uPAC 7186E 31 2 4 2 Uploading and executing programs on n PAC 7186E 45 2 4 3 Making programs start automatically ssseeesssssss 46 2 5 Using MiniOS7 Utility to update OS image eese 47 3 Your First Program on pPAC 7186E 50 3 1 Setting up the compiler eeeessessseeeeeneennn nnne 50 SERE P oiscdlaf
28. M ports m Host PC n EA COM2 RS 485 gt 7000 series a S COM1 as 3 Meter n mm COM254 Expansion E XL i Board oe Host PC 1 COM COM2 RS 7000 series COM4 COM1 RS23 FS V Dri A Meter 1 seis acs p Expansion Board yuPAC 7186EX IP 1 9 Expansion board of the uPAC 7186 IP 1 are mapped to C OMS of Host PC 1 V COM1 and COM of the pPAC 7186 IP 1 are mapped to COM4 and COM5 of Host PC gt Support Modbus Protocol Using the Modbus firmware UPAC 7186E offers following Modbus features Modbus TCP RTU ASCII slave Modbus TCP RTU ASCII master Gateway for Modbus TCP to Modbus RTU UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Easy to use software development tool kits using C language If the default firmware does not totally fulfill the user s application needs custom firmware can be easily developed with using the SDK Xserver Modbus library provided by ICP DAS Ethernet protocols TCP UDP IP ICMP ARP gt Support web configuration UPAC 7186E has a built in web server for configuration You can use standard web browsers such as IE Netscape Firefox etc to configure its Ethernet and COM ports configurations gt Remote configuration maintenance UPAC 7186E can be operated via the Ethernet TCP IP or UDP or RS 232 to allow tasks such as downloading programs configuration updating the MiniOS7 etc gt Built in watchdog time
29. PDAT YE 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 New Project x Project ame QB J Project Tupe windows application EXE lt I Use Microsoft An EU e cA 1BBSxedemosnschhello o c 7188X gt DEMO Msc feti OW E gt HELLO List Files of Type Mee Cy Project mak zl c UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 3 Add the user s program and the necessary library files to the project File Mame r 1 86 al lib z 58zal lib 189xa5 lib List Files of Type Library lib Directories cou BSBxasdemosmsc ib foo c fo 71884 gt DEMO gt MSC fm lib CG Board Drives id c A AF BBsasdemo msc hello hello c cz T agxasdemasmscslibs T88xal lib Project Options Project Type MS DOS application EE Use Microsoft Foundation Classes Build Mode t Debug Customize Build Options Compiler Linker ABSOUIGES Build Options Options String Category Code Generation Custom Options Custom Options C Debug Options Listing Files Memor Model Optimizations P Code Generation Precompiled Headers Preprocessor Segment Names UPAC 7186E Series User Manual Version 1 2 Dec
30. README file hv typing README and pressing ENTER in your Turbo G directory Mext make sure the line FILES 2H C o IC BI is in your ERU IE LL CBH i Executing your path Tur exanple im G XTCBI PRATH 2GAXBINH G TC BIN Executing x Pres s any key to continue G XTCBI b Executing G SIC BINSUNZIP LERE TC ZIPA CH erat Executing C TC BIMSTHELP COM FC TC BINSTCHELP TCH W Any Key Continue UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 53 Step 7 Press any key to continue cv CADOCUME IN serum eppil INSTALL EXE Turbo C 2nd Edition Installation Utility Turbo G Directory G iXIG 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 C LCa GEXTOBI And type ru Executing HERES Press any key to continue Executing a ae C TC BIMSTHELP COM pk TC BINSTCHELP TOH Executing C X IC BINH UMZIP ESE TC ZIP C TC BIN Executing GC IC BIMSIHELP COM FC IC BINSTICGHELP TCH zU Any Key Cont inue Step 8 Installation is complete UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 54 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 co
31. Receives data from COM port Comper Baccus Slv COM c is in non blocked mode Receive c is in blocked mode A slave COM Port demo for Siv COM request reply Or command response applications Illustrates how to Read Write byte Utility for the MiniOS7 File Utiliy oystem Operations Include Dir Head Write etc Quality assurance program for the 7186FD for 64MB MFS QA MiniOS7 File System Including flash memory on B function test read write uUPAC 7186EX FD performance test Gets How to get a string from a file in the 64MB flash memory For more information about these demo programs please refer to CD NAPDOS 7186e Demo Basic bc_tc http fto Icpdas com pub cd 8000cd napdos 7 186e demo basic bc tc UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 1 API for COM Port The pyPAC 7186E provides two built in COM ports COM1 and COM2 e COM1 An RS 232 port that can use to connect to PC e COM An RS 485 port that can use in a point to point connection PAC UPAC 7186EX O CPU 80186 80 E1 Ethernet 10 100 Base TX COM1 RS 232 COM2 RS 485 10 23 User Defined I O Pins EFFETS Programmable Automation Controller B GND 9 UPAC 7186E Series User Manual Version 1 2 December 2009 MH 022 01 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
32. UPAC 7186E Series User Manual Service and usage information for Eae e uPAC 7186EX uPAC 7186PEX uPAC 7186EX FD pPAC 7186EX SM 9e 82828 uPAC 7186EXD UPAC 7186PEXD WPAC 7186EXD FD WPAC 7186EXD SM M Written by Liam Lin Edited by Anna Huang 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 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Table of Contents TARO GUC WOW m 6 XN Ne OCU c P 8 UN E cele a 12 12 1 DPAC 7 196BE DPAC S7 196
33. VxComm Modbus libraries Users can use them to easily integrate serial devices to have Ethernet Internet communication ability and through the standard Modbus protocol to communicate with SCADA software Indusoft ISaGARF DasyLab Trace Mode Citect iF ix etc For the hardware it also supports an I O expansion bus The I O expansion bus can be used to implement various I O functions such as D I D O A D D A Timer Counter UART flash memory battery backup SRAM ASIC key amp other I O functions Nearly all kinds of I O functions can be implemented by this bus but the bus can support only one board There are more than 50 boards available for uPAC 7186E you can choose one of them to expand hardware features Tips amp Warnings N In the descriptions in this manual UuPAC 7186E means UPAC 7186E and uPAC 7186PEX series product The only difference between the two series product is that the uPAC 7186PEX can receive power from an Ethernet cable when added to a PoE enabled network the uPAC 7186E can receive power from power input terminal only UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 The features of uPAC 7186PEX differ from uPAC 7186E Compared to uPAC 7186E uPAC 7186PEX equips with an integrated IEEE 802 3af Power over Ethernet PoE that allows power and data to be carried over a single Ethernet cable so a device can operate solely from the power it receives through the data cabl
34. anual Version 1 2 December 2009 7MH 022 01 126 Appendix G Application of RS 485 Network The RS 485 length can be up to 4000 ft or 1 2 km over a single set of twisted pair cables if the RS 485 network is over 4000 ft or 1 2Km the RS 485 repeater must be added to extend the RS 485 network G 1 Basic RS 485 network The basic component of the RS 485 network consist of a Master Controller or using a PC as a host controller and some RS 485 devices Esjesertouevuert E 232 485 Converter 7520 Series UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 G 2 Daisy chain RS 485 network There are branches along the main network In this case it is better to have a repeater to isolate or filter the noise that is made by devices There is a better choice to use 7513 as a RS 485 hub on start type network 232 485 Converter 485 Repeater 485 Repeater 7520 Series 7510 Series 7510 Series UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 G 3 Star type RS 485 network All RS 485 devices are wired directly to the main network If the network is up to 1 2 Km it will need a repeater 7510 series to extend the network length Ee 232 485 Converter 7520 Series 485 Repeater 485 Repeater 7510 Series 7510 Series 485 Repeater 7510 Series UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 There is a better choice t
35. are diagnostic functions Yes No Direct control of 7000 series modules Yes No Customer ODM functions Yes No Free of charge Yes UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Appendix C What is MiniOS7 Utility LIT m ag Fe p Cunta de Command Dou 7 Twb dii HEY 190 Lebe ives m i mer MiniOS7 Utility is a tool for configuring uploading files to all products embedded with we mimm wm Tue T dm net mean ma 78 a ICP DAS MiniOS7 jm vor mores LIES E oince version 3 1 1 the Utility can allow users p maureen remotely access the controllers 7188E sse 8000E etc through the Ethernet Functions Including frequently used tools 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 SendT CP Maintenance e Send232 1 Upload file s 2 Delete file s 3 Update MiniOS7 image f VxComm Utility Configuration 1 Date and Time 2 P address 3 COM port 4 Disk size Disk A Disk B Check product information 1 CPU type 2 Flash Size 3 SRAM Size 4 COM port number etc Download location http ftp Icodas com pub cd 8000cd napdos minios7 utilitv minios7 utility UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Appendix D What is MiniOS7 File System MFS
36. ber 2009 7MH 022 01 Hardware Expansion I O Expansion Bus Yes User Defined I O Pins 14 Pins Dimensions WxHxD 72mm x 123 mm x 35 mm Operating Environment Power Protection Power reverse polarity protection Frame Ground for ESD Protection Yes Required Supply Voltage 10 30 Vpc non regulated Power consumption UPAC 7186EX SM 2W UPAC 7186EXD SM 3W UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 2 4 uPAC 7186EX FD uPAC 7186EXD FD CPU CPU 80186 or compatible 16 bit and 80 MHz SRAM 512 KB Flash 512 KB erase unit is one sector 64K bytes 100 000 erase write cycles Flash Disk 64M x 8 Bit data retention 10 years 100 000 erase write cycles EEPROM 16 KB data retention 40 years 1 000 000 erase write cycles NVRAM 31 Bytes Battery backup data valid up to 10 years RTC Real Time Clock RTC Provide seconds minutes hours date of week month month and year valid from 1980 to 2079 64 bit Hardware Serial Number Yes Built in Watchdog Timer Yes 0 8 second Communication Interface COM1 RS 232 TxD RxD CTS RTS and GND Non isolated COM2 RS 485 D2 D2 self tuner ASIC inside Non isolated Ethernet Port 10 100Base TX Ethernet Controller Auto negotiating Auto MDIX LED indicator COM Port Formats Data bit Parity Even Odd None Stop bit UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 LED Display 5 Digit 7 Segment LED
37. d drive you wish to install the software Enter the SOURCE drive to use A Enter the drive from which you wish the INSTALL utility to copy files Typically this is the drive that contains the IMSTALL disk EHTER Select ESC Cancel Description Enter the path to the directory containing the Turbo G files 3 Y FN k a MIA BI tat M EI ILE ji Pd ei TT AJ I l X LM CICS V OVI VI aliudai VvvcloliU 4 9 f 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 Class Library Suhbdirectorvu G2 TC CLASSLIE Examples Subdirectory C 2 TC ERAMPLES Une Say Tour Yes Yes IS MCLH J e Description Selecting tis Option 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 ce CADOCUME MI serusinucppl lWINSTALL EXE Turbo C 2nd Edition Installation Utility Turbo C 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
38. display information on the 5 Digits 7 SEG LED UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example use the following code to display 8000E on the 5 Digit 7 SEG LED include lt stdio h gt include 7186e h void main void InitLib Initiate the 7186e library InitsDigitLed Show5DigitLed 1 8 Show5DigitLed 2 0 Show5DigitLed 3 0 Show5DigitLed 4 0 Show5DigitLed 5 14 The ASCII code for the letter E is 14 For more demo program about the 5 digit 7 SEG LEDs please refer to CD NAPDOS 7186e Demo Basic LED http fto lcodas com pub cd 8000cd napdos 7186e demo basic bc_tc led UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 7 API for Timer e The yPAC 7186E can support a single main time tick 8 stop watch timers and 8 counts down timers e he uPAC 7186E 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 reset the main time ticks to 0 the TimerReadValue must be called to read the main time tick API for stopping the Timer 4
39. e Modbus TCP client Modbus RTU slave Modbus RTU client Modbus ASCII slave Modbus ASCII client Modbus TCP to Modbus RTU gateway N O C A C N The Modbus library and demos can be obtained from CD Napdos Modbus 7186EX Demo UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 NapdosMliniOS 7 Document http ftp Icpdas com pub cd 8a000cd napdos minios 7 document ge Options X un 2 A 1 Library Selection for All Z188 80 E i F Adobe Reader MiniOS7_API pdf E EHA 2 COM Parts Functions BSG T Ble Edit Yiew Document Tools Mindow Help E 5X lg Beco i ser I 9 T ee S 2 1 Common Functions v ariables cupis JES p A 2 1 1 InstallCom e Options xX A 2 1 2 bCtsChanged x 3 2 1 3 CurCTS x By 1 Library Selection for All 7188 80 EHA 2 COM Ports Functions EHS 2 1 Common Functions Variables 2 1 1 InstallCom A 2 1 2 bCtsChanged x DS 2 1 17 printCom DS 2 1 18 RestoreCom DS 2 1 19 ReadCom A 2 1 20 ReadComn D3 2 1 21 SetComTimeout A 2 1 22 SetComPortBufferSize A 2 1 23 SetCtsControlMode t Attachments Comments LL ie t Attachments Comments t I E A 2 1 4 CurRTS x Ds 2 1 3 curcts x
40. e This innovation allows greater flexibility in office design higher efficiency in systems design and faster turnaround time in set up and implementation The features of uPAC 7186EX FD differ from uPAC 7186E Compared to UPAC 7186E uPAC 718EX FD equips with an extra 64MB flash memory By using the built in MFS MiniOS7 File System library you can freely read write files from to the 64MB flash memory oimply with the uPAC 786EX FD many kinds of data logging applications become a piece of cake For example log analog signals with timeline or log RS 232 485 data for further analysis Package List YO REE 7 en f sm eee Ld m ra v One uPAC 7186E module E i Quick Start Guide Pi RS 232 Cable Software Utility CD UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 1 Features gt Support for Virtual COM technology Using the VxComm technology PC can create virtual COM ports to map the RS 232 RS 485 of the uPAC 7186E The software running on the PC can operate the virtual COM ports like a standard COM port to access the serial devices connect to the uPAC 7186E That is to say the original software developed for the serial devices can access the serial devices via the Ethernet Internet without any modification Each PC can control up to 256 COM ports including real COM ports Using the I O expansion board each UPAC 7186E can have up to 8 CO
41. eEnable 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 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 UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example to write data to block1 address 10 of the EEPROM include lt stdio h gt include 7186e h void main void int data 0x55 data2 InitLib Initiate the 7186e library EE WriteEnable EE MultiWrite 1 10 1 amp data EE WriteProtect EE MultiRead 1 10 1 amp data2 Now data2 data 0x55 j For more demo program about the EEPROM please refer to CD NAPDOS 7186e Demo Basic Memory htto fto codas com pub cd 8000cd napdos 7186e demo basic bc_ tc memory UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 4 API for Flash Memory e he uPAC 7186E module contains 512 Kbytes of Flash memory e MiniOS7 uses the last 64K bytes the other parts of the memory are us
42. ed analysis when the data is complete collected Provides C language API Following functions are similar to the functions that turbo C and Borland C provide This helps users to be familiar to MFS with a short learning curve mfs OpenFile mfs CloseFile mfs ReadFile mfs WriteFile mfs Gets mfs Puts mfs Getc mfs Putc mfs EOF mfs Seek mfs Tell mfs DeleteFile mfs DeleteAllFiles mfs GetFilelnfoByName mfs GetFilelnfoByNo etc UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Writing Verification Data written to flash memory are read back to verify its correction The function can be disabled to increase writing speed But for data safety we recommend users to enable the function Automate file system recovery in the event of unexpected reset or power losses When an unexpected reset or power loss occurs closed files and files opened for reading are never at risk Only writing data has risk to be lost MFS writes data to the flash memory just after executing writing functions such as mfs WriteFile mfs Puts mfs Putc etc And meanwhile MFS stores important information such as file name pointer flash location etc to NVRAM non volatile random access memory When an unexpected reset or power loss occurs only data written since the last writing operation such as mfs WriteFile mfs Puts mfs Putc etc could be lost After the MFS reboots it refers the information stored in the NVRAM
43. ed to store user programs or data e Each bit of the Flash memory only e can be written from 1 to 0 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 0x 8000 Free 0 x 9000 Free Free 448 K bytes 0 x A000 MiniOS7 64 K bytes Free Ox B000 Total Size 512 K bytes Free 0x C000 Free Ox DOOD Free Ox E000 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 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example to write an integer to segment OxDOOO offset 0x1234 of the Flash memory include lt stdio h gt include 7186e h void main void int data 0xAA55 data2 char dataptr int dataptr2 InitLib Initiate the 7186e library dataptr char amp data FlashWrite 0xd000 0x1 234 dataptr FlashWrite 0xd000 0x1 235 dataptr Read data from the
44. elO Timer and WatchDog Timer UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 gt System Structure UxsrtS MiniOS7 Program Basic Solution ei Framework mY ne Solution Llorary vcomm3225 Lib FW 09313 Lib hoya VXCOMM h MFW h TCPDM32 Lib TCPIP32 h 7186E Lib 7186E h PETITES Lal 5 Digit fe module icto MH 022 01 UPAC 7186E Series User Manual Version 1 2 December 2009 Basic Demos developed from main Xserver Demos developed based on Xserver library Xserver is a library for TCP IP server applications With an addional modbus library users can develop programs with 1 Modbus TCP slave Modbus TCP client Modbus RTU slave Modbus RTU client Modbus ASCIl slave Modbus ASCIl client Modbus TCP to Modbus RTU gateway N O OF nA C N The Modbus library and demos can be obtained from CD Napdos Modbus 7186EX Demo UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 MiniOS7 Framework Solution Demos developed based on MiniOS7 framwork MiniOS7 framework is a library for general TCP IP applications It is second generation library of Xserver and is much flexible and powerful than the Xserver Base on it users can quickly and easily develop programs with 1 TCP Client 2 TCP Server 3 Web Server 4 UDP Client 5 UDP Server With an additional Modbus library users can develop programs with 1 Modbus TCP slav
45. eliereeol q TT Em 51 3 1 2 Setting up the environment variables seeessessse 55 o2 AN fal HOr UPAG TOO EN eee 58 3 3 Build and run your first program ccceeceseecceeeceeeeceeeceeeeeeeeseeeseueeseeeseeeeaes 63 UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 API and Demo Reference e eere eren nnne nnn 74 BAe Ol GON POM t 76 4 1 1 Types of COM port functions eeeeeeeeereeeennnnnn 77 4 1 2 API for MiniOS7 COM oft cc ecccceccccceeceeseeeeeeeeeesseeeeseeeeesseeesaees 78 21 9 TIOrstandard GON DOM srcccarccaceoaccoseceaccoceceaeceaqeencsesaceacaeaeseacceceaes 81 4 1 4 Comparison between MiniOS7 and Standard COM port function 84 4 1 5 Request Response protocol define on COM port 86 A Noi NICIMIISNT eU 87 AS APO od lo ee ee ee ee ae eee 89 4 4 API for Flash T TT 91 4 5 API for NVRAM and RTC s sisiresssssorererosissioseniresorenoreterekake viseri ue SEDE SEEN DEUS 93 AC APRO S D Ota EED oae e deeseeadaacactsecacecsadaesetadaaaastaceocaan 96 A I e EE RETE 98 4 8 API for WatchDog Timer WDT cccceccceccceeeceeeeeeeeeeeeeesaeeseeeseeeaeeeaues 100 4 9 API for MFS For uPAC 7186EX FD series Only 102 Appendix A Frame Ground cce eeee eere ee 1
46. ember 2009 Help CiC E Compiler Options x Cancel Debug Specific Release Specific Common ta Both DK nologo 3s 31 AWS AL Us D NDEBUIG D DOS FR Category Settings Code Generation 80186 80188 Calling Lonventior C C Floating Point Calls Use Emulator Struct Member Byte Alignment 2 Bytes Cancel Help Use Project Defaults Check Pointers Iv Disable Stack Checking Code Generator Auto Select MH 022 01 Step 5 Change the Memory model large for 8000e lib CiC Compiler Options x Build Options C Debug Specific Release Specific Common to Both Options String Cancel fnologo Gs G7 AWS AL Oe ID UNBEBUBG 0 DOS FR Help Use Project Defaults Category Category Settings Memory bodel Code Generation Custom Options ament Setup Custom Options C f Debug Options Listing Files Memory Model Optimizations New Segment Data Size Threshold Po F Lade 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 Bath Options String lI lI lI lI lI lI lI E lI Cancel ALIB wer LIB afscr ALIB oldnames LIB sibce NUI AISTACE BST20
47. epeater 7510 Series Slave Mode UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 When uPAC 7186E as a master the pull high pull low resistor located on the power board must adjust to enable as shown below JP10 Pull High Enable JP11 Pull Low Enable LAC OC COM 90 ee T UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 G 5 2 uPAC 7186E as a slave For most of application when using one 7520 series as RS 232 485 converter its pull high pull low resistors are set to enabled Then the UPAC 7186E and all the other devices on this network must be slave mode the pull high pull low resistors must be disabled lf there are repeaters on the RS 485 network there will be pull high pull low resistors on both sides of the repeaters l 7510 f i er A TT i 232 485 Converter 7520 Series Slave Mode UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 If there are repeaters on the RS 485 network there will be pull high pull low resistors on both sides of the repeaters i 7510 n 1 2 Km 1 2 Km 232 485 Converter 485 Repeater 485 Repeater 7520 Series 5 7510 Series Em 7510 Series Slave Mode uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 When pPAC 7186E as a slave the pull high pull low resistor located on the power board must adjust to disabled as shown below JP
48. ersion 1 2 December 2009 7MH 022 01 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 to 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 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example writing data to the 64MB flash memory include lt stdio h gt include 7186e h include MFS h define DISK A O0 define DISK B 1 int main void int IFileHandle iRet InitLib Initiate the 7186e library iRetemfs Init if iRet lt 0 return iFileHandle2mfs OpenFile DISK A Test txt w if iFileHandle gt 0 Print Write string to Test txt mfs Puts iFileHandle test mfs on 64MB flash mfs CloseFile iFileHandle Print
49. es opened for reading are never at risk Only data written 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 mfs Puts 142 1 KB Sec verification enabled default 229 5 KB Sec verification disabled ER EAI ER mfs_ReadFile 734 7 KB Sec odo mfs Gets 414 2 KB Sec Automate file system recovery Writing speed uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Max length of writin 2 2 32767 bytes data Max length of readin 3276 bytes data Resources download MFS SDKs http ftp Icodas com pub cd 8000cd napdos 7 186e demo basic bc tc lib MFS Demos http ftp Icodas com pub cd 8000cd napdos 7186e demo basic bc tc 7186fd UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Appendix F 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 F 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 lib 8000e lib 2 Using the TC Integra
50. etail later uPAC 7186E Series User Manual Version 1 2 December 2009 MH 022 01 2 4 1 1 Steps to use a COM1 connection To connect to the PC using a COM1 connection please follow the instructions below Step 1 Turn the switch to Init position Step 2 Use RS 232 Cable CA 0910 to connect to PC d gt n O N C a ES 3 m Se UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 3 Run the MiniOS7 Utility Step 4 Click the New connection function from the Connection menu Minus Ut o M ZO MiniOS7 Utility Verion 3 1 7 Ver 3 10 3 33 File b Connection gt di Command Config z P Look i New connection 8 j Ww a Last Connection Alt F2 i Disconnect Chrl F2 d Mame bin Search FI2 je 07 Te ae LL dan j agen pr ATN Step 5 On the Connection tab of the Connection dialog box select COM1 from the drop down list and then click JE ma Connection Data Bit Parity UlNone bul SepBi 0 v UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 6 The connection has already established A MiniOS7 Utility Verion 3 1 7 BEES 13 File p Connection f Command Configuration T Tools E Help sa Look in 7j Mini S 7_Utility Name Size Type ETT odilied Cabin C9 FIRMWAR gt Donnection FZ Hefresh F3 UPAC 7186E Series User Man
51. icmd exe be HONAMEDG CPP Step 7 Choosing the Debugger and set the Source Debugging to None File Edit Search Run Compile Debug Projec ct Window Help CG DOCUME 1 ADMI NI 1 NONAMEBS Application Compiler Transfer Inspectors o rogram Heap Size Fi Help ELSE X bytes UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 8 Make the project cx CA WINDO WS sy stem32 emd exe be NE File Edit Search Run EXE file HELLOI ERE Linking BC31 LIB CL LIB Total Link Lines compiled 1257 PASS 2 Warnings H H Errors H UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 F 3 MSC 6 00 Step 1 In the source file folder create a batch file called Gomsc bat using the text editor P Untitled Notepad Fie Eat Formt vow Hep us cl ve Gs FPa Fm G1 aL HELLO c link H NOE NOI HELLO lib 7188xhbl 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 UPAC 7186E Series User Manual Version 1 2 December 2009 MH 022 01 Step 2 Run the Gomsc bat file o 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 Cop
52. ine i Gol to DP NONAME D NONAME C T Link EXE file Build all Primary C file cy CAWINDOWS System32wmd exe d Vte20 tie File Edit Run Compile Project Options De bug Break watch Edit Line 1 Gnl 1 Insert Indent Tab Fill Unindent D NOHANE C EXE file LED EXE Linking STCZ2BH LIB CL LIB Total Link Lines compiled 1335 PASS 2 Warnings H H Errors H H Available memory 235K SUCCESS Press an Message Fi Help F5 Zoom F6 Switch FY Trace F amp Step F9 Make Fili Menu HUM UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 F 2 BC 3 1 IDE Step 1 Executing the Borland C 3 1 Step 2 Creating a new project file prj co Command Prompt be File Edit Search El Compile M0 empile p EE Step 3 Add all the necessary files to the project ce Command Prompt be Options E HELLO uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 4 Change the Memory model Large for 8000e lib File EHE Search im Compile Debu Fi Help Assume 33 yon DS fin M Step 5 Set the Advanced code generation options and Set the Floating Point to Emulation and the Instruction Set to cs Mibi ur s exe hc Fi Help Far Data hreshold 32767 uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 6 Set the Entry Exit Code Generation option and setting the DOS standard cs CAWINDOWS SE ystem32
53. ion 3 1 7 3 Jj File p Connection gt de Command Config IM New connection F2 Look ir i vo Pp Last Connection Alt F2 2j Disconnect Ctrl F2 H Search Step 10 On the Connection tab of the Connection dialog box select TCP from the drop down list type the IP address which you are assigned and then click OK ET TA Connection Connection History TCF Seral Fort Baud Rate 11520 Data Bit Parity ON one Stop Bit UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 11 The connection has already established Sele Mini0S7 Utility Verion 3 1 7 1 File D Connection Command Configuration Fo Tools x Help Look in 7j Mini0S7_Ltility Lock in Disk amp vw e Mame Size Type No Cabin ls 3 FIRMWARE big Connection Status UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 2 4 2 Uploading and executing programs on pPAC 7186E Step 1 On the PC side right click the file name that you wish to download and then select the Upload 7 MiniOS Utility Verion 3 1 7 EF File Connection de Command Configuration Tools 5 Help Look in 9 Hello b Lack in Disk hl a Mame Size Type Mo Mame Size Modified me Hello 157KB Application Ima Upload amp Execute E AM Update Maus Image DOS i F11 2 p a a 1 a y r pad l A ms ES ur p i
54. mpiler 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 Pr Right click My My Computer Com pute r and then select Properties Search Manage Map Network Dip Ses ei AE EE Disconnect ST System Restore Automatic Updates Hemote General Computer Hame Hardware Advanced System Microsoft Windows mF Professional Properties Version 2002 Registered ta pthuang icp 852 4 640 0000356 23006 Computer AMD Eb tm 3D processor 451 MHz 132 MB of RAM Apply uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 EE Remote Advanced System Restore Automatic Updates Tou must be logged on as an Administrator to make most of these changes Il General Computer M ame Hardware Performance Visual effects processor scheduling memory usage and virtual memory Settings User Protiles Desktop settings related to your logon Settings nvironment Variable
55. 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 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 For example to refresh the Watchdog Timer include lt stdio h gt include 7186e h void main void Unsigned long time iTime InitLib Initiate the 7186e library Enable WDT While quit RefreshWDT User function j DisableWDT j For more demo program about the WatchDog Timer please refer to CD NAPDOS 7186e Demo Basic Misc htto fto codas com pub cd 8000cd napdos 7186e demo basic bc_ tc misc UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 4 9 API for MFS For uPAC 7186EX FD series only The pPAC 7186EX FD series products equips 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 D What is MiniOS7 File System MFS e Summarize of the MFS functions Function Description miei iniiaize the fle system OO mfe Stop Alocatedbufersarefreeduponcosng l Gets the total number of files stored in the NAND mfs Ge
56. ns menu and then select Advanced code generation ii On Floating Point option select Emulation ii On Instruction Set option select 80186 iv Select OK Entry Exit Code Lu C options Sec Optimizations Far Data hreshold ERP Fi Help Detect and use coprocessor otherwise emulate the 8087780287 uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 70 Step 11 Set the memory model to large 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 E mmand Prompt tc RS D TCG INCGLUDE ibrary Directories uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 71 Step 12 Select Build all from the Compile menu to build the cx Command Prompt tc File Edit Search Run Debug Project Options Window Hel Alt F9 F Information Remove messages cy Command Prompr File Edit Search Run Compile Debug Project Options Window Help Library HELLO LIB Adding HELLO OBJ Total File Lines compiled 1573 A Warnings H BH Errors H B Available A e Fi Help hf 1t F8 Next Msg ALt FY Prev Msg ALt F Compile F Make Fill Menu UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 72 Step 13 Use the MiniOS7 Utility to connect the WPAC
57. o Fil FIRMWARE Fil 1305 IMAGE p pT mia m Pus a a a Nun Tua re oe Of ms ul m ms My Network Save as hyper OS Image UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 7 MiniOS7 Utility Ferion 3 2 1 FB DiskTool F 3 Refresh un Size Modified Info F i Cabin Mem o autoexec ig 2005 7 1 3 FIRMWARE 2 1 vce 323 94236 2008 7 2 305 IMAGE EEPROM El P188eu F4 Pack Disk Icpdas Erase Disk load232 dli Reset n EE MiniDI 7 Lltility chim orar E Mini0S7_Utility exe CE MiniD 5 7 Lltility ini 5 uart dl UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 3 Your First Program on yPAC 7186E Before writing your first program ensure that you have the necessary C C compiler and the corresponding functions library on your system 3 1 Setting up the compiler The following compilers are available for uPAC 7186E gt Turbo C Version 1 01 gt Turbo C Version 2 01 gt Borland C Versions 3 1 5 2 x MSC gt MSVC Tips amp Warnings as the libraries provided on the companion CD have been created using this compiler ICP DAS suggests that the Borland C version compiler is used opecial attention sh
58. o use 7513 as a RS 485 hub on start type network 232 485 Converter 7520 Series 39 485 Hub 7513 Series UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 G 4 Random RS 485 network There are branches along the main wire In this case it is better to have a repeater to isolate or filter the noise that is made by devices Exi 232 485 Converter 485 Repeater 7520 Series 7510 Series 485 Repeater 7510 Series UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 G 5 UPAC 7186E Master Slave Mode The RS 485 network based on master slave architecture consists of a single master device and one or more slave devices The pPAC 7186EX provides a RS 485 communication interface based on the master slave system architecture all of which have a pull high pull low resistor this can be configurable through the JP10 and JP11 on the power board as below shown JP10 and JP11 are the Jumpers settings of the pull high pull low resistor LAC C COS 0 JC C wo JE UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 3 5 1 WPAC 7186E as a Master Default When one of uPAC 7186E is set to master then all the other devices on the same network must be slave mode If the network is up to 1 2 KM it will need a repeater 7510 series to extend the network length Master Mode 485 Repeater 7510 Series 485 R
59. on 1 2 December 2009 7MH 022 01 Step 3 Run the VxComm driver The VxComm driver is located at CD NAPDOS 7186e Firmware VxComm Server 7186e 7186E X vch 3231 exe ftp ftp icodas com pub cd 8000cd napdos 7186e firmware vxc omm server 7186e 7186ex Step 4 Run the MiniOS7 Utility Step 5 Click the Search function from the Connection menu P MiniOS Utility Verion 3 1 8 goo File Connection de Command Ey New oani EZ LastConnection ATH EZ Luzcoannect L tri EZ F L l binas Utility Vey 3 18 Look in fe autoexec al E100 400EXE PA Mini 57 utility zip CIPL2303 ICPDAS iPe000 Al s Step 6 On the MiniOS7 Scan dialog box choose the module name from the list and then choose IP setting from the toolbar T MiniOS7 Scan E 6 E TFA search Options Connect Clear IP setting Help dme i P Port Nam PI UDF Pal 192 168 2551 Ms uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 7 On the IP Setting dialog configure the IP settings and then click the Set button DHL Disable O Enable P setting success J Do vou want to leave IP setting dialog UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 9 Click the New connection function from the Connection menu 2A MiniOS7 Utility Ver
60. ort for connection to an Ethernet hub switch and PC Host PC Ethernet Cable f f P ps Fs Me 2 4 2 r Hub Switch N 10 30 Voc Sy Power Supply Host PC y Ethernet Cable k PoE Switch 12 48 Vac x D f d Power Supply uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 2 2 Software Installation All software resources are included on the companion CD The following steps will help you to install the resources and software from the companion CD Step 1 Copy the Demo folder from the companion CD to PC The folder is an essential resource for users developing custom programs which contains libraries header files demo programs and more information as shown below 7186e Demo E ZONES COM Ports Timer Framework FW Demo01_ Client FW Demo02 Server le Aserver XDemo04_ Basic XDemo07_printCom1 XDemo14_ 7Seg LED Demo_History_YYYYMMDD txt UPAC 7186E Series User Manual Version 1 2 December 2009 MH 022 01 Step 2 Install the MiniOS7 Utility The MiniOS7 Utility is a useful tool that provides a quick and easy way to update OS image or firmware configure Ethernet settings and download files to UPAC 7186E from PC minos utility v318 exe Minds Utility Ver 3 18 Setup The MiniOS7 Utility can be obtained from companion CD or our FIP site CD Napdos minios utility minios7_utility
61. ould be paid to the following items before using the compiler to develop custom applications gt 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 UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 3 1 1 Installing the compiler If there is no compiler currently installed on your system installation of the compiler should be the first step The following section guides 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 IMIservum inWtcppl lWVNSTALL 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 nd t TPEU examples and copy the Tour files Press ENTER to continue ESC to quit EHTER Gontinue ESC Cancel UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 3 Enter the letter of the har
62. r WDT UPAC 7186E include an internal watchdog timer WDT The watchdog timer will trigger a system reset if the main program fails or neglects to regularly service the watchdog The intention is to bring the system back from the hung state into normal operation gt I O expansion bus interface The uPAC 7186E supports the use of an I O expansion bus to add a single I O Expansion Board ICP DAS provides all function libraries for I O Expansion Boards to enable easy use of the I O Expansion Board functions UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 gt Support PoE for pPAC 7186PEX series only The uPAC 7186PEX feature true IEEE 802 3af compliant classification Class 1 Power over Ethernet PoE using both Ethernet pairs Category 5 Ethernet cable uPAC 7186PEX can receive power from an auxiliary power sources like AC adapters and battery in addition to the PoE enabled network This is a desirable feature when the total system power requirements exceed the PSE s load capacity Furthermore with the auxiliary power option the UPAC 7186PEX can be used in a standard Ethernet non PoE system gt MiniOS7 file system MFS for uUPAC 7186EX FD series only Can dynamically read write append data to files continuously The 64MB flash memory is divided to 2 disks each disk can store 456 files max You can create files and then write append data to it Then read data in the file and forward to PC for post
63. s AE Startup and Recovery System startup system Failure an In User variables For Administrator variable Value TEMP C Documents and Settings 4dministrat TMP C Documents and Settings 4dministrat Environment Variables ies System variables Variable Value AWINDCOWSIsvysEem3zWcmd exe Windows MT CUWINDCONWSITsvsbem32 C WINDOWS PATHEXT COM EXE BAT CMO VBS BE J5 UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 3 2 API for uPAC 7186E To develop a custom program ensure that the files below are installed the PC If they are not installed refer to section 2 2 Software Installation gt Functions Library 7186e lib This file contains the MiniOS7 API Application Programming Interface and has hundreds of pre defined functions related to uPAC 7186E Header File 7186e h This file contains the forward declarations of subroutines variables and other identifiers used for the MiniOS7 API standard a IO j MiniOS7 API Progra Functions mmabl
64. s to take effect you must first turn the switch to Normal position uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 2 5 Using MiniOS7 Utility to update OS image ICP DAS will continue to add additional features to MiniOS7 in the future we advise you periodically check the ICP DAS web site for the latest update to MiniOS7 Step 1 Get the latest version of the MiniOS7 OS image The latest version of the MiniOS7 OS image can be obtained from CDANAPDOS V 7186eYOS Image http ftp Icpdas com pub cd 8000cd napdos 7186e os image gt For 7186EX 7186PEX and 7186EX SM series 7186EX UDP HR YYYYMMDD img JER 2 ER 3 Module Name Protocol Type Module Type Release Date gt For 7186EX FD series 7186EX_FD_UDP_YYYYMMDD img JER 2 EER 3 Module Name Module Type Protocol Type Release Date uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 MiniOS7 Utility Verion 3 1 7 ales File D Connection 4 Command j Configuration Tools amp J Help gt UU NIU HU HU UR UAR Ute ette e TAANA AAAA AAAA T y f Lack in Disk A f Update Mini 57 Image Ctrl D Hat List e Size Tf Mao Mame Sid j pr
65. tFileNo Flash Gets the size of available space that can be used to mfs GetFreeSize i 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 Mdb information Uses the file number index to retrieve file mfs GetFilelnfoByNo information mfs_DeleteAllFiles Delete all files stored in the NAND Flash mfs DeleteFile Delete one selected file that has been written to the NAND Flash 1 Opens a file with a file name mfs OpenFile P 2 Creates a new file mfs CloseFile Closes a file with a file handle UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Function Description All buffers associated with the stream are flushed before closing fs WrteFle Appends specified bytes of data to afle m sGec Gets a character from afle mis Putc Outputs a character data to the fle m sGes Getsastingftomafie mfs_Puts Outs a string a file mts E0 Macro that tests if end of file has been reached on a file mfs Sek Repositions the file pointer of a file mfs Tell Returns the current file pointer mfs EnableWriteVerif Enable the data verification E J By default the data verification is enabling mfs_DisableWriteVerify Disable the data verification UPAC 7186E Series User Manual V
66. ted Environment Step 1 Executing the TC 2 01 Step 2 Editing the Project file Adding the necessary library and file to the project cy CAWINDOWS Gystem32Ww md exe d ie20 ite Hun Gompile Pro jock ptions Debug Break watch SSS SSS SS 1t Cob 19 Insert Indent Tab Fill Unindent D HONANE C Message Fi Help F5 Zoom F 6 5uitch F Trace F8 Step F9 Make FiB Menu lll UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 3 Save the project and entering a name such as LED prj WIN BIEN Ee n x REL Edit Run Compile Project Options Debug Break watch kol 19 Insert Indent lab Fira 2 indent D NONAME C gt di O5 shell Quit Alt k Step 4 Load the Project cx CAWINDOWS Sy File Edit Run Line i pra F Remove Juice Step 5 Change the Memory model Large for 8000e 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 80186780286 Floating point Emulation Default char type Signed Alignment Generate underbars Merge duplicate triny standard atach Line agin i OBJ debug information imm Manual Version 1 2 December 2009 7MH 022 01 Step 6 Building the project cx C AWINDO WS S ystem32wmd exe d AcZ e File Edit Hun 9 Tn Project Options Debug Break watch L
67. to restores the file system The un closed writing file will be automatically closed and all its data written before the last writing operation will be safe UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 1 2 Specifications 1 2 1 pPAC 7186EX uPAC 7186EXD CPU CPU 80186 or compatible 16 bit and 80 MHz SRAM 512 KB Flash 512 KB erase unit is one sector 64K bytes 100 000 erase write cycles EEPROM 16 KB data retention 40 years 1 000 000 erase write cycles NVRAM 31 Bytes Battery backup data valid up to 10 years RTC Real Time Clock RTC Provide seconds minutes hours date of week month month and year valid from 1980 to 2079 64 bit Hardware Serial Number Yes Built in Watchdog Timer Yes 0 8 second Communication Interface COM1 RS 232 TxD RxD CTS RTS and GND Non isolated COM2 RS 485 D2 D2 self tuner ASIC inside Non isolated Ethernet Port 10 100Base TX Ethernet Controller Auto negotiating Auto MDIX LED indicator COM Port Formats Data bit Parity Even Odd None Stop bit LED Display 5 Digit 7 Segment LED Display Yes for UPAC 7186EXD only System LED Indicator Yes uPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Hardware Expansion I O Expansion Bus Yes User Defined I O Pins 14 Pins Dimensions WxHxD 2 mm x 123 mm x 35 mm Operating Environment Operating Temperature 25 C 4 75 C Storage Temperature 40 C 80 C
68. ual Version 1 2 December 2009 7MH 022 01 2 4 1 2 Steps to use a UDP connection To connect to the PC using a UDP connection please follow the instructions below Step 1 Turn the switch to Init position Step 2 Use an Ethernet cable to connect to PC 5 gt O N D a a 3 In Se UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 3 Run the MiniOS7 Utility Step 4 Click the Search function from the Connection menu bl oni ns 7 Uu M MiniOS7 Utility Ferion 3 1 8 Ver 5 18 35 File D Connection de Command ULLLLLLLLLLLLLLLLLLLLLLLE New connection F2 Last Connection Alt Fe Disconnect Ctrl F Look in search E100 400 ExE E Mini0S 7 utilitv zip EURLSUSICPDAS PEON AIL P Vas Step 5 On the MiniOS7 Scan dialog box choose the module name from the list and then choose IP setting from the toolbar T MiniOS7 Scan M X Help IP setting UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 6 On the IP Setting dialog configure the IP settings and then click the Set button DHL Disable O Enable P setting success J Do vou want to leave IP setting dialog UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 Step 8 Click the New connection function from the Connection menu 2A MiniOS7 Utility Verion 3 1 7 3
69. ual Version 1 2 December 2009 7MH 022 01 For example reading and receiving data through the COM1 include lt stdio h gt include 7186e h void main void int quit 0 data InitLib Initiate the 7186e 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 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 j j RestoreCom 1 Uninstall the COM driver UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 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 7186e h void main void int i Initiate the 7186e library InitLib InstallCom 1 115200 8 0 1 Install the COM 1 driver for i 0 i lt 10 i printCom 1 Test d n r i j Delay 10 5 Wait for all data are transmitted to COM port RestoreCom 1 For more demo program about the COM port please refer to CD NAPDOS 7186e Demo Basic COM_Ports http fto Icpdas com pub cd 8000cd napdos 7186e demo basic bc tc com port UPAC 7186E Series User Manual Version 1 2 December 2009 7MH
70. yright 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 1 o gt m Step 3 A new executable file will be created if it is successfully compiled ey 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 71 Lee 3 File s 7 496 bytes 2 Dir s 22 041 571 328 bytes free C 7188xXA Demo MSC Hel lo gt _ UPAC 7186E Series User Manual Version 1 2 December 2009 7MH 022 01 F 4 MSVC 1 50 Step 1 Run MSVC exe 2 Microsoft Visual C DEMO4 MAK E ie Edit Mae Fro Hect E Briw lt 2 gt DATIBBEMTICPESERYERDEMOMSYC1 SDEMODAISER C Hinclude lt string h gt include New Project include LJ woid Use Project Mame Browse OF I i s 000000 Bene x Fi ER a BE Sy lt 1 o EOD SAR m fedS MAK X Aminios Tdemolmeciled5 NE 3 m 1 Hoya fe ds FS 8000F E E gt MINIOS 2o ond DEMO fits CM xp zi H List Files of Type REC vol Project mak l E d IC
Download Pdf Manuals
Related Search
Related Contents
Manual do Utilizador - Plantec Distribuidora LS252 取扱説明書 SRS 1 - 光ファイバー auひかり Scosche CBHV5 car kit Series 90-70 Programmable Controller Data Sheet Manual, GFK Copyright © All rights reserved.
Failed to retrieve file