Home
I-7188XB Series User`s Manual
Contents
1. 99 Appendix E Compiling and linking 136 SijsreBdar ueueres de T T Tm 136 Usno Ne BOGE GOMDIIC p 139 Using MoC COMPIE MT M 145 USMO MOVO Er GOMPIGE TODO 147 Appendix F GloSSal VaxscedasdemettvexuB m ivi A 152 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 3 1 Introduction The l 7188XB D is a series of expandable embedded controllers designed for industry applications and can be used to replace PC or PLC devices in harsh environments The I 7188XB D also has support for an I O expansion bus which can be used to implement various I O functions such as D I D O A D D A UART Flash memory battery backup SRAM AsicKey and other I O functions Most types of I O function can be implemented using this bus ICP DAS offers more than 20 types of I O Expansion Board for the I 7188XB D which can be used to expand the features of the controller Depending on the type of embedded firmware programs that are being developed and which I O Expansion Board the I 7188XB D can be used as a single versatile controller Package List In addition to this manual the shipping package includes the following items e One 7188XB D module e One download cable CA0910 e One companion CD containing software drivers and digital versions of the user manuals e One copy of the release notes CA0910 Note f any of thes
2. The Flash memory used in I 7188XB D series modules has a capacity of 512K bytes The MiniOS7 will use the last 64K bytes and the remaining space can be used to store custom programs or data Application developers can use these functions to write data to the Flash memory When writing data to the Flash memory data only be written from 1 to 0 and cannot be written from O to 1 So before writing data to the Flash memory must be erased first The erase process will cause all data to revert to OxFF that is all data bits will be 1 Only then can data be written The FlashErase function is used to erase one sector 64K bytes each time e FlashReadid Function Retrieves the information about Flash oyntax int FlashReadld void Header Zinclude 7188xb h Description Reads the Flash memory device code high byte and manufacturer code low byte Return Value OXA4C2 MXIC 291040 OxA401 AMD 29f040 Example See CD Napdos 7188XABC 7188XB Demo BC_TC Memory e FlashErase Function Erases a single sector of the Flash memory oyntax int FlashErase unsigned seg l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 115 Header include 7188xb h Description Erases a single sector 64K bytes of the Flash memory The value of all data on that sector will revert to OxFF seg 0x8000 0x9000 0xA000 0xB000 0xCO000 OxDOO0 or OxEOOO0 Return Value On success returns NoErr
3. 2 O o C Open collector 100mA 30V DC Max Output Channels Output Type SS gt lt O Q O x D e oad Voltage ED Displa LED as Power Communication Indicator digit 7 segment LED for I 7188XBD only 23mm x 72mm x 33mm Ooz O1 r O D r ITI e O 3 D mp IIVO D x SY gt o e D j le D um a e x D 25 C to 75 C 40 C to 80 C 0 to 90 torage Temperature umidity 10 to 30V DC non regulated 2 0W for I 7188XB 3 0W for I 7188XBD ower requirements U U O D Q gt o c j c O l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 6 1 3 Software and Document information The location of all documents and software related to the I 7188XB D on the companion CD are shown in the following directory tree The relevant file can quickly be located by referring to the tree Demo MSC 7188XB DemoList htm Document 7188XB pdf lO Expansion bus document html MiniOS7 document html Program Develop document html 7188xb cr 20060614 img Readme html Demo L Readme html iobus e pdf X702X703 pdf minios7 utility V311 exe 7188xw exe The documents and software listed above can also be obtained from the ICP DAS website http ftp icpdas com pub cd 8000cd napdos The folder location of all documents and software on the website is identical to th
4. 86 Appendix B MiniOS7 Utility and 7188XW Both the MiniOS7 Utility and 7188xw exe application will allow users to easily upgrade to the latest version of MiniOS7 The MiniOS7 Utility and 188xw exe application can be used to perform essential configuration functions and for downloading programs to the MiniOS7 embedded in the I 7188XB D controller MiniOS7 Utility The MiniOS7 Utility program provides three main functions e Upgrade the MiniOS7 image e Download program files to the Flash Memory e Configure the COM port settings MiniOS7 utility location The MiniOS7 utility is located in the CDANAPDOSMINIOS ZNUTILITYMMiniOS7 utility folder on the CD or at http ftp icodas com pub cd 8000cd napdos minios 7 utility minios 7 utility on the web Installation procedure Step 1 Locate and execute minios7 utility v2000 exe from the CD NapdosMiniOS7utility MiniOS7 utility folder step 2 After completing the installation a new folder 7188E will be added to the programs section of the start menu Clicking on this folder will allow access to the MiniOS7 Utility files See the diagram below for details l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 87 Internet Explorer Set Program 4ccess and Defaults Microsoft FrontPage Windows Catalog MISH Messenger 6 0 Outlook Express Windows Update Remote Assistance Windows Media Player Minis utility CT t5 Ei Programs L 39 MinioS
5. TimerOpen Begin using the 7188XB timer function while quit d if Kbhit TimerResetValue Reset the main time ticks to 0 iTimezTimerReadValue Read main time ticks TimerClose Stop using the 7188XB timer function Hefer to the demo programs in the CD Napdos 7188XABC 7188XB Demo BC_TC Timer folder for more information l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 67 4 11 Using Digital Input and Digital output The I 7188XB D provides one DI channel and one DO channel The SetDo1High and SetDo1Low functions can be used to control the DO channel and the GetDi1 function can be used to read the states of the DI channel For DI and DO wiring information please refer to Section 1 4 6 DI and DO Wire Connection The wiring for a DO application is as follows 2 2 2 2 2 2 2 2 2 2 2 2 2 2 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 68 The sample code for retrieving and setting DI and DO is as follows int Dot InitLib Initiate the 7188xb library Print Dl s n r GetDit1 High Low Read the state of DI Do1 GetDo1 Read the state of DO Print DO s n r Do1 High Low if Do1 SetDotHigh Set the DO1 to ON else SetDo1Low Set the DO1 to OFF Refer to the demo programs in the CD Napdos 7188XABC 7188XB Demo BC_TC lO_Pin folder for more information l 7
6. 7188XB 7188XBD ovs 13 __d2 _ 12 o2 t COM1 COM2 7000 Module Bt GND cas B Note The RS 485 interface can directly drive up to 256 l 7000 series modules without the need for a repeater l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 17 1 4 6 DI DO wire connection Digital Input Wire Connection ON State OFF State 2 Dix 72 DIx Ede E ra A ew Level Low Logic Level High Logic GND x o GND Logic CND amp YQ GND ON State OFF State input Type DO value as 1 DO value as 0 Drive Relay Resistance Load l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 18 1 4 7 Mounting the I O Expansion Bus Before mounting After mounting l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 19 2 Quick Start 2 1 Software Installation Step 1 Insert the companion CD into the CD drive step 2 Copy the 7188XB folder from CD Napdos 7188XABC to the Hard Drive of the Host PC Step 3 Install the MiniOS7 Utility Locate and execute the minios7 utility v311 exe file from CDANAPDOSMINIOS 7ZNUTILITYMIiniOS7 utility folder or http ttp icodas com pub cd 8000cd napdos minios 7 utility minios 7 _ utility Step 4 Copy the 7188xw exe file from the CD Napdos MiniOS 7 utility folder to the PATH directory for example C Windows After all the software is copied to the Host PC the content of 7188XB folder should be as follows 7188XB
7. Di s o Jeli TEI 1 7188XB 7188XBD Do i X MC Wiring connection RI j e DSR e GND s DTR 4 TxD s RXD j 2 COM Port of the PC DCD 1 Note There are 3 wires in the download cable e Connect wire 1 labelled RX to pin 9 of the I 7188XB D e Connect wire 2 labelled TX to pin 8 of the I 7188XB D e Connect wire 3 labelled GND to pin 7 of the I 7188XB D e Connect the DB 9 of the download cable to the COM Port of PC l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 14 Using a 3 wire RS 232 Port 7188XB 7188XBD JJ g X RXD RS 232 Device DCD Note There are 3 wires as follows e Connect the RXD to the TXD of the RS 232 device e Connect the TXD to the RXD of the RS 232 device e Connect the GND to the GND of the RS 232 device l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 15 Using a 5 wire RS 232 Port 7188XB 7188XBD RXD TXD 38 o o COM1 4 o J AME oio AX RXD RS 232 Device DCD Note There are 5 wires as follows Connect the RXD to the TXD of the RS 232 device Connect the TXD to the RXD of the RS 232 device Connect the RTS to the CTS of the RS 232 device Connect the CTS to the RTS of the RS 232 device Connect the GND to the GND of the RS 232 device l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 16 Using the RS 485 Port
8. Example Please refer to StooWatchStart function for more detailed information e StopWatchStop Function Disables the StopWatch channel oyntax int StopWatchStop int channel Header Zinclude 7188xb h Description The system timer ISR will stop to increment the otopWatch value channel 0 7 a total of 8 channels Return Value On success returns NoError If the channel is out of range returns ChannelError 15 Example Please refer to StopWatchStart function for more detailed information e StopWatchPause Function Pauses the StopWatch oyntax int StopWatchPause int channel Header include 7188xb h Description After calling StopWatchPause StopWatchContinue must be called to restart the time counter l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 123 channel 0 7 a total of 8 channels Return Value On success returns NoError If the channel is out of range returns ChannelError 15 Example Please refer to StopWatchStart function for more detailed information e StopWatchContinue Function Restarts the StopWatch oyntax int StopWatchContinue int channel Header include 7188xb h Description channel 0 7 a total of 8 channels Return Value On success returns NoError If the channel is out of range returns ChannelError 15 Example Please refer to StopWatchStart for more detailed information e StopWatchReadValue Function Re
9. EnableWDT Enables the Watchdog timer DisableWDT Disables the Watchdog timer HefreshWDT Refreshes the Watchdog timer There are many other custom timer and More Watchdog Timer functions available Please refer to the 7188xb h header file l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 118 and the user manual on the enclosed CD which can be found at CD Napdos minios 7 document lib_ manual_for_ 7188xabc index htm for more detailed Information e TimerOpen Function Opens the timer function for use oyntax int TimerOpen void Header include 7188xb h Description Before any of the timer functions can be used the TimerOpen function must be called Return Value On success returns NoError If the Timer is already open returns 1 Example Zinclude 7188xb h void main unsigned long time int quit 0 InitLib Print n rPress any key to start the timer Print n rthen Press 0 to Reset the timer 1 4 to insert a delay q to guit n r Getch TimerOpen open the timer function while quit sets the key function if Kbhit switch Getch case 0 TimerResetValue reset the timer break case 1 DelayMs 1000 delay unit is ms uses system timeticks break case 2 Delay 1000 delay unit is ms uses the Timer 1 feature of the CPU break case 3 Delay 1 1000 delay unit is 0 1 ms uses the Timer 1 feature l 7188XB Series
10. PLC e Ihel 7188XB D sends a command to its 7000 output modules l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 78 In this way the input data from the 7000 series modules can be displayed on a touch screen In addition the output from the 7000 series modules can be controlled from a touch screen l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 79 9 9 Radio Modem Application Device A Device B As Device C T DU Series D A D I D O Module 7188 Controller a 1 900 5 SST 900 SST 2400 settings Device A RS 232 Half duplex mode Synchronous way Slave state Baud Rate 9600 Channel 3 Frequency 915 968MHz SST 900 SST 2400 settings Device B C D e RS 485 or RS 232 e Half duplex mode e Synchronous way e Slave state l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 80 e Baud Rate 9600 e Channel 3 e Frequency 915 968MHz As the I 7188XB D is an embedded controller and is programmable it can be used as a bridge between the SST 900 and any external devices such as a PLC a controller or other 7000 series modules Il 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 81 9 6 An Application Using 4 COM Ports 1 COM3 RS 232 MMICON 7000 Series SST 900 SST 2400 K Radio Modem SST 900 SST 2400 Radio Modem 7000 series modules COM 1 The PLC can access the I O state of the 7000 series modules COM 2
11. RS 485 D1 D1 Self tuner ASIC inside e CON is an RS 485 port D2 D2 Self tuner ASIC inside Before using the COM Port the nstallCom or InstallCom1 2 function must be called to install the driver for the COM Port Before exiting the program the RestoreCom or RestoreCom1 2 function must be called to uninstall the driver After calling the InstallCom function data can be read from the COM Port sent to the COM Port printed from the COM Port and so on Before reading data from the COM port the IsCom function should be used to check if any data has already been sent to the COM Port If yes then the ReadCom function should be used to read the data from input buffer of the COM Port Before sending data to the COM Port the ClearCom function could be used to make sure the output buffer of the COM Port is clear then use the ToCom function to send data to the COM Port For example the code to echo the data back to COM1 RS 232 is shown below int portz1 to use COM1 int quit 0 data InitLib Initiate the 7188xb library InstallCom port 115200L 8 0 1 install the COM driver while quit if lsCom port check if any data is in the COM Port input buffer data ReadCom port read data from the COM Port ToCom port data send data via the COM Port l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 55 if data q quitz1 if q is received exi
12. Reads the current value of the CountDownTimer count syntax int CountDownTimerReadValue int channel unsigned long value Header X include 7188xb h Description If the return value is 0 it means that the time has expired channel 0 7 a total of 8 channels value a pointer to the location where the value is to be stored Return Value On success returns NoError If the channel is out of range returns ChannelError l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 125 15 Example Please refer to CountDownTimerStart function for more detailed information InstallUserTimer Function Installs a custom timer function which will be called at intervals of 1ms oyntax void InstallUserTimer void fun void Header include 7188xb h Description fun A pointer to the custom function The function cannot use an input argument and cannot return a value Example include 7188xb h int Data 3 0 0 0 void MyTimerFun void custom timer function static int count 3 0 0 0 int i for i20 i 3 i44 l Print count d d r i count i count I if count O gt 200 LCD lamp blinks each 200 units count 0 0 if Data 0 0 Data 0 1 else Data 0 0 lamp 1 1 Data 0 if count 1 gt 500 LCD lamp2 blinks each 500 units count 1 0 if Data 1 0 Data 1 1 else Data 1 0 lamp 2 1 Data 1 if count 2 gt 1000 LCD lamp3 blinks each 1
13. Refer to Step2 in Sec2 3 to connect the module Select the MiniOS7 image file that you want to upgrade on the left side Click the right mouse button to choose the Update MiniOS7 Image eS Himos Utility Yerion 3 1 1 build 2 1 1 1 Modi Ma Dpload Upload 4 Execute AM Update CES Inage l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 27 Step 3 It will take about 10 seconds for the upgrade to finish If the MiniOS7 was updated successfully a Confirm action dialog box will appear Loading Progress MiniOS7 Utility Yerion 3 fx From E 0FO41 2vickminos zeb img Tob CR 20070 301s2188sB CA_ 20070 Ta SRAM 18S B CR 20070307 IMG Please wait a while for rebooting Cancel Step 4 Press button and see the Build item to check the version number of the MiniOS7 The diagram is as follow MiniOS7 Utility Ferion 3 1 1 build 3 1 1 1 BI Gy Rb Comection 4 Command Z Configmation FJ Aimi08 Ix Ele Help ik Mn UU 0 M dee e oat ene Sie Toe ma TA H Basic Prompt nus E Can FieFolder y Basi 2 et i ame Basic Hardwa 7186B FIRMWARE Fle Folder NES C305 IMAGE FieFoder torpon Basic Q coda KB RBBB E Basic b4 bits Seral Number UT lA aa AL Ub UL UL 3 load232 di BK ERRARE Basic Time 7 FF 05
14. include 7188xb h Description hour The address used to save the hour 0 23 data minute he address used to save the minute 0 59 data sec he address used to save the second 0 59 data Example Zinclude 7188xb h void main int year month day hour min sec wday InitLib SetDate 2006 1 12 sets the system date for the RTC SetTime 15 35 50 sets the system time for the RTC SetWeekDay 4 sets the system day of the week for the RTC GetDate amp year amp month amp day reads the system date from the RTC GetTime amp hour amp min amp sec reads the system time from the RTC wday GetWeekDay Print Date 02d 02d 04d d Time 02d 02d 02d n r month day year wday hour min sec e SetTime Function Sets the system time to the RTC oyntax int SetTime int hour int minute int sec Header include 7188xb h l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 112 Description hour 0 23 minute 0 59 sec 0 59 Return Value On success returns NoError On error returns the TimeError 19 Example Please refer to GetTime for more detailed information GetDate Function Reads the system date from the RTC syntax void GetDate int year int month int day Header Zinclude 7188xb h Description year 2000 2080 month 1 12 day 1 31 Example Please refer to GetTime for more detailed information SetDate Function Sets the
15. Arpi hia i e e E E epii ee i eek be pe F a ra m ii quas Ss gIS HXBBIJ I QD oa ef C3 zu fem he F Cad E c ep a zu m a lt r lt R a u C ho 2 Q D ze E O gt c Q Q D o O mmn O gt Description PCB ground PCB ground CLOCKA CPU synchronous clock output Asynchronous ready input level sensitive OPEN ready Channel 0 interrupt request input asynchronous active high Channel 1 interrupt request input asynchronous active high PCB power supply Power up reset pulse active high PCB ground Power up reset pulse active low CPU Timer output O can be used as a programmable D I O CPU Timer output 1 can be used as a programmable D I O CPU Timer input 0 can be used as a programmable D I O CPU Timer input 1 can be used as a programmable D I O Common serial clock output for 7188 series modules DIO9 Programmable D I O bit Programmable D I O bit Programmable D I O bit CPU power supply CPU power supply NMI ss N O1 R O P 2 O c oo 1 Oo O1 Co fO O l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 71 e CLOCKA 40M e ARDY This pin is left OPEN for applications that do not require the use of wait states INTO and INT1 These two pins
16. ELLE BE File Edit Search Run Compile Debug Project Window Help HOHAGMEBB CPP r Application BOUNDIMSIICNEN EN Code generation Advanced code generation C options Advanced C options Optimizations Source Messages Hames Message Fi Help Change the entryz exit code generated for functions l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 142 Step 6 1 Set the DOS standard i t DOS standard mi Convention Stack tandard step 7 Set the Debugger Options File Edit Search Run Compile Debug Project Window Help C DOGUME 1 RDHIHI 1 HOHRMEHH Application Librarian Directories Hessage 1 Fi Help Set debugging options Cdisplay swapping inspector options etc 7 1 Set Source Debugging to None a Inspectors in E Hone Dizspla C ua cdm ram Head Size E bytes l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 143 Debug Project Options Window Maa Alt F9 Link Build all Information Remove messages Fi Help Bring target up to date by compiling and linking as necessary EXE file HELLO1 EAE Linking BC3A LIB CL LIB Total Link Lines compiled 1257 PASS 2 Warnings B B Errors H 5 Available aes 10000 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 144 Using MSC Compiler The working steps to use MSC 6 00 C
17. OK button hello PRJ otep 7 Add all necessary files to the project File Edit Search Hun Compile Debug HOHRHMEHBH C pen project Close project Ef Opt ions Window Help 2 Delete item Local options Include files um Project HELLO M Fi Help Add an item to the project l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 41 step 7 1 Select the source file Type c and press Enter in A area If the file you want is in B area moving the green block to choose the file and click the Add button If not moving the green block to C area and press Enter to search the file HELLO C step 7 2 Select the function library Type lib and press Enter in A area If the file you want is in B area moving the green block to choose the file and click the Add button If not moving the green block to C area and press Enter to search the file FICHAR Step 8 Click Done to exit l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 42 Step 9 Click on Options and select full menus Jof x Edit Search Run Compile Debug Project Window Help HOHAMEHH C ree Compiler Make Directories Environment Project HELLO Fi Help Use or don t use full set of menu commands gt 7 otep 10 Click on Options and select the compile menu item then set the Code generation opt
18. Opt ions De bus Break watch Edit Col 19 Insert Indent Tab Fill Unindent D MONRME C Pic Rename NONANE Neu 4 7188XABC 7188XA BC_TC LED LED LED pr rite to Directory Change dir 05 shell Quit Alt k l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 136 Step 4 Load the Project by selecting the project name from the Project menu 3 wan BSE Opt ions Debug Break uatch Project name LED PRI Break make on Errors Auto dependencies Off Clear project Remove messages step 5 On the compiler options menu change the Memory model Small for 7188xbs lib large for 7188xbl lib and set the Code Generation to 80186 80286 as shown in the diagram below File Edit Run Compile Project jh Debug Break watch Edit Line 1 Col i Insert Indent Ta Model Large Defines Code generation Optimization Source Errors Names File Edit Hun Compile Project Sayre De bug Break uatch Edit Line I Col i Insert Indent Ta Model Def ines Code generation Calling convention Instruction set Floating point Default char type Alignment Generate underbarzs Merge duplicate strings Standard stack frame Test stack overflow Line numbers OBJ debug information step 6 Select Build all from the compile menu to build the project NT BEE Project Opt tons De bu Break uatch Compile to OBJ D HOHAME OBEJ D HONAME C Make EXE file D DEMOS EXE Link EXE file Build
19. Port of the Host PC refer to Section 2 2 for more details owitch on the power for the Host PC and execute the 7188xw exe Switch on the power for the I 7188XB D All initialization messages will be shown on the monitor of the Host PC If the INIT pin is open the 1l 7188XB D will search for the autoexec bat file If the autoexec bat file is present the I 7188XB D will execute it If the autoexec bat file is not present the I 7188XB D will revert to console mode to allow the user to download debug a program After completing the initialization stage the I 7188XB D will use the COM1 as its standard input output The standard output of the l 7188XB D will be shown on the monitor of the Host PC If a key is pressed on the keyboard of the Host PC the key code will be echoed to the I 7188XB D as standard input Therefore both the keyboard and l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 48 monitor of the Host PC can be used as standard input and output for the I 188XB D as follows e Use 7188xw exe or MiniOS7 Utility as a bridge between the Il 188XB D and the Host PC e Execute 7188xw exe or the MiniOS7 Utility on the Host PC to setup this bridge e The keyboard of the Host PC gt standard input of I 7188XB D e The monitor of the Host PC gt standard output of I 7188XB D In this way the I 7188XB D can read data from the keyboard and display it on the monitor Thus debugging a program will be easies and
20. Prompt SUE Open project SS Close project aS Delete item step 3 1 Select the source file i ame EA lH E HELLOL C Qi E otep 3 2 Select the function library and then click the Done button l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 140 ee 4 zil zs Code eee options m m NDOWSisys Bi xl Edit Search Hun Com De bu Pro Window Help ile C RTI RP ESTEE PE ENTIER ELTERN EE Advanced code generation Entry Exit Code C options Advanced options Optimizations Source Messages Hames Project HELLO Fi Help Specify how compiler prepares object code memory models etc step 4 1 Change the Memory model Small for 7188xbs lib large for 188xbl lib rx J fissume 58 Equals DS efines ii Step 5 Set the Advanced code generation options l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 141 ID BEE File Edit Search Run Compile Debug Project Window Help LL ce ee TU CTS Code generation Entry Exit Code C options Advanced C options Optimizations Source Hezsages Hames Fi Help View further code generation options step 5 1 Set the Floating Point to Emulation and the Instruction Set to 907 86 ee Emulation Instruction Set Far Data hreshold EPL HER LE LEA otep 6 Set the Entry Exit Code Generation option
21. SRAM and then display the version information If the image file is correct it will be written to the Flash Memory l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 96 ELS A 1 32 COM1 115200 48 6 1 FC 0 C T530 DIR AVL S82 RB DemoiBC TC HelloWello C n x 1 7188XB upload Press ALT E to download file Input f1ilename xb050701 1mg Load f1le xb050701 img crc 5875 0000 Send file info total 256 blocks Block 256 ransfer time 1s 13 187000 seconds CRC1L6 C1AB 7000 FFFE 7188 Step 8 It will take about 10 seconds to upgrade MiniOS7 After the update has finished the system will automatically reboot If this does not occur the system must be rebooted manually c TIBBEW 1 32 COM1 115200 4 9 1 FCS0 CTS 0 DIR C 17188XBYOS image 188XB b105s1 1n10s7 for 7188XB Ver 2 00 002 date 07 01 2005 hecking CRC 16 0K pdate the OS code Please wait the message Wwrite Finished gt gt rase Flash F000 rite Flash Ki write Finished gt gt 0K Nalt WDT reset system ICP DAS Mini0S7 for I 7188XB Ver 2 00 build 002 Jul 01 2005 17 50 42 RAM 512K FLASH MEMORY 512K CPU RDC 8820 D arial number 01 OC 42 C9 OE OO OO 74 step 9 Type the ver command to check the MiniOS7 version number cv TIBBEW 1 32 COMI 115200 N 8 1 FC 0 C TS 0 DIR C 17188XBYOS image l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 97 Appendix C Comparison Table Feature c
22. Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 21 A cycle ida 00m poms 100ms Note Only the display version of the module will include a 5 digit 7 SEG LED l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 22 2 3 Downloading Programs to the I 7188XB D Before using the MiniOS Utility ensure that the download cable is connected from the Host PC to the I 7188XB D and ensure that no other programs are running on the I 7188XB D For details of how to connect between the I 7188XB D and COM1 on the Host PC refer to the wiring diagram in the Sec 1 4 5 Program download Note Instead of using the MiniOS7 Utility to download programs to the Il 188XB D the 7188xw exe file can also be used Refer to Appendix B MiniOS7 Utility and 7188XW for details of the program download procedure for 7188xw exe The program download procedure is as follows Refer to Sec2 1 to install MiniOS7 Utility Ver 3 11 otep 1 From the Windows START menu go to Programs ICPDAS MiniOS 7 Utility Ver 3 11 and locate the MiniOS7 Utility Ver3 11 gt f g MiniOS Utility Ver 3 11 2 MiniOS Utility Ver 3 11 EP MiniOS Utility Ver 3 11 Manual 9 Uninstall otep 2 Press and Select New connection Choose the right COM port and set other parameters Click OK button and the utility will search module automatically T MiniOS7 Utility Ferion 3 1 1 build 3 1 1 1 gy F e b Connection a Command
23. User s Manual Ver 1 0 Apr 2007 7MH 020 10 119 of the CPU break case 4 Delay 2 1000 delay unit is 0 01 ms uses the Timer 1 feature of the CPU break case q quitz1 break time TimerReadValue reads the timer Print rinTime 8 3f sec 0 001 time TimerClose closes the timer function e TimerClose Function Stops the timer function oyntax int TimerClose void Header include 7188xb h Description If the program has called the OpenTimer function it must call TimerClose before exiting Return Value Always returns NoError Example Please refer to TimerOpen function for more detailed information e TimerResetValue Function Resets the timer to O oyntax void TimerResetValue void Header X include 7188xb h Description Resets the main time ticks to O Example Please refer to TimerOpen function for more detailed information e TimerReadValue Function Reads the main time ticks oyntax unsigned long TimerReadValue void Header include 7188xb h Description Reads the main time ticks The time unit is ms When l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 120 Example e DelayMs Function syntax Header TimerOpen or TimerReset are called the time ticks will be reverted to 0 Please refer to TimerOpen function for more detailed information Inserts a delay for a specific time
24. Waits until a single character is received from keyboard input ngetch Returns a single character to the input buffer of COM1 utch Sends a single character to COM1 uts Sends a string to COM1 Retrieves formatted data such as scanf in the C language Cannot scant used on MSC VC 4 only TC BC rint Prints formatted data such as printf in the C language eadlnitPin Reads the status of the INIT pin inelnput X Inputs a single line from Stdlnput There are more user functions for Standard IO For more detailed More jnformation please refer to the 7188xb h file and CD Napdos MiniOS7 document Lib_ Manual For_7188XABC index htm l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 99 Note The Print and printCom function cannot be used simultaneously in the same program e Kbhit Function Checks whether any keyboard input data is currently available in the input buffer syntax int Kbhit void Header include 7188xb h Description Checks if any data is currently available in the input buffer Return 0 For no data input Other There is data in the input buffer and the return value is the next data in the buffer If the next data is O the function will return 1 OXFFFF Example Zinclude 7188xb h void main int quit 0 data InitLib Puts n rPress any key to show ASCII Q to quit n r while quit if Kbhit data Getch if data Q quitz1 Putch data Print A
25. an example l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 102 Type 2 COM port Function Description Installs the COM Port driver The COM Port number is not InstallCom assigned InstallCom1 Installs the driver for COM1 InstallCom2 Installs the driver for COM2 Uninstalls the drivers for the COM Port The COM Port RestallCom number is not assigned Uninstalls the driver for COM1 Assigned to COM1 HestallCom 1 RestallCom2 and etc are similar Iscom Check if Com has data The COM Port number is not IsCom assigned The COM Port number is not assigned Reads the data from COM Port buffer The COM Port ReadCom number is not assigned ReadCom1 Reads data from the COM buffer HeadCom2 Reads data from the COMO buffer ToCom Sends data to the COM Port The COM Port number is not ToCom assigned The COM Port number is not assigned There are more functions available for use with COM More Ports Please refer to the 7188xb h file and CD Napdos MiniOS7 document Lib_ Manual For_7188XABC index htm Note The Print and printCom function cannot be used simultaneously in the same program l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 103 e InstallCom Function Installs the driver for the COM Port syntax int InstallCom int port unsigned long baud int data int parity int stop Header include 7188xb h Description Installs the driver for th
26. are left OPEN for that do not require an interrupt applications e TO 0 and TO 1 These pins can be used as the timer output of the CPU or programmable DI O e Tl O and TI 1 These pins can be used as the timer input of the CPU or programmable D I O DIO4 DIO9 and DIO14 Programmable DI O bit SCLK The I 7188XB D uses this signal as a CLOCK source to drive all onboard serial devices so it is always programmed as DO Changing this signal to other configurations will cause serious errors This signal to drive external serial can be used devices without any side effects c C2 o gt Q D m O gt aV Q Q D 0 O O O gt O Description Address bus Data bus AO 00 A1 Address bus Di Data bus A2 Address bus A D A D D D D A D D gt No D2 Databus A3 Address bus 2 CO gt T Address bus 0 0 1 1 2 Data bus A4 0000 Data bus Address bus Data bus A6 Address bus 7 WR D6 Databus AZ Address bus D7 Data bus Interrupt request input for channel 4 asynchronous active j Write strobe output synchronous active low Chip select output synchronous active low Read strobe output synchronous active low 2 O 2 N Zz aN gt Q D OI O OI OI N IOIOIAI OINI gt O l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 72 e Address bus output AO A7 e Data Bus tri state bi direction DO
27. by compiling and linking ERE file Linking HELLO EAE SIC SLI BCL LIB Total Link Lines compiled 1885 PASS 2 Warnings H B Errors H 5 Available cama 394K For instructions related to the downloading and execution of programs please refer to Section 2 3 r MiniOS7 utility Y2 0 00 es 1KB BRBSR GEI 2005 12 ello exe 8 1KB 06 24 2005 09 55 23 1KB CR 2005 76 7 8KB ERES 2005767 4KB PRJ 483 2005 5 lt gt C MZ188XAXDemoXBC TCXHelloxXHello C 4 files on Disk FileType ues Fra 1 files on Disk 450380 available spaces fLOOA RS d line Save Clear IER Coml beudzste l 15200 Module 1 7188XA MiniOS7 Version 2 00 003 Tu 01 2005 Flash 512K l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 45 gi 199 X B2 Hello exe Hello world mIs g lg ee Le E af ee i re ee pa J LUT Tc EBENE ET um etek sacre ues pir om baudrate 11 5200 Module I 7188XB Mine Terion 2 00 005 Deci 2006 Flash 51 For more detailed information regarding compiling and linking related to the various C compilers TC BC MSC MSVC please refer to Appendix E Compiling and linking l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 46 4 Operating Principles 4 1 System Mapping Device Address mapping Flash ROM 512K from 8000 0000 to F000 FFFF DENS En o 012K from 0000 0000 to 7000 FFF
28. for more information 4 8 2 Using RTC and NVRAM The I 7188XB D module contains both an RTC and NVRAM which are located on the same chip and an onboard Li battery that is used as backup for at least 10 years The features of the RTC are as follows BIOS support for RTC time and data MiniOS7 supports RTC time and date seconds minutes hours date of the month Month day of the week year Leap year valid up to 2079 NVSRAM 31 bytes The NVRAM can be read written any number of times The features of NVRAM are as follows e Data Validity 10 years e Read write cycles unlimited e otal 31 bytes The ReadNVHAM function can be used to read one byte of data from the NVRAM and WriteNVRAM function can be used to write one byte of data to the NVRAM The code to write data to NVRAM address 0 is shown below int data 0x55 data2 InitLib Initiate the 7188xb library WriteNVRAM 0 data data2 ReadNVRAM 0 now data2 data 0x55 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 62 To write an integer two bytes to the NVRAM use the code shown below int data 0xAA55 data2 char daraptr char amp data InitLib Initiate the 7188xb library WriteNVRAM 0 dataptr write the low byte WriteNVRAM 1 dataptr 1 write the high byte dadaptr char amp data2 dataptr ReadNVRAM 0 read the low byte dataptr 1 ReadNVRAM 1 read the high byte now data2 da
29. from the RTC There are many other functions related to the NVRAM and the RTC Please refer to the 7188xb h header file and the user manual on the enclosed CD which can be found at CD Napdos minios 7 document lib_ manual for 7188xabcWndex htm for more detailed information e ReadNVRAM Function Reads data from the NVRAM oyntax int ReadNVRAM int addr Header Zinclude 7188xb h Description Reads one byte of data from the NVRAM addr O to 30 a total of 31 bytes Return Value On success returns the data 0 255 stored at the specified address On error returns the AddrError 9 Example include 7188xb h void main int data 55 data2 InitLib WriteNVRAM 0 data data2 ReadNVRAM 0 now data2 data 55 Print data d data2 d data data2 WriteNVRAM Function Writes data to the NVRAM syntax int WriteNVRAM int addr int data l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 111 Header X include 7188xb h Description Writes one byte of data to the NVRAM addr 0 30 data One byte of data 0 255 If the data gt 255 only the low byte will be written to the NVRAM Return Value On success returns NoError On error returns the AddrError 9 Example Please refer to ReadNVRAM for more detailed information e GetTime Function Retrieves the system time from the RTC syntax void GetTime int hour int minute int sec Header
30. interval The time unit is ms and uses system time ticks void DelayMs unsigned t include 7188xb h Description Delay time unit is ms Example e Delay Function oyntax Header t the delay time Please refer to TimerOpen function for more detailed information Inserts a delay for a specific time interval The time unit is ms and uses Timer 1 feature of the CPU void Delay unsigned ms include 7188xb h Description Inserts a delay for a specific time interval The time unit Example e Delay 1 Function oyntax Header is ms and uses the Timer 1 feature of the CPU ms the delay time Please refer to TimerOpen function for more detailed information Inserts a delay for a specific time interval The time unit is 0 1 ms and uses the Timer 1 feature of the CPU void Delay 1 unsigned ms include 7188xb h Description Inserts a delay for a specific time interval The time unit Example e Delay 2 is 0 01 ms and uses the Timer 1 feature of the CPU ms the delay time Please refer to TimerOpen function for more detailed information l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 121 Function Inserts a delay for a specific time interval The time unit is 0 01 ms and uses the Timer 1 of the CPU syntax void Delay_2 unsigned ms Header X include 7188xb h Description Inserts a delay for a specific time interval The time unit is 0 01 ms and
31. mue uo Les Me eus ves Oc S geo cas 12 TAA BOCK DIAG FANN scvsvaeshiwsuatusunasli vedud zdevb SEEE uod v2 sag od Ra rao IVa peto itae Ug Pape o ua Ya 13 TAS Wing Diagrams Tor ADDIICabIOD s sicco adeundi dava P FO dur ined dunt oro dun Deoa E 14 1 4 6 BPO i Xeon Pie T UT 18 1 4 7 Mounting the I O Expansion BUS siiiiuorde dede o ws dies ivo xd aes Ree ide de es 19 QUICK SIIELo aiiis iid aeee tans cesis Tex MERI IM I LEE 20 2 1 SolbWare Irstalldlollz sm dud buds tum Edda DU sv E bu Wo uu v Pu CEU ES VEN E dE 20 2 2 Connect the Download Cable to the Host PC eessessssseeeeeee 21 2 3 Downloading Programs to the l 7188XB D cccccccccceeeceeeeeeeeeeeeeeeeeneeeseeeseueeaeeenaess 23 2A Y TT a reir da odds asocia ern lo Re S nt Ure nc ore ee ed ve ee en rr 27 WINO YOUR First PFOGK AIM iis iiic oor ess tect iiia aiaa aaa 29 eV MENON RT M 29 9 2 COMPIE and HINKET uso nt ctetu EEEE tutte qute tutta situ EES 30 3 3 The Detailed Steps for PrograMmMiIng cccccccccsesceceeeeceeceeceecesseeeessueeessesesseeeesaeeeeas 31 9 9 01 Downoad TUDO G4 Verslon 1 032 or Dro EDEN ERRORIS SERERE DS Rx X XP EREDUR 31 9 9 2 astallTutbo G42 Versloh 150 ossneoseeeepatu du CH vvi uo HSTEPE TE IAEEM SENS 33 3 3 3 Set the environment variables of the SYStEM ccccccccseececeeeeeeseeeesaeeeesseeeesaaeess 36 3 3 4 Build and Execute the Program ccccccseccsecceeecececeeeesecauece
32. size is 448K bytes Each bit of the Flash memory can only be written from 1 to 0 and cannot be written from O to 1 The only way to change the data from 0 to 1 is to call the EraseFlash function to erase a block from the Flash Memory 64K bytes The user should decide whether to write to the block or to erase it To write an integer to segment OxDOOO offset 0x1234 of the Flash Memory the code is as follows int dataz0xAA55 data2 char dataptr int dataptr2 InitLib Initiate the 7188xb library dataptr char amp data FlashWrite 0xd000 0x1234 dataptr FlashWrite 0xd000 0x1235 dataptr read data from the Flash Memory method 1 dataptr char amp data2 dataptrzFlashHead 0xd000 0x1234 dataptr 1 FlashRead 0xd000 0x1235 read data from the Flash memory method 2 dataptr2 int far MK FP 0xd000 0x1234 data data Reading data from the Flash Memory is somewhat like reading data from SRAM The user should allocate a far pointer to point to the memory location first and then use this pointer to access the memory l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 61 Before writing data to Flash Memory the user must first call the FlashWrite function and check whether data can be written or not After calling the EraseFlash function data can be written to that segment Hefer to the demo programs in the CD Napdos 7188XABC 7188XB Demo BC_TC Memory folder
33. specifications of MiniOS7 without notice The typical command set for MiniOS7 Displ HEX value in th ifi iti f 5 diai LED5 pos value ye aysa value in the specifled position of 5 digit Accesses the service routine to read write from to the USE NVRAM NVBAM Accesses the service routine to read write from to the USE EEPROM EEPROM l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 84 USE FLASH Accesses the service routine to read write from to the Flash Memor A USE COM option ao the service routine to send receive to from DATE mm dd yyyy sets the date of the RTC Time hh mm ss Sets the time of the RTC Tests the current memory block stores the MiniOS7 image file in the SRAM of the UPLOAD I 188XB D this command is only used to upgrade MiniOS7 wo Stores the MiniOS7 image file in the Flash memory of BIOS1 the I 7188XB D this command only used to upgrade MiniOS7 of the I 7188XB D Memory of the I 7188XB D LOADR Downloads files to the SRAM RUNR ont Runs the program stored in the SRAM of the option 7188XB D downloaded using the LOADR command I INP IW INPW port Reads data from the hardware Port O OUTP OW OUTPW Outputs data to the hardware Port port value l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 85 http ftp icpdas com pub cd 8000cd napdos minios 7 document lib man ual for 7188xabc index htm l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10
34. uses the Timer 1 feature of the CPU ms the delay time Example Please refer to TimerOpen function for more detailed information StopWatchStart Function Starts using a StopWatch channel and resets the StopWatch value to 0 syntax int StopWatchStart int channel Header include 7188xb h Description The system timer ISR will increment the StopWatch value by 1 in 1 ms intervals channel 0 7 a total of 8 channels Return Value On success returns NoError If the channel is out of range returns ChannelError 15 Example include 7188xb h void main void unsigned long value int quit 0 InitLib Print n rTest the StopWatch Press q to quit n r TimerOpen StopWatchStart 0 start using the StopWatchStart function while quit If Kbhit switch Getch case q quitz1 break StopWatchReadValue 0 amp value Print SWatchz ed r value if value 2000 StopWatchPause 0 DelayMs 2000 StopWatchContinue 0 if value 4000 StopWatchStop 0 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 122 DelayMs 2000 StopWatchReset 0 StopWatchStart 0 TimerClose e StopWatchReset Function Resets the StopWatch value to 0 syntax int StopWatchReset int channel Header include 7188xb h Description channel 0 7 a total of 8 channels Return Value On success returns NoError If the channel is out of range returns ChannelError 15
35. utlity Help id Uninstall Mini utility amp What s Mew 71888 Ge Minis utility 2 Documents k 47 Settings k ye Search Li Help and Support Windows XP Professional EEE ini IKB BAREA 2005 12 d amp 1KB 06 24 2005 09 55 23 IKE CABS 2005 6 5 HELLO EXE SKE MERTES 2005 5 BHELLO PRY KE PRJ 2005 5 gt Ci 7188204 Demos BC TC sHellosHello c 4 files on Disk 1 files on Disk 450380 available spaces File Type 4l files Fra portz030A data A a w 7 Fr c Mini zi sare Cea Moml baudrate 115200 Modul I 7189 4 Minio Yeraon 42 00 003 Puldi 2005 Flash 512E l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 88 7188XW The 7188xw exe application is the main utility for the I 7188XB D and can be used to perform the following functions e Download user program files from a Host PC into the memory unit of the l 7188XB D module e Download the MiniOS7 image file from a Host PC into the Flash Memory of the I 7188XB D controller and upgrade the MiniOS7 e Show a debug string on the monitor of a Host PC Three standard output library functions such as Putch function Print and Puts will allow a main control unit to send an output string to the monitor of a Host PC e Enter data into I 7188XB D module using the Host PC keyboard Three standard input library functions such as Getch Scanf and Linelnput will allow the main control uni
36. 000 units count 2 0 if Data 2 0 Data 2 1 else Data 2 0 lamp 3 1 Data 2 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 126 void main void int quit 0 Print n rTest the LCD lamp blink using user timer Print n rPress q to quit n r InitLib InitLCD initial Lib amp LCD CirScrn clear the LCD screen TimerOpen open timer function InstallUserTimer MyTimerFun install and call user timer while quit if Kbhit amp amp Getch q quit 1 TimerClose e InstallUserTimer1C Function Installs a custom timer function on interrupt Ox1c The system timer will call int Ox1c at intervals of 55 ms oyntax void InstallUserTimer1C void fun void Header include 7188xb h Description fun A pointer to the custom function The function cannot use an input argument and cannot return a value Example Please refer to InstallUserTimer function for a similar example e EnableWDT Function Enables the WatchDog timer syntax void EnableWDT void Header include 7188xb h Description The WatchDog Timer WDT is always enabled and will be continually refreshed by the system Timer ISR When a custom program calls EnableWD T the system timer ISR will stop refreshing the WDT which must then be performed by calling RefreshWDT from within the program otherwise the system will be reset by the WDT The WDT timeout period is 0 8 se
37. 0133 EY MinitOS _Utlity chm 1025KB DAREA HTML H ComPort COMI i Mini0S7_Utity eve 20MKB REE Conor CDM 3 MiniQS Utili XB AREE ComPort M3 uart dll SE HEARN H ComPort C M4 al ue E DAT is ComPar COME Bl unins000 exe EXE EHET ComPor COME ComPort COM H ComPort COME i Build Version 2 00 UL Mar 01 2007 16 36 32 P IBI LocalHost CPU Frequency 2020 LocalHost IP Address 10 0 8 3 D Connection F 2 B LIpload F5 E DiskT ool E nfl 7 DE Delete LocalHost Paneer CDM1EDM2 COM COMS COMTO Memory Disk 384K 1 Memory Disk B 0K am 771 Info F 7 Note Besides using the MiniOS7 Utility to upgrade the MiniOS7 188xw exe can also be used Refer to Appendix B MiniOS7 Utility and 7188XW for download procedures wr l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 28 3 Writing Your First Program 3 1 Libraries There are two function libraries for the I 7188XB D module as follows e 7188xbs lib are programs for the small memory model e 7188xbl lib are programs for the large memory model Both libraries are suitable for TC BC MSC and MSVC compilers All declared functions are described in the header file 7188xb h The location of latest Library http fto icodas com pub cd 8000cd napdos minios minios 2 0 1 718 8xb lib or CD Napdos MiniOS7 MiniOS7_2 0 i 7188xb lib Hundreds of functions are supported in the 7188xb
38. 188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 69 4 12 Using the I O Expansion Bus As there are many serial interface devices available today the I O expansion bus includes both serial and parallel interfaces The parallel interface is very similar to an ISA bus so the old ISA bus design can be migrated to the I O expansion bus with a minimum amount of alteration The I O pins of the serial bus are programmable and can be programmed as either D I or D O The features of these serial devices are as follows e Smaller size compared to parallel devices Lower cost compared to parallel devices e Easier to design for isolated applications The serial interface of the I O expansion bus makes connecting to these serial devices very easy 4 12 1 Definition of an I O Expansion Bus The I O expansion bus of the I 7188XB D module can be divided into 3 groups as follows 1 Power supply and reset signals VCC GND RESET and RESET 2 Parallel Bus oystem clock CLOCKA Asynchronous ready control ARD Y Address bus AO A7 Data bus DO D7 Interrupt control INTO INT1 and INT4 Chip select and read write strobe CS WR and RD erial Bus TO_0 TO 1 TI 0 TI 1 SCLK DIOS DIO4 and DIO14 CoN EE E E E l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 70 The definition of an I O expansion bus is given as follows T I Arr EE LTT PE zem PUNE Dh n Blog teo STA ETE one ESSI TF sa
39. 5 A VOM SING the Timer FUNCION o3 en qi Laban e a he or Cadre aoe aul 67 4 11 Using Digital Input and Digital output seeeeseeeseeeeeeeeeeen 68 4 12Using the V O Expansion Bs iecit eio ode antes C E oie ou ut 70 4 121 Dernilonor am lO Exbarisionr BUS sexccerotamcscr etes mt ores aas 70 4 12 2 VO Expalision BOGSIGSeacesasu des puse Deut uu D e vu E Uu a dee du cro du ias 73 ADDICION S ERES EE ETE E DD E m 75 5 Embedded Controllers asit i EE Rc v ar ER E UA EE ER EC ACA BENE ERU LON RRE DAS 75 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 2 5e LbocalReal lime Controler RTO keea 76 5 9 Hemole Eocal CONO lE suene ate bee at tapa t so cele se etie Ruhe ut oup Bs du ro fune dou deeded 77 54A EC ENZqo i ienPilooeciloMe m me 78 9 5 Radio Modem ADDIIGAllOD scott oa ches e heap Ed Oc ne dt GUI dri dO dud 80 56 Anm Applicatior Hsmg 4C OM PONS t T ososesesesdt tese epi daro ue EEUU eue tae eel 82 5 4 An Application Using 4 GOM POMS Zona e ui oux MeeE RE Eds EE eee 83 Appendix A What is MiniOS7 1 eere Leere erlernen nnne nhan 84 Appendix B MiniOS7 Utility and 7188XW 87 MNOS AON emo c A 87 TISSU on etm M MES sabe E 89 Appendix C Comparison Table ises oo exco iive eu FoE ey Oeo E age neu E UP D EXE ESSE eu CERIS 98 Appendix D Library Function List
40. 85 COM Port and includes the following 2 pins e D connect to the Data of the RS 485 network e D connect to the Data of the RS 485 network COM 1 COMe is a half duplex 2 wire RS 485 network and cannot be used in a full duplex 4 wire application It is designed to directly drive l 7000 series modules send receive directional control in a 2 wire RS 485 network is very important Therefore the I 7188XB D is equipped with a Self Tuner ASIC controller for all RS 485 ports which will automatically detect and control the send receive direction of the RS 485 network In this manner the application programmer does not have to worry about the send receive direction control for the RS 485 network 4 6 3 To Send a Command to an l 7000 module The commands used for l 7000 series modules are very different from those of the I 7188XB D but commands can be sent from the l 7188XB D to a l 7000 module using the ToComx function l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 57 Using COM1 COM2 to connect and control l 7000 modules The procedure for 7000 related applications is as follows step 1 The I 7188XB D sends a command string to the l 7000 series modules Step 2 The destination l 7000 modules execute the command step 3 The destination l 7000 modules delay by 1 byte to allow for setting time step 4 The destination l 7000 modules echo the result string back to the I 7188XB D Note The delay time us
41. 91 by Borland International Inc Install Utility Welcome to the Turbo G installation program This program will copy the files needed to install Turbo G on your system You will need about 7 5 megabytes of available disk space if you wish to install all the memory models unpack the examples and copy the Tour files Press ENTER to continue ESC to quit EMTER Continue ES5C Cancel step 5 1 step 5 2 Step 5 3 step 5 4 step 5 5 Press lt ENTER gt to start the installation oelect the drive where the unzipped file is located The default is A so you should enter C then press ENTER Press ENTER again This will install the software from the directory tctemp Press ENTER again This allows Turbo C to be installed on the Hard Drive Use the Up Down arrow keys Press the up arrow once to select Start Installation and then press ENTER again c Command Prompt install Turbo G 2nd Edition Installation Utility Turbo G Directory SIUE Binary Files Subdirectory 1 C BIM Header Files Subdirectory TC 1 NCLUDE Library Suhdirectorvu SMIG LIB EGI Subdirectory MTC EGI Tour Subdirectory SMSTG TOUR Class Library Subdirectory STC CLASSLIB Examples Subdirectory GI XITCMERRBHPLES Install Tour Yes Unpack Examples es LCS MNCLH 1 Start Installation Selecting this option will begin copying Files to your hard drive into the directories specified above Descriptio
42. BC TCXHelloXMHello C otep 6 Press F2 and then type the filename Hello exe and press lt Enter gt c TI882W 1 32 COM1 1152700 8 8 1 FC 0 CTS 0 DIESC 1718834BiDemoBC_ICHeloHello C c 7188XB Demo BC_TC Hel lo Hel lo_c gt 7188xw 7188x for WIN32 version 1 32 2006 10 17 By ICPDAS Tim Tsai Current set Use COMI 115200 N 8 1 AutoRun Autodownload files None Current work directory C 7188xXB Demo BC_TC Hel lo Hello_c 1 7188XB Input filename Hello exe When Press F8 F9 F10 will auto download the f1le Hello exe Step 7 Press F8 to download the Hello exe file to the I 7188XB D and execute the program l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 93 cx T188X W 1 32 COM1 115200 N 8 1 FC 0 CTS 0 DIR C 7188XB Demo BC_TC Hello Hello_C Ox 1 188XB gt Input f1ilename Hello exe hen Press F8 F9 F10 will auto download the file Hello exe F8 LOAD File will save to 8000 0000 StartAddr gt 7000 FFFF Press ALT_E to download Tile Load file Hello exe crc 4BBF 0000 Send file info total 28 blocks Block 28 ransfer time 1s 1 969000 seconds elei Hello world Notes A description of the Hotkey functions is as follows F8 Download a file to FLASH Memory and then execute the program F9 Download a file to FLASH Memory F10 Download a file to SRAM and then execute the program step 8 Type dir and press Enter to check that the files are stored in the Flash Mem
43. Build Options C Debug Specific Release Specific Common to Both Options String Cancel nalaga Gs G1 W s AL Ox 0 NDEBUG ID DOS FR Help Use Project Defaults i Category Category Settings Memory Model Code Generation Custom Options egment Setup Custom Options C Debug Uptions Listing Files Memory Model Optimizations Hew Segment Data Size Threshold Po P Code Generation Frecompiled Headers Preprocessor Segment M ames Assume extern and Uninitialized Data Far step 6 Remove the xcr afxcr library from the Input Category Linker Ophons Build Options C Debug Specific Release Specific Common to Both OK Options String LIB xcr LIBS aie ILIB aldnames ILIB slibee NUI APSTACE 5120 fONERROR NOESE OLOGO Cancel Help Use Project Defaults Category Category Settings Input Memory Image Libraries afscr ildnames slibce Miscellaneaus Output gnore Default Libraries Specific Libraries to l gnare Prevent Use of Extended Dictionary Iv Distinguish Letter Case l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 149 Linker Ophons Build Options C Debug Specific Release Specific Common to Both OK Uptions String Cancel LIB aldnames LIB slibee NOI PSTACE 5120 ONERROR NOERE OLOGO Help Use Project Defaults Category Category Settings Input Memory Image Librarie
44. C file list Upload F 5 x i7188 A COMI 0 files s 0 bytes onnection otep 5 Select the file and then press the right mouse button Choose the Run and press to execute the program 7 MiniOS7 Utility Verion 3 1 1 build 3 1 1 1 EE Li File gt Connection s Command Configuration T Tools amp Help O po p Look ir E Desktop NH OQ b p Lock in Disk 4 E Em TER ee ee Sinis erede J f T T hello 1KB CFile ECL supe PP hella SKB Application Run 1 hello pri AKE PRJFile Run with parameters Reset Minis F4 Erase Disk 1 1 Eun with parameters Reset iani rs F4 Erase Disk E st l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 25 Step 6 The result of the program will be shown in 7188xw window MiniOS7 Utility Verion 3 1 1 build 3 1 1 1 d Fie f Connection Command Configuration F Tools amp Help Look in hello Or Lock in Disk 4 385 518 bytes available e Name Size Type Size Modified ERECT JVD O ERA Ry An z Fena 12007 11 260 d el 7188xaL cx 7188XW 1 31 COM1 115200 N 8 1 FC 0 CTS 0 DIR C Wocuments and Se i o 788b E S TES Tan T Ed 7188xBL Begin Key Thread lCurrent set Use COM E 718826 ixi vei NEN eS E riesci hello HELLO veto i 7188H4B run 6 fi HELLO Hello world Ss HELLO DSK Ef HELLO P
45. C44 Note MSC does not support C E language The Hello C file is only supported by BC 1 Shows how to write a function to input data C Style IO 2 Shows how to retrieve a string 3 Shows how to use a C function sscanf or just use Scanf Receive COM Port The PC sends commands to the 4 l 1889XB D and receives responses Silv COM from the I 7188XB D Also shows how to use another COM Port or LED to show information to help debug a program Reads writes the byte data via the ToCom In Out COM Port ello Heads the date and time from an DateTime RTC and prints it on a monitor user can also set the date and time Reads writes the DO and DI of the Led Shows how to use the DelayMs function LED to switch the LED ON or OFF 47 ile 6 1 Sea7led Controls the red LED and 5 digit 9 7 segment LED In many applications a text file is needed in order to record specific E Extends config 1 Basic and adds GetProFilelnt GetProFileFloat and Config 2 Advanced GetProFileStr These functions can be used to determine the Type from a text file Config 1 Basic information so that the program can read it FSeek can be used to retrieve specific information from a text file l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 51 Memory K87K Module 7K87K DIO for Com Timer Demo5 Shows how to access the NVRAM EEPROM Writes a value to the EEPROM and shows it on the monitor m m U J
46. D7 INT4 This pin is left OPEN for applications that do not require an interrupt e CS RD and WR These 3 signals will be synchronous to CLOCKA Pin3 of JP2 and asynchronous to ARDY Pin4 of JP2 e The CS will be active if the program needs to input output data from I O address O0 to Oxff Note Refer to I O Expansion Bus for 7188X 7188E User s Manual for more information 4 12 2 l O Expansion Boards I O Expansion Boards for prototyping and testing X002 Prototype Board X004 Self test X005 Prototype Board Small size X006 Prototype Board Large size I O Expansion Boards for DI and DO X111 13 DO channels X116 4 DI channels 6 Relay Output channels Without case X119 7 DI channels 7 DO channels Without case I O Expansion Boards for A D D A DI and DO X202 7 A D channels 0 20mA X203 2 DI channels 6 DO channels 2 A D channels 0 20mA X303 4 DI channels 6 DO channels 1 A D channel 5V 1 D A channel 5V X304 4 DI channels 4 DO channels 3 A D channels 5V 1 D A channel 5V X305 2 DI channels 2 DO channels 7 A D channels 5V 1 D A channel 5V l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 73 X308 6 DO channels 4 A D channels 0 10V X310 3 DI channels 3 DO channels 2 A D channels 0 20mA 0 10V 2 D A channels 0 10V I O Expansion Boards for RS 232 422 485 DI and DO X507 4 DI channels 4 DO channels 1
47. Directly controls the 7000 series input output modules COMS3 MMICON is used as the local MMI COMMA The PC is used to monitor and record the system data l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 82 5 7 An Application Using 4 COM Ports 2 COM3 RS 232 TOUCH SCREEN See a TOUCH 200 7000 series modules Touch screen COM 1 Links to the remote Host PC COM2 Directly controls the 7000 series input output modules COMS The TOUCH 200 is used as the local MMI COMMA The Card reader is used as a standard input device l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 83 Appendix A What is MiniOS7 MiniOS7 is an embedded operating system developed by ICP DAS Co Ltd that is designed to replace ROM DOS in 7188 series modules Various companies have created several brands of DOS In all cases 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 MiniOS7 provides all equivalent functions of ROM DOS while in addition providing user specific functions for the I 7188XB D Below is a comparison table between MiniOS7 and ROM DOS as follows sa O ROMDOS Suppor for VO ExpansonBus fyes o fno Support for ASIC Key Note ICP DAS reserves the right to change the
48. E Configuration Look ir Last Connection AlH Fe Dusconnect Chr EZ search F1Z l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 23 oe Connecthon Connection History comi w Serial Fart TCP UDP Baud Rate 175200 IP Data Bit 9 Parity GIN one Stop Bit Step 3 See if the MiniOS7 Utility connects with I 7188XB The connected icon Is The disconnected icon is SE Look in MiniO S7_Utilty Ofe EN 3 bin 3 FIRMWARE 5308 IMAGE d Icpdas 5 ln3d232 dll 52 Mini0S7_Utility chm 12 MiniD57 Utility exe MiniQ 57 Lltility ini ES uart dil Ej unns dat i urinis ese File Falder File Falder File Falder lKB HORSES BBKB REFAT Sst 1 025KB DARFA HTML H 2 84KB ERAS JKE BRBSEIB 5EKB EFAS Shes SKB DAT File EZKE EHIH See here to know connection status D Comeciona E unosars 3 Dirootren Fal orn O Deiner E neret EF Consok 1 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 24 step 4 Select the file to load from left side and click E upesars to load file into module or draw the file to the right side 7 MiniOS7 Utility Verion 3 1 1 build 3 1 1 1 G3 File f Connec tion 4 Command Z Configuration T Tools amp amp Help e ad 4KB PRAJ File Host P
49. F COM2 BASE 0XFF10 to OXFF18 0 Divdedbyzeo E liae 2 mSS S 8 Brakpon O O oO 4 Detected overflow exception 5 Array bounds exception 6 Unused opcode exception 8 lHme0 9 Reeva o A DMAO oO 0B DMA4 SS 0D INT1 of the VO expansionbus 10 WNT4ofthelOexpansionbus 1 COMP 12 Tmei S 13 Tmer2 144 COM SS l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 47 4 2 Debugging custom Programs using COM1 The COM1 Port download port of the I 7188XB D has three major functions e Downloading programs from the Host PC e Connecting to the Host PC to enable program debugging e Acting as a general purpose COM port When the I 7188XB D is switched on it will initialize COM 1 in the following configuration under console mode e Start Bit 1 Data Bit 8 Stop Bit 1 no parity e Baud Rate 115200 bps The I 7188XB D will check the status of the INIT pin If the INIT pin is shorted to the GND pin the I 7188XB D will send the start up information to COM4 and enter console mode to allow the user to download debug a program and the following start up messages will be displayed Power off the Host PC and I 7188XB D e Connect the download cable between COMA on the I 7188XB D and the COM
50. M NUMmimimimi Pee ee ee ee a l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 32 3 3 2 Install Turbo C version 1 01 step 1 Go to where you downloaded the file and double click on the self extracting file tcpp101 zip in Windows to extract it This will open a WinZip Self Extractor window you do NOT need WinZip installed on your machine By default this will extract the files to the C tctemp directory You may designate a different location step 2 Once the files have been extracted exit the WinZip oelf Extractor window Step 3 Open an MS DOS command prompt window Gy Set Program Access and Defaults gt Windows Catalog c CAWINDO WS System32 cmd exe soft Windows XP Uers ET 1 26881 eight 1985 2001 Mi oft Corp and Settings Administrator gt m Programs L1 4 Documents pe the n Internet re Lag OFF Administrator T WindowsexPs Professional Uy ay ve rw 6 01 PM step 4 Change the directory to the c tctemp or wherever you put the unzipped files folder and execute the INSTALL EXE file es CAWINDOWS S ystem32 cmd exe C Coler TOME 1985 2001 Microsoft Corp C Documents and Settings Administrator cd c tctemp l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 33 step 5 The following instructions will guide you through the installation process c Command Prompt install Turbo G 2nd Edition Installation Utility Copyright tc 19
51. NoError On error returns an Error code Refer to the use manuals for I 7000 series modules for more details Example Please refer to SendCmdTo7000 for more detailed information e ascii to hex Function Converts ASCII code to a hexadecimal value syntax int ascii to hex char ascii Header include 7188xb h Description Returns an integer representing the Hex value ascii The ASCII code char Example Please refer to SendCmdTo7000 for more detailed information Il 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 135 Appendix E Compiling and linking Using the TC Compiler There are two procedures for using the TC compiler TC 2 01 which are described as follows Method 1 Using a command line For more information please refer to CD 8000 NAPDOS 7188XABC 7188XB Demo BC_TC Hello_C gotc bat tcc Ic tc include Lc tc lib hello1 c lib 7188xbs lib Method 2 Using the TC Integrated Environment step 1 Execute TC EXE to run the TC 2 01 Integrated Environment Step 2 Edit the Project file Add the necessary library and files to the project File Edit Run Compile Project Options Debus Break uatch Line 2 Col 19 Insert Indent Tab Fill Unindent D NONAME C Message Fi Help F5 Zoom F 6 Switch F7 Trace F8 Step F9 Make Fi Menu Buil step 3 Save the project as a Project file by selecting save from the File menu and entering a name such as LED prj n BEE Run Compile ees
52. O lt Inputs a value and stores it in an EEPROM block 1 peer address value will automatically increase by m m U B O Reads the data that has been written to the EEPROM Heads writes and erases the Flash Flash memory 48 Heads the value that has been written RASE to the Flash memory Inputs a value written in the Flash Flash w memory value will automatically increase by 1 Reads the value that has been written to NVRAM Writes a value to the NVRAM value will automatically increase by 1 Z i Z lt lt JJ D gt gt lt S ToodMaem Demonstration of the p Allocate TooMemory function Reset Restores the initial values Uses the Ungetch function to run another program Retrieves the serial number of the I 7188XB D Enables the Watchdog or bypasses AEA the enabled Watchdog TY K87K demo for com K87K Al for Com K87K DI for Com NJN lum D Cc 2 EIS Zio Cc 3 O D N k87K_DO for Com AO 024 for Com AO 22 26 for Com how to use the Timer function Show how to use the CountDownTimer Demo91 function on channel 0 to switch the LED ON or OFF shows how to use the StopWatch Demo92 function on channel O to switch the LED ON or OFF l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 52 4 6 3 4 10 Shows how to use the InstallUserTimer Demo96 function to control the 5 digit 7 segment LED Shows how to use the DelayM
53. RS 422 channel TxD TxD RxD and RxD X508 4 DI channels 4 DO channels 1 5 wire RS 232 channel X509 4 DI channels 4 DO channels 2 3 wire RS 232 channels X510 5 DI channels 5 DO channels 1 3 wire RS 232 channel 128K 2 bytes EEPROM X510 128 5 DI channels 5 DO channels 1 3 wire RS 232 channel 128K bytes EEPROM X511 3 RS 485 channels X518 8 DO channels 1 5 wire RS 232 channels X560 3 3 wire RS 232 channels 8M bytes NAND Flash I O Expansion Boards for storage devices X600 4M bytes NAND Flash X601 8M bytes NAND Flash X607 128K battery backup SRAM X608 512K battery backup SRAM Note Refer to I O Expansion Bus for 7188X 7188E User s Manual for more information l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 74 5 Applications I 7188XB D 7000 series module 7000 series module Applications e 4500 replacement and enhancement not compatible PC based controller replacement e PLC replacement e Special controller replacement The I 7188XB D can be used as an embedded controller for general applications meaning that it can be used to replace a Host PC PLC or other special controllers Programming Tool TC BC MSC Debug Tool es standard input output keyboard and monitor of a Host e MMICON e PC keyboard and monitor e Touch Screen RS 232 or RS 485 interface otored in Flash Memory Man Machine Interface e Onboard DI or DO Input O
54. RY T GEBSEAHA o E Tcooo0 swe gt Connection F2 ilo F ES pos F11 NOTE The 7188xw window has to be closed and then the download operation Step 4 could be done The content of the Hello c file is as follows Zinclude 7188xb h Include the headers to use 7188xbl lib functions void main void InitLib Initiate the 7188xb library Print Hello world r n Print the message on the screen l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 26 2 4 MiniOS7 Upgrade ICP DAS will continue to add additional features to the MiniOS7 in the future so it is recommended that you periodically check the ICP DAS website for the availability of updated versions of the MiniOS7 Note For a more detailed description of the MiniOS7 please refer to Appendix A What s the MiniOS7 The MiniOS7 Utility provides an easy way to upgrade MiniOS7 The upgrade procedure Is as follows Step 1 Get the latest version of MiniOS7 image file The format of the image file name is TTYYMMDD img TT TYPE of product YY The year this image released MM The month this image released DD Ihe day this image released Note The MiniOS7 image file contained on the companion CD can be found in CDANAPDOSMIiniOS 7 directory The latest version of MiniOS7 can be downloaded from the ICP DAS website http ftp icpdas com pub cd 8000cd napdos 7188xabc 7188xb os image Step 2 Execute the MiniOS7 Utility
55. SCII is d n r data Puts n rPress any key to show ASCII Q to quit n r Getch Function Waits until a character is received from keyboard input syntax int Getch void Header include 7188xb h Description Reads a single character from the input buffer If there is no input in the data buffer the function will wait until the input buffer receives some data Return Value 0 to 255 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 100 Example Please refer to Kbhit for an example Ungetch Function Puta single character to the input buffer syntax int Ungetch int data Header include 7188xb h Description If there is no data in the input buffer when Ungetch is called next time the Getch function is called it will return the data Data 0 to 255 If the data is gt 255 only the low byte will be sent Return On success returns NoError On error i e the buffer is full returns 1 Example Please refer to Kbhit for an example of Getch Putch Function Displays a single character on the screen syntax void Putch int data Header include 7188xb h Description Data 0 to 255 If the data is gt 255 only the low byte will be sent Example Please refer to Kbhit for an example Puts Function Displays a string on the screen oyntax void Puts char str Header include 7188xb h Description Puts will
56. Search Manage Map Network Drive Disconnect Nebwark Dr Create Shortcut Delete Properties a Internet Explorer System Properties System Restore Automatic Updates Henote General Computer Mame Hardware Advanced System Microsoft Windows F Professional Version 2002 Service Pack 2 tJ Registered to airius H5274 b44 52 85884 23818 Computer Dual Core AMDO Opteron trm Processor 280 2 41 GHz 1 00 GB of RAM Physical Address Extension step 2 Click on the Advanced tab and then click on the Environment Variables button System Properties System Restore General E Computer Name lL Hardware Adva You must be logged on as an Administrator to make most of these chen Performance Visual effects processor scheduling memory usage and virtual mero User Profiles Desktop settings related to your logon Startup and Recovery System startup system failure an formation Settings Environment Variables f Error Reporting Automatic Updates Renc Environment Variables User variables For Administrator Variable Value C Documents and Settings 4dministrat C Documents and Settings Administra System variables Value Spec C WINDOW S systemse cmd exe HOST C NO OF 4 Windows MT CHWINDOWSIsvstem3z CHAWINDOWS variable Da l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 36
57. XA Demo MSC Hel lo 2006 05 29 17 08 lt DIR gt 2006 05 29 17 08 lt DIR gt 2006 05 29 17 03 106 Gomsc bat 2006 05 29 16 47 677 03 1lo 6 2006 05 29 17 08 6 71 HELLO EXE 3 File s re 2 Dir s 22 041 571 328 bytes free C 7188XA Demo MSC Hel lo gt _ l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 146 Using MSVC Compiler The working steps to use MSVC 1 50 compiler are given as following Step 1 Run MSVC exe 22 Microsoft Visual C DEMOA MAE 27 EU Zinclude lt string h gt Finclude pre Project I XZinclude J 2 5 8 aD Zee mee led5 MAE d Aminios Wemolmneced 5 Aaa E E gt d BH lt gt MINIOZ7 db DEMO aes CUT E gt MEC x f LEDS gt j j List Files of Type RC wou Project mak E d ICFDATA DU 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 Project M ame Browse Project Type windows application EXE el Co i QD FARE helo MAK c1 1 88x Wena we hello Bri Eo cA FS 7188X4 E gt DEMO sel MSC AES CD f HELLO B List Files of Type BERE CY Project mak A mc l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 147 step 3 Add the user s program and the necessary library files to t
58. ads data from COM17 ToCom dala sends data to COM 1 if data q quitz1 if q is received exit the program RestoreCom1 uninstalls the driver for COM1 e RestoreCom Function Uninstalls the driver for the COM Port The COM Port number is not assigned oyntax int RestoreCom int port Header include 7188xb h Description Uninstalls the driver for the COM Port The COM Port number is not assigned and can be modified using the port parameter port assigns the COM Port number Example Please refer to InstallCom for an example e RestoreCom1 Function Uninstall the driver for COM1 oyntax int RestoreCom 1 void Header include 7188xb h Description Uninstall the driver for COM1 and is assigned to COM1 Example Please refer to InstallCom1 for an example e IsCom Function Checks whether there is any data stored in the COM Port buffer The COM Port number is not assigned oyntax int ISCom int port Header X include 7188xb h l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 105 Description Checks whether there is any data stored in the COM Port buffer The COM Port number is not assigned and can be modified using the port parameter port assigns the COM port number Example Please refer to InstallCom for an example IsCom1 Function Checks whether there is any data stored in the buffer of COM 1 syntax int IlsCom1 void Head
59. ads the current StopWatch value oyntax int StopWatchReadValue int channel unsigned long value Header X include 7188xb h Description The value represents the time that has elapsed since either a StooWatchStart or StooWatchReset was last called channel 0 7 a total of 8 channels Return Value On success returns NoError If the channel is out of range returns ChannelError 15 Example Please refer to StooWatchStart for detailed more information e CountDownTimerStart Function Starts using the CountDownTimer oyntax int CountDownTimerStart int channel unsigned long count Header include 7188xb h l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 124 Description channel 0 7 a total of 8 channels count the amount of time to be counted Return Value On success returns NoError If the channel is out of range returns ChannelError 15 Example include 7188xb h void main void unsigned long value int quit 0 InitLib Print n rTest the CountDownTimer Print n rPress q to quit n r TimerOpen CountDownTimerStart 0 1000 use the CountDownTimer while quit If Kbhit amp amp Getch 2z q quitz1 CountDownTimerReadValue 0 amp value reads the CountDownTimer Print Test CountDown d r value if value 0 CountDownTimerStart 0 1000 restarts the CountDownTimer TimerClose e CountDownTimerReadValue Function
60. all Primary file Get info l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 137 cy CA WINDOWSS ystem32temd exe d Wc2lU c File Edit Kun Compile Pro zi ptions Debug Break watch aI it Line 1 Col i Insert Indent Tab Fill Unindent D HONANE C Linking ERE file LED EXE Linking SITC2BSLI BCL LIB Total Link Lines compiled 1335 PASS 2 Warnings H BH Errors B Available memory 235K l Success Press any key Message Fi Help F5S Zoom F6 Switch FY Trace F8 5tep F Make Fi Menu HUM l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 138 Using the BC Compiler The procedures for using the BC compiler is as follows Step 1 Execute the Borland C 3 1 CAWINDOWSYs Hx File Edit Search Run Compile Debug Project Options Window Help Co DOGUHE 1 nDHIMHI d HOHRMEB B CPP t Borland C Wersion 3 1 Copyright 4c 1996 1992 hv Borland International Inc Fi Help Accept the settings in this dialog box Step 2 Create a new project file prj Command Promat b lx File Edit Search Hun Compile Dehuc Opt ions Window Hely B C DOCUME 1 A M Glose project Add item Delete item Local options Include files geen ae File l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 139 step 3 Add all the necessary files to the project E be Command
61. as com pub cd 8000cd napdos 7188xabc 7188xb os image otep 3 From the Host PC go to the directory where the image file is stored then execute the 188xw exe application to connect the Host PC to the I 7188XB D controller step 4 Use the UPLOAD command then press ALT E gt after the Press ALT E to download file message is shown on the screen l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 95 c TIBSBEW 1 32 COMI 115200 N 8 1 FC D CTS 0 DIRS V7I18SZBiDemoiBC ICAHello3Hello C Ox C 7188XB Demo BC_TC Hel lo Hel lo_c gt 7188xw 7188x for WIN32 version 1 32 2006 10 17 By ICPDAS Tim Tsai Current set Use COMI 115200 N 8 1 AutoRun Autodownload files None Current work directory C 7188xXB Demo BC_TC Hel lo Hel lo_c 1 7188XB upload Press ALT E to download file Input filename Step 5 Type the image filename for example xb050701 img then press ENTER cy TIBBEW 1 32 COMI 115200 N 8 1 EC D C T5 D0 DIR 17188EBiDemoiBC ICAHelloiHello C Dix 1 7 188XB upload Input fiTename xb0S0701 img Sd aTYDUSU7U F PUES 0000 Send file info total 256 blocks Block 256 ransfer time 1s 13 187000 seconds CRCI62CLlAB 7000 FFFE 7188 i 7188XB gt _ step 6 Wait for the upload to finish The image file will be stored in the SRAM step 7 Type the bios1 command in the 7188XB D command line The OS will check the image file stored in the
62. cJ Demo gt Demo programs for the I 7188XB D cJ BC TC gt Demo programs for the BC and the TC compiler MSC gt Demo programs for the MSC compiler g E 7188XB DemoList htm gt Demo list for the 7188XB D LJ Document gt Documents related to the l 188XB D LJ OS image The MiniOS7 image file matches the demo programs P Readme html gt The detailed description about the 7188XB folder Note The 7188xw exe file is used as a bridge between the l 7188XB D and the Host PC Therefore the 7188xw exe file must be copied to the CAWindows V folder to allow it to be executed from any location l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 20 2 2 Connect the Download Cable to the Host PC Step 1 Connect the CA0910 download cable between COM of the I 7188XB D and the COM Port of the Host PC as shown in the diagram below step 2 Apply power Vs GND to the I 7188XB D Vs can be in a range from 10V to 30V DC CTS1 E E a GND Connect to the COM Port of Host PC CA0910 XD QD D QD QD D QD D D D D D D D D 5 digit 7 SEG LED Red LED step 3 After applying the power the 5 digits of the 7 SEG LED will continuously show as follows If the non display version of module is being used please continue to the next step step 4 Check that the red LED continuously blinks one times and wait for one second to next cycle The diagram show as follows Il 7188XB
63. call Putch to send the string str The pointer to the string to be sent Example Please refer to Kbhit for an example Scanf Function Scans a character from the input and is similar to the scanf function This function cannot be used with MSC INC syntax int Scanf char fmt Header include 7188xb h Description Returns the number of input fields successfully scanned l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 101 converted and stored The return value does not include any scanned fields that were not stored Return 0 No fields were stored EOF Attempts to read have reached the end of the string Example See CD Napdos 188XABC 7188XB Demo MSC COM _ Ports C Style IO Print Function Prints a formatted character to the screen and is similar to the printf function in the C language oyntax int Print char fmt Header include 7188xb h Description This function is used instead of printf and the only difference between Print and printf is that Print does not convert the characters n to n r That is n only sends the code Ox0A not OxOA OxOD so n has to be used for new line and return The printed message is sent to COM4 Default parameters are 115200 N 8 1 Input Parameters Please refer to the standard function printf in the C language Return The character number to be sent out Example Please refer to Kbhit for
64. conds for MiniOS7 2 0 Example Zinclude 7188xb h void main void l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 127 int quit 0 k InitLib if lsResetByWatchDogTimer test whether the system has been reset by the WDT Print reset by WatchDog timer n r EnableWDT after callng EnableWDT Refresh WDT must be called within 0 8s while quit if Kbhit k Getch if k q Print quit the program r n quitz1 quit the program else Print more than 0 8s has elapsed reset the system r n Delay 1000 There has been a delay for more than 0 8s Reset the system RefreshWDT Refresh WDT must be called within 0 8s Print call Refresh WDT n r DisableWDT Disable the WDT The system will refresh the WDT Print Call DisableWDT nir e DisableWDT Function Disables the WatchDog timer syntax void DisableWDT void Header include 7188xb h Description See the description for EnableSDT Example Please refer to EnableWDT function for more detailed information e RefreshWDT Function Refreshes the WatchDog timer syntax void RefreshWDT void Header include 7188xb h Description See the description for EnableSDT Example Please refer to EnableWDT function for more detailed l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 128 information e IsResetByWatchDogTimer Function Checks if sy
65. e fl In this configuration the control program is implemented series a local I 188XB D The I 7188XB D will directly control the 7000 series modules based on these control arguments The Host PC can then access the remote I 7188XB D regarding the following items e Query and record the status of the remote system e Download control arguments to the remote I 7188XB D The remote l 7188XB D can communicate with the Host PC regarding the following items e Emergency event notification and response e Remote system status notification l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 77 5 4 PLC I O Expansion Application s TOUCH SCREEN COM2 RS 485 I 7188XB D 7000 series modules Most PLCs contain a Man Machine Interface that was originally designed for MMI applications The I 7188XB D can use this interface to construct a bridge between a PLC and the 7000 series modules The I 7188XB D can directly read write from to the internal memory of the PLC meaning that the PLC can access the 7000 series input modules as follows e The I 7188XB D sends a command to the 7000 series input modules e The I 7188XB D writes this data to the internal memory of the PLC e The PLC accesses this data from its internal memory The PLC can control the 7000 series output modules as follows e The PLC writes data to its internal memory e The I 7188XB D reads the output data from the memory of the
66. e fdata gt sec 2 fdata gt size for i 0 i lt fileno i fp noz char far GetFilePositionByNo i get file position l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 131 if fp_no GetFileName i fname Print file d 12s position Fp r n fname fp_no e GetFilelnfoByNo Function Uses the file number index to retrieve file information syntax FILE DATA far GetFilelnfoByNo int no Header X include 7188xb h Description no The file index The first file is index 0 Return Value On success returns the starting address of the file information On error returns NULL Example Please refer to GetFilePositionByNo for more detailed information e GetFilelnfoByName Function Uses the file name to retrieve the file information oyntax char far GetFilelnfoByName char fname Header X include 7188xb h Description fname The file name Return Value On success returns the starting address of the file information On error returns NULL Example Please refer to GetFilePositionByNo for more detailed information l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 132 Type 8 Connecting to I 7000 I 87K series module Function SendCmdTo7000 Sends a command to an 1 7000 1 87K series module ReceiveResponseFrom7a00_ms EGGS a response from an I 7000 I 87K series module Converts the ASCII code to a hexadecimal ascii to h
67. e COM Port The COM Port number is not assigned and can be modified using the port parameter port assigns the COM port number baud Baud Rate the default Baud Rate for the l 7188XB D is 115200 Example include 7188xb h void main int quit 0 data i poriz1 port 1 uses COM1 InitLib InstallCom port 115200 8 0 1 installs the COM port driver for iz0 1 lt 10 i printCom port Test d n r i prints data to the COM Port while quit if lsCom port checks if any data is in the COM Port buffer data ReadCom port reads data from the COM Port buffer ToCom port data sends data to the COM Port buffer ClearCom port clears all the data in the COM Port buffer if data Q quitz1 if Q is received exit the program RestoreCom port uninstalls the driver for COM Port e InstallCom1 Function Installs the driver for COM1 syntax int InstallCom1 unsigned long baud int data int parity int stop Header include 7188xb h Description Installs the driver for COM1 and is assigned to COM1 baud Baud Rate the default Baud Rate for the Il 7188XB D is 115200 Example l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 104 Zinclude 7188xb h void main int quit 0 data InitLib InstallCom1 115200 8 0 1 install the driver for COM1 while quit if isCom1 checks if any data is in the COM1 buffer data ReadCom1 re
68. e companion CD The iobus e pdf file that is provided in the CD Napdos 7188XABC Xboard Documenit folder and the I O Expansion Bus for 7188X 7188E User s Manual contain the same content so the user can refer to either document for more details related to the I 7188XB D I O expansion bus l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 7 Before continuing it is recommended that you read the Readme html which can be found in the CD Napdos 7188XABC 7188XB The latest information available prior to shipping will be contained in this file l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 8 1 4 Hardware Information 1 4 4 Schematics and Dimensions of the I 7188XB D Top View Rear View Side View Unit mm LIU ji MN e e dia 1 DIN RAIL MOUNTING BRACKET 33 60 Bottom View l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 9 1 4 2 Pin Assignment QD qb D QD QD b QD QD QD QD D QD QD D DO DI Dt D1 CT S1 RTS1 GND TXD4 RXD1 INIT Y D2 G D2 R Vs B GND 7 The pin assignment of 14 pin screw terminal block is as follows 1 DO _ Digital output 100mA 30V Max 2 DI Digital input 3 5V OV 6 RTS1 __ RTS pin for COM RS 2322 11 8 TXD1 TXDpinforCOM1 RS 282 9 RXD1 RXD pin for COM1 RS 232 l 7188XB Series User s Manua
69. e has been rebooted by the watchdog timer This function must be inserted at the beginning of program The sample code is as follows l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 65 main InitLib Initiate the 7188xb library if lsResetByWatchDog Timer do something here to check the system quit 0 EnableWDT while quit d RefreshWDT User_function Refer to the demo programs in the CD Napdos 7188XABC 7188XB Demo BC_TC Misc folder for more information l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 66 4 10 Using the Timer Function The I 7188XB D can support one main time tick 8 StopWatch timers and 8 CountDown timers The I 7188XB D uses a single 16 bit timer to perform these timer functions with a timer accuracy of 1 ms The InstallUserTimer function can be used to install a custom timer function and the function will be called at 1 ms intervals The system timer of the MiniOS7 will call INT 9 every 1 ms and call INT 0x1C every 55 ms The timer function of the library is linked to associated with called by hooked to INT 9 and will call any custom timer function The TimerOpen function is used to start the I 7188XB D timer and this function must be inserted at the beginning of the program The TimerClose function is used to stop the timer The sample code is as follows unsigned long time iTime InitLib Initiate the 7188xb library
70. e items are missing or damaged please contact your local distributors for more information We recommend that you save the shipping materials and cartons in case you want to ship the product in the future Il 188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 4 1 1 FEATURES Embedded 80188 CPU 40M or compatible Built in RTC NVRAM and EEPROM 2 Built in COM ports COM1 and COM2 64 bit internal hardware unique serial number COM driver supports both interrupt and 1K QUEUE input output buffer Support for I O expansion bus interface Only one expansion board can be added One Digital Inout Channel One Open collector output Channel Built in self tuner ASIC controller on the RS 485 port Optional 7 segment LED display Built in MiniOS7 by ICP DAS Program download port COM1 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 5 1 2 SPECIFICATIONS PU module 80188 CPU 40MHz or compatible 256K bytes for I 7188XB 512K bytes for I 7188XB 512 12K bytes K bytes 1 bytes es SRAM lash EPROM VRAM RTC Real Time Clock ardware Serial Number Yes uild in Watchdog Timer Yes ommunication Interface RS 232 RS 485 Default is RS 232 RS 485 can be upgraded to 3000V isolated for OEM UL cmm C C IO 0o OIO OJOJOO ZB EEE ABIOonmA O O O thernet Port Digital Input nput Channels On Voltage Level Off Voltage Level 1V DC Max Connect to GND 3 5V DC to 30V DC Max gt
71. ed in step 3 is only 1 byte I 7188XB D N LIO EE EE EE EE E l 7188XB Dy l 7000 The example code for sending a command to COM2 RS 485 is shown below l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 58 int portz2 to use COM2 int i char data J 01M r command to read a module s name InitLib Initiate the 7188xb library InstallCom port install the COM2 driver for i 0 i 5 i ToCom port data i send a command to the l 7000 module wagers program code e RestoreCom port uninstall the COM driver In addition to using the ToCom function the SendCmdTo7000 function can also be used to send commands to an l 7000 series module The HeceiveResponseFrom7000 function can be used to receive the response from an l 7000 series module Functions used to connect to an l 7000 module e SendCmdTo7000 int iPort unsigned char cCmd int iChksum This function sends a command to an l 7000 series module If the checksum is enabled the function will add 2 bytes checksum to the end of the command e ReceiveResponseFrom 000_ms int iPort unsigned char cCmd long Timeout int iChksum After calling the SendCmdTo7000 function the ReceiveResponseFrom7 000_ms function can be called to retrieve a response from an l 7000 series module Refer to the demo programs in the CD Napdos 7188XABC 7188XB Demo BC_TC 7K87K_Module directory for more detailed info
72. effective Note 188xw exe and the MiniOS Utility are provided on the companion CD Please refer to Section 2 2 for detailed wiring information and Section 2 3 for details of how to download programs l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 49 4 3 Using the Download Port as a COM Port The download port COM1 of the I 7188XB D can be used as a general purpose RS 232 port in the following manner step 1 Download custom programs and autoexec bat to I 7188XB D first step 2 Switch off the I 7188XB D and remove the download cable from the Host PC Step 3 Disconnect the INT pin from the GND pin of the I 7188XB D if they are connected Step 4 Switch on the I 7188XB D no standard input no standard output no debug information step 5 Connect a download cable between a new RS 232 device and the COM of the I 7188XB D otep 6 Initialize the COM1 to the new configuration Step 7 The COMI of the I 7188XB D can now be used a general purpose RS 232 port l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 50 4 4 Functions and Demo Programs List There are several demo programs that designed for I 7188XB D For more detailed information regarding these programs please refer to the contents in later sections The functions of the demo programs are as follows Demo program Section Folder Hello C Detecting if the operation system is 3 3 4 MiniOS7 H Hello
73. er include 7188xb h Description Checks whether there is any data stored in the buffer of COM1 Example Please refer to InstallGom1 for an example ReadCom Function Reads data from the COM Port buffer The COM Port number is not assigned syntax int ReadCom int port Header X include 7188xb h Description Reads data from the COM Port buffer The COM Port number is not assigned and can be modified using the port parameter port assigns the COM Port number Example Please refer to InstallCom for an example ReadCom1 Function Reads data from the buffer of COM1 syntax int ReadCom1 void Header include 7188xb h Description Reads data from the buffer of COM1 Assigned to COM1 Example Please refer to InstallGom1 for an example ClearCom Function Clears the data currently stored in the COM Port buffer The COM Port number is not assigned syntax int ClearCom int port l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 106 Header include 7188xb h Description Clears the data currently stores in the COM Port buffer The COM Port number is not assigned and can be modified using the port parameter port assigns the COM Port number Example Please refer to InstallCom for an example e ClearCom1 Function Clears the data currently stored in the buffer of COM1 oyntax int ClearCom 1 void Header include 7188xb h Description Clears the da
74. es lib llibce Creating browser database HELLO EXE error s warningiz EI l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 151 Appendix F Glossary 1 The 64 bit hardware unique serial number The I 7188XB D is equipped with a 64 bit hardware unique onboard serial number This number is unique and cannot be shared by any two I 7188XB D controllers The application software can use this number to check the valuably of the controller and th proe the use of illegal copies It is the most low cost protection mechanism the I 188XB D currently has 2 AsicKey The I O expansion bus supports AsicKey The AsicKey equips a complex machine for validation checking Included in this are 128 bytes of private data for the same purpose It provides very strong protection against illegal copies Every legal user has a unique AsicKey and unique software library the user can self check this key or the software library will check the key automatically In this main it is nearly impossible to remove the AsicKey protection l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 152
75. eseeesaeeeeesaueseeeseeeseeeges 38 Operating PrIncIBl8S cas otros co cu ode en a 47 AV SV STCIM MAIDON ct ia P 47 4 2 Debugging custom Programs using COM1 ccccccceeeeceeeeseeeeseeeeseeeeseueesaeeeseeeeseeeenees 48 4 3 Using the Download Port as a COM Port cceccecseeceeeeeeeeeeeeeseeeesneeeessaeeesseeesaeeeeas 50 4 4 Functions and Demo Programs List cccceccceeeceeeeeeeeceeeeeeeeeeeeseeeseueeeeeeseeeseueeaeeenaess 51 45 COM POM GO MPa lS Oeren E TT 54 46 Using the COM POS eam 3 9 tee het ene teres ce coe oerein ob ut ed dec eee oe eiie io Sero eoe 55 461 To orint trom ihe COM DOELc iiio e dentondigentiorod den tuteddun todo ddesdu decies 56 4 6 2 To Use COM1 COM2 for an RS 485 Application sesseeessssessss 57 4 6 3 To Send a Command to an l 7000 MOAUIE cc ccceeceeceeeeeeeeeeeeeeeeeseeeesaaeeesaaeees 57 4 7 Using the Red LED and 7 SEG LED Display cc cecccceececeeeeeceeeeeseeeeeseeseeseaeeenes 60 4 8 Accessing the I 7188XB D Memory ccccccccseccceeeceeeceeseeeeeceeeseueeeeesseesuseeeeensess 61 4 9 1 USNO las AMEMO usecesesesounssseiiems oi dia urs oU eo Space ad Io Pe a dn poop enar Pee d eese fud c ornar COTON 61 2 0 2 USNO EV GING NVRAM Goiaren paa epe o sores uc qaae E shined eG Last iue e car a fen o 62 2 0 95 USIN E ERRON ere ere eee ene usd t itu dutcti Eee 63 AD Using the Watchdog TME assis eod niet rat ied Ru pU Revo adel ieee 6
76. ex vali hex to ascii Converts a hexadecimal value to ASCII code There are many other functions related to connecting to l 000 1l 87K series module Please refer to the 7188xb h header file and the user manual on the enclosed CD which can be found at CD NapdosWminios7 document lilb manual for 7188xabcWndex htm for more detailed information e SendCmdTo7000 Function Sends a command to an l 7000 series module oyntax int SendCmdTo7000 int iPort unsigned char cCmd int iChksum Header X include 7188xb h Description If the checksum is enabled the function will add 2 bytes checksum to the end of the command IPort 0 1 2 3 4 for COMO 1 2 3 4 cCmd The command to be sent DO NOT add r at the end of the cCmd as SendCmdTo7000 will add a checksum if needed and r after the cCmd iChecksum 1 for checksum enabled 0 for checksum disabled Return Value On success returns NoError On error returns an Error code Refer to the user manuals for I 7000 series modules for more details Example Zinclude 7188xb h void main int port 2 quit 0 x l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 133 char k InitLib InstallCom port 115200L 8 0 1 install a COM Port for the I 7065D ClearCom port SendCmdTo7000 port 0100 0 send a command to DO to off if ReceiveResponseFrom7000_ms port 0100 20 0 Print l 7065D is not available r n while quit control Do Print n
77. ffer that the data is stored Return Value On success returns NoError On error returns 1 It is say EEPROM is busy Block is invalid or Addr is invalid Example Please refer to EE WriteEnable for an example EE WriteProtect Function Sets the EEPROM to write protect mode oyntax void EE WriteProtect void Header X include 7188xb h Description Sets the EEPROM to write protect mode The EEPROM Is in write protect mode by default EE WriteEnable must be called before writing data to the EEPROM After writing the data it is recommended that EE WriteProtect be called to return the EEPROM to write protect mode Example Please refer to EE WriteEnable for an example EE MultiRead Function Reads data from the EEPROM oyntax int EE MultiRead int StartBlock unsigned StartAddr int no char databuf Header X include 7188xb h Description Reads multi byte data from the EEPROM otartBlock 0 to 7 a total of 8 blocks StartAdadr 0 to 255 each block can contain 256 bytes no 1 to 2048 databuf The address to store data Return Value On success returns NoError On error returns 1 It is say EEPROM is busy Block is invalid or Addr is invalid Example Please refer to EE WriteEnable for an example l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 110 Type 4 NVRAM and RTC Function ________Deseription 000 setDate Sets the system date for the RTC GetWeekDay Gets the day of the week
78. file name Return Value On success returns NoError and stores the filename to the fname On error returns 1 and does not save any data to the fname l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 130 Example Please refer to GetFilePositionByNo for more detailed information e GetFilePositionByNo Function Uses the file number to read the file position syntax char far GetFilePositionByNo int no Header include 7188xb h Description The address can be used to get the file data no he file index The first file is index O Return Value On success returns the starting address of the file On error returns NULL Note If the file size is gt 64K 16 a huge pointer char huge data type must be used to retrieve the file data for the offset Example Zinclude 7188xb h static FILE DATA far fdata file data structure please see the file c for details char far fp no void main d int fileno i char fname 13 InitLib Initialize the Library fileno GetFileNo get file number Print Total file number d n r fileno fname 12 0 for i 0 i lt fileno i fdata GetFilelnfoByNo i get file information using the file number if fdata GetFileName i fname get file name Print 02d 12s start at Fp 02d 02d 04d 02d 02d 02d size lul nir i fname fdata gt addr fdata gt month fdata gt day fdata gt year 1980 fdata gt hour fdata gt minut
79. he project Edit HELLO MAE File Mame z 88xal lib f1ooxal lib 188xa5 lib List Files of Type Library lib Directories Close oN BSBRasdemosmscslib Cancel gt c o gt 71884 gt DEMO Help gt MSC Es lib 3 Board Aedes lr Drives IEE Step 4 Set the Code Generation on the Compiler Project Type MS DOS application ERE Use Microsoft Foundation Classes Build Mode t Debug Customize Build Options Compiler Linker Build Options n Options String nalaga Gs G1 AWS AAL Ox D NDEBUIGB ID DOS FR n CAC Compiler Options x OF Cancel Help t Debug Specific Release Specific Common to Both Cancel Help i Use Project Defaults Category Code Generation Custom Options Custom Options C Debug Options Listing Files Memory Model Optimizations P Code Generation Precompiled Headers Preprocessor Segment Hames SO186 7 80188 Calling Corvyention Floating Point Calls Use Emulatar Category Settings Code Generation E Check Pointers iw Disable Stack Checking C C E Code Generator Auto Select Struct Member Byte Alignment 2 Bytes al l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 148 step 5 Change the Memory model Small for 7188xbs lib large for 7188xbl lib CiCTE Compiler Options
80. he C 1 01 Integrated Environment This command can be executed from any location cn CAWINNTisystem22wmd exe d icp20 binttc File Edit Search Hun Compile Debug Project Options Window Help Turbo Version 1 61 Copyright tc 1990 hy Borland International Inc f Ti hei 2 poris SERO SNS ss 2 ams D E SES A Se MURUS l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 38 Step 5 3 Save the file by selecting Save from the File menu and then enter the file name Hello C c Command Prompt tc Edit Search Run Compile Debug Project Options Window Hely Open F3 e Save all Change dir Print Get info DOS shell Quit Alt A F D 7188HB 1 he llo C iles Note If you have a text editor you are familiar with you may use it to type in the above code It should be noted that you cannot use a word processor application for this as you must use an application that saves in plain text such as notepad or edit C language program files should always be given a name ending in C l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 40 Step 6 Create a new project file prj E E Decel Options Window Help Add item InitLibt gt Delete item Print Hello wvorld rn Local options Include Files Moid maintvoid gt 4 Fi Help Load a project file and its desktop Step 6 1 Type the name of the project file and then click the
81. in the CD Napdos 7188XABC 7188XB Demo BC_TC Memory folder for more information l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 64 4 9 Using the Watchdog Timer The watchdog timer of the I 7188XB D is fixed at 0 8 seconds for MiniOS7 2 0 When the I 7188XB D is first powered on the watchdog timer will be always enabled If the watchdog timer is not refreshed within 0 8 seconds it will reboot the I 7188XB D The MiniOS7 of the I 7188XB D will automatically refresh the watchdog after being powered on User programs can call the software driver to stop the MinOS7 from refreshing the watchdog timer but the program must then refresh the watchdog timer manually If the program does not refresh the watchdog timer every 0 8 seconds it will cause the Il 188XB D to reboot The program must then ask the MiniOS7 to reset the watchdog timer then stop and return to the MiniOS7 command prompt Use the EnableWDT function to enable the watchdog timer or use the DisableWDT function to disable it After the watchdog is enabled the program should call the RefreshWDT function before the timer count reaches 0 8 seconds otherwise the watchdog will reboot the l 7188XB D module The sample code is as follows InitLib Initiate the 7188xb library EnableWDT while quit RefreshWDTY User function DisableWDT The IsResetByWatchDogTimer function is used to check whether the I 188XB D modul
82. ions Efx Edit Search Run Compile Debug Project Window Help HOHAMEBH G l a Optimizations Source Messages Hames Project HELLO Fi Help Specify how compiler prepares object code memory models etc step 10 1 Change the Memory model Small for 7188xbs lib large for 7188xbl lib l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 43 Model Hm fines NENNEN EN LEN ME NEN otep 10 2 Click on More then set the Floating Point to Emulation and the Instruction Set to 80186 i Overlay suppo Calling Convention lt gt Emulation lle Options Instruction Set step 11 Click on Options and select Directories to enter the TC 1 01 include and library directories By default the directories are same as the installation directory of the TC 1 01 ne lude VLPEectoPles ELE Ses ee eum me Note The Include Directories specifies the directory that contains the standard include files The Library Directories specifies the directories that contain the TC 1 01 startup object files and run time library files l 188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 44 step 12 Click on Compile and select Make EXE file to make the project c Command Prompt tc File Edit Search Run Debug Project Options Window pad C HOHAHMEHHB OBI Build all Remove mezeaguea Project HELLO Fi Help Bring EXE file up to date
83. l 7188XB Series User s Manual 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 2007 by ICP DAS Co Ltd All rights are reserved Trademark The names used for identification only may be registered trademarks of their respective companies l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 1 Table of Contents 1 STATE OGUIC HOD ee 4 kel Hip Pa AIRE Sessa ch teas ad hee ae a dns seeded beaten Send ans dee goes send eda deandeiiecainn ate 5 UNA PEGIFICATION fanaa T REM 6 1 3 Software and Document information sssssssissestis nennen 7 p HA AROW Ars ITO RIM AUC Mi e m S t ce edd eed m 9 1 4 4 Schematics and Dimensions of the I 7188XB D eeeeeeeeseeeesseee 9 TA 2 cal at O alec Alen ert N Sener e meer rem eee mre en ent mene mer rU e INR 10 14 3 WIOUNTING TMG 1 7 199XBD sess Qoia iie ego E Peso dese PESE xU c Am Exec
84. l Ver 1 0 Apr 2007 7MH 020 10 10 INIT DATA pin for COM2 RS 485 DATA pin for COM2 RS 485 V of power supply 10 to 30V DC unregulated GND for the power supply Note The COM 1 can be used as either an RS 232 or RS 485 port It is not recommended to use both RS 232 and RS 485 at the same time The pin assignment of top 14 pin screw terminal block is as follows Description User defined pin 18 Userdefinedpin t8 23 19 Pin 19 User defined pin 19 20 Pwrz0 User defined n0 21 Pin 21 User defined pin 21 Userdefinedpin25 1 User defined pin 25 User defined pin 26 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 11 1 4 3 Mounting the I 7188XB D 1 4 4 Block Diagram SRAM 256K Flash Memory 512K COM1 Watchdog RS 232 RS 485 1 5 Circuit RTC COM2 RS 485 lt amp NVRAM DI 1 Channel EEPROM 35Vt030V QE 80188 40 CPU m 2K or compatible DO 1 Channel 5 Digit LED 100mA 30V a Optional User defined Pin E f 14 pins 10V to 30V Power Converter l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 13 1 4 5 Wiring Diagrams for Application Program download i VS t3 I Connect the INIT pin p2 f to GND to disable I p2 f autoexec bat l Init ma MER muxi M me mM rl Rekord Mic d d t RrS1 e CTS1 5 Di 4
85. ler that supported the C language The C compiler conformed ta AT amp T s 2 0 specificatips How to Download and Install Turt In the Museum Turbo C version 1 Turbo C version 1 was our first compiler that suk disks The zip file contains all the files conformed to AT amp T s 2 0 specification for the C aie command line tools ran under DOS Turbo C v s urbo C and Turbo C Professional The Professional version inclps asembler Turbo Debugger and Turbo Fre in m 1i c Rn Ra antl eee ine rto C Version 1 software How to Download and Install Turbo C version 1 01 Click on Turba C version 1 01 to download the software 2 7mb Md you are finished downloading the software use your favorite zip iu Es FKZIP or Winzip ta decompress the zip file a folder on your hard drive Turbo C version 1 01 shipped ed on gYfoppy disks The zip file contains all the TIES that were on the 4TloDpy uisk mages To install the software unzip the files onto your hard drive Run the Install exe program and follow the installation instructions to install the software These historical files are provided to the Borland community free of charge They may be downloaded and used as is for personal use only No developer support is provided Each individual product contains copyright notices that are still in force These files may not be made available via the Internet mma im mami mmm sunm mmm a a a SR d a him mmm mmol HT SUN a
86. library Example This function is similar to printCom Please refer to InstallCom for an example l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 108 Type 3 EEPROM Function Description EE WriteProtect There are many other user functions related to EEPROM Please refer to the 7188xb h header file and the user manual on the enclosed CD which can be found at CD Napdos MiniOS7 document Lib_Manual_ For_7188XABC ind ex htm for more detailed information e EE WriteEnable Function Sets the EEPROM to write enable mode syntax void EE WriteEnable void Header include 7188xb h Description Sets the EEPROM to write enable mode The EEPROM is in write protect mode by default EE WriteEnable must be called before writing data to the EEPROM Example Zinclude 7188xb h void main Int data 55 data2 InitLib EE WriteEnable EE MultiWrite 1 10 1 amp data EE WriteProtect EE MultiRead 1 10 1 amp data2 Print dataz sd Data2 d data data2 e EE MultiWrite Function Writes data to the EEPROM oyntax int EE MultiWrite int Block unsigned Addr int no char Data Header Zinclude 7188xb h Description Writes multi byte of data to the EEPROM l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 109 Block 0 to 7 a total of 8 blocks Addr 0 to 255 each block can contain 256 bytes no 1 to 16 Data The start address of bu
87. n e FlashRead Function Reads one byte of data from the Flash memory Syntax int FlashRead unsigned int seg unsigned int offset Header X include 7188xb h Description seg 0 65535 0xffff offset O to 65535 0xffff Return Value FlashRead only returns the value of the address seg offset The address can be from the SRAM the Flash memory or another address generally returns Oxff Example Please refer to FlashWrite function for more detailed information l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 117 Type 6 Timer and Watchdog Timer Function Description TimerOpen JOpensthe timer function for use TimerClose Stopsthe timer function TimerResetValue Resets the timer to O Inserts a delay for a specific time interval DelayMs The time unit is ms and uses system time ticks Inserts a delay for a specific time interval Delay The time unit is ms and uses the Timer 1 feature of the CPU Inserts a delay for a specific time interval Delay 1 The time unit is 0 1 ms and uses the Timer 1 feature of the CPU Inserts a delay for a specific time interval Delay 2 The time unit is 0 01 ms and uses the Timer 1 feature of the CPU Installs a user timer function which will be InstallUser Timer called at intervals of 1 ms Installs a user timer function on interrupt InstallUserTimer1C Oxic System timer will call int Oxic at intervals of 55 ms
88. n Alt H Toggles between normal line mode In line mode all characters Alt L pressed will not be sent to the COM Port until the ENTER key is pressed and it is designed for testing 7000 series modules Alt X oets the file name for downloading without initiating a download operation F5 Runs the program specified by F2 and arguments set by F6 oets the arguments of the execution file set by F2 10 arguments maximum If set to less than 10 arguments add to end ow Fa z o S T NO 7 O l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 90 Downloads the file specified by F2 to the SRAM and executes it Alt F10 Downloads all files specified by ALT F2 to the SRAM memory Sends a BREAK signal to the COM port of the Host PC that is uS currently being used by 7188xw exe More For more detailed information regarding the 7188xw exe application please refer to the index htm file in the CD Napdos MiniOS7 document Lib_ Manual For 7188XABO folder or at http ftp icpdas com tw pub cd 8000cd napdos minios 7 document lib _ manual for 7188xabc on the web Downloading a file to the I 7188XB D controller using the 7188xw exe application Step 1 Power off the I 7188XB D Connect the INIT pin to the GND pin and power on the I 7188XB D at the same time COM1 COM2 Zw O q q E aa hz asta p an EDG TT 7 Y x M DN QOOoOononomw omocmr dz momoonmnm step 2 Afte
89. n Fi Help F Start the installation EMTER Select ESC Previous l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 34 otep 5 6 At this point the Turbo C version 1 01 compiler is installed in C TC which is where the tcc exe executable is also located c Command Prompt install C ICBI Executing HERMES Executing FERNER Executing 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 hy typing README and pressing EMTER in your Turbo G directory Next make sure the line FILES 2H is in your CONFIG SYS file and C TC BIM is in your path For example PATH C BIN SC TC HIN Press any key to continue C o STC BINSUNZIP ERE TG ZIP C TC BIN Executing C XTC BIN THELP COM FC TC BINSNTCHELP TCH W Any Kev Continue l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 35 3 3 3 Set the environment variables of the system After installing you must add C TC to your executable search path The easiest way to do this is as follows otep 1 Right click on the My Computer icon on the desktop Under Windows XP the My Computer icon may be located in the start menu and choose Properties from the context menu e My Documents Open Explore
90. oad page Antique Software Turbo Pascal v3 02 10 Feb 2000 Turbo Pascal 3 was the first Turbo Pasca and BCD math ur Coe vernon ox wo E O NH 00 Qm hfpdMincodegear comirtide 21751 Or amp we SHE IR D Developer Network 3 Borland History Why the name Delphi 21 Dec 14599 CodeGear Communities Resources Help Danny Thorpe writes about the origin of the Borland Delphi pri B Submit Transtation D Auther Profile meer frie Rating tetra Antique Software Turbo C head rut version 1 01 Memorabilia The Adventures of TurboMan H Dec 1999 The Turhokian comic strin advertisement annearend in Dr Dati Abstract D t In the Museum Turbo C version 1 01 Profle erson 1 01 was 3 Maintenance release of me orginal Turbo C How to Download and Install Turbo C version 1 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 31 step 3 Click on the link for Turbo C version 1 01 as shown below to download the tcpp101 zip file When requested save the file to a safe location o Antique Software Turbo C version 1 01 Mozilla Firefox BAR foe F RRE um BO ee IRI mH vi e AE E http lli codegear comrle21151 P HFE G BST TSU asao Author Prome ey Prier ey Antique Software Turbo C BUYNOWONLNE FREETRAL version 1 01 Ey David Intersimone Abstract Turbo C version 1 was aur first compi
91. omparison table pee the 7188 and the 7188X series CPU clock clock CPU clock 80188 40MHz 80188 40MHz 80188 40MHz 80188 20MHz 80188 40MHz 256K I 7188XB SRAM 512K 512K 1 71 ae 2 128K 256K 256K Flash Memory 512K 512K 512K for ODM 2 gt 6K 512K bonn s ay RS 232 or RS 485 RS 232 or RS 485 RS 232 with COM 1 BS 485 with with internal with internal modem control or self tuner self tuner RS 485 internal self tuner COM3 User defined pins 0 pe B 0 Modem control com JNo mo pom o Nes ves 0 No 0 s a hardware unique serial Yes Yes No No number EEPROM D I 3 5V 30V 2chames t channel 2 ohannes 0 D O 100mA 30V 2 channels t channel 3 ohannes 0 WOexpansonbus Yes m eoe m Support for ASIC LAN frm Operating system Programming coc Temsc c TCMMSC BO TC MSC BC language Program COM4 COMI COMI COM4 download Port l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 98 Appendix D Library Function List The table below lists the most commonly used functions For more details of all functions refer to the instructions in the CD Napdos MiniOS7 document Lib_Manual_ For_7188XABC index_e htm file or http ftp icpdas com pub cd 8000cd napdos minios 7 document lib man ual for 7188xabc index e htm on the web Type 1 Standard IO Description Kbhit Checks if any keyboard input data is currently available in the input buffer of COMI Getch
92. ompiler are given as following step 1 In the source file folder create a batch file called Gomsc bat using the text editor I Untitled Notepad Sel File Edit Format View Help cl c Gs FPa Fm G1 ZAL HELLO c he source code link MA NOE NOI HELLO Xlib 7188xhl del o0hJj EY bus A The path for the function library The object file name NOTE 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 cy CAWINDOWS S ystem 2 cmd exe C 7188XA Demo MSC Hel lo gt Gomsc C 7188XA Demo MSC Hello gt cl 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 7188xXA Demo MSC Hello gt link MA NOE NOI Hello XMl1bM 188xal icrosoft R Segmented Executable Linker Version 5 10 Copyright C Microsoft Corp 1984 1990 All rights reserved m c 7188xXA Demo MSC Hello gt del obj m map C 7188XA Demo MSC Hel lo gt del C 7188xXA Demo MSC Hel lo gt _ l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 145 Step 3 A new executable file will be created if it is successfully compiled cx CA WINDOWS S ystem3 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 7188x
93. or 0 On error returns TimeOut 5 Example Please refer to Demo BC_TC Memory Flash FLASH C for more detailed information Note Segment 0xF000 is used to store the MiniOS 7 if attempting to erase segment OxF000 FlashErase will do nothing e FlashWrite Function Writes one byte of data to Flash memory oyntax int FlashWrite unsigned int seg unsigned int offset char data Header include 7188xb h Description seg 0x8000 0x9000 0xA000 0xB000 0xC000 OxDO0OO0 or OxEOO0 offset 0 to 65535 Oxffif data 0 to 255 8 bit data Return Value On success returns NoError O On error returns TimeOut 5 or SegmentError 12 Example Zinclude 7188xb h void main int datazZ0xAA55 data2 char dataptr InitLib dataptr char amp data FlashWrite 0xd000 0x1234 dataptr writes data to the Flash memory FlashWrite 0xd000 0x1235 dataptr dataptrz char amp data2 reads data from the Flash memory dataptrzFlashHead 0xd000 0x1234 dataptr 1 FlashRead 0xd000 0x1235 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 116 Note When writing data to the Flash memory the data bit only can be changed from 1 to O and cannot be written from OQ to 1 FlashWrite does not check the status and just writes the data If an attempt is made to change the data from O to 1 a TimeoutError will occur After calling FlashErase data can be written agai
94. ory of the I 7188XB D NGA 1 32 C0M1 115200 N 8 1 FC0 C I5 DIRS 71882BiDemoiBC_ITCHelloHello C 1 7188XB gt dir O Hello exe 02 15 2007 18 06 12 7081 01BA9 8002 0000 81BC 0009 otal File number 1s 1 Free space 451607 bytes 1 7188XB gt _ step 9 Type del y and press Enter to delete all files stored in the Flash Memory of the I 7188XB D l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 94 cy FLGG2 W 1 32 COM1 115200 4 8 1 FC 0 C 30 DIR L AFL S82 RB WDemo BC TC WelloHello joj x 1 7188XB del y otal File number is 1 do you really want to delete y n 1 7188XB dir otal File number 1s O Free space 458720 bytes 1 7188XB gt _ Note The MiniOS7 only supports the delete all command Individual files cannot be selected for deletion otep 10 Press Alt X to quit the MiniOS7 Upgrading MiniOS7 using the 7188xw exe application step 1 Connect the I 7188XB D to the COM Port of the Host PC using the CA0910 cable Refer to the wiring diagram in Section 2 2 for details step 2 Determine the latest version of the MiniOS7 image file The format of the image file name is TTYYMMDD img TT TYPE of product YY Year that this image was released MM Month that this image was released DD Day that this image was released Note The MiniOS7 image file can be found in the CDANAPDOSMIniO 7 directory on the companion CD The latest MiniOS7 version can be downloaded from http ftp icpd
95. ot to choose 8087 e Cancel the Debug Information function as this helps to reduce program size MiniOS7 supports this feature l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 30 3 3 The Detailed Steps for Programming 3 3 1 Download Turbo C version 1 01 Free versions of the Turbo C 2 01 and Turbo C 1 01 compilers can be downloaded from the Borland website The following instructions will help you to install the Turbo C version 1 01 compiler on a PC running a Windows operating system step 1 Go to the CodeGear web site http dn codegear com museum gt CodeGear De veloper Network Home Page Museum Mozilla Firefox B ee deum Qo EA GO Bee Tam 23 H e gt C Logon e Live con nity chat oa Jim Douglas Th rse M xd April 5th at Sam PDT anc e Al nnouncing E Douglas new CEO of C e E Dei hi ifo Bins rn nch To Sum and Canada s MN lipping Conferen ce The Repla Surve watch the JBu iwed vide Cod Product Tri dia ni Enccibiows loads Articles Audio amp Video Examples Events Bugs amp Suggestions Sort by Date newest firr s gt Historical Documents Delphi 1 launch demos source code launch script and marketing 15 Feb 2005 Anders Hejlsberg provided the original launch script and projects used in the Delphi 1 launch on Februar 14 1995 otep 2 Scroll down the bar and click on the link for Antique Software Turbo C version 1 01 to go to the downl
96. r Enter 1 5 to set Do on 9 to quit n r k Getch ascii to hex k convert ASCII code to hex ClearCom port switch x send a command to set the I 7065D Do1 5 light to on case 1 for command details refer to the I 7000 DIO manual SendCmdTo7000 port 0101 0 Print x ON x break case 2 SendCmdTo7000 port 0102 0 Print x ON x break case 3 SendCmdTo7000 port 0104 0 Print x J ON x break case 4 SendCmdTo7000 port 0108 0 Print x J ON x break case 5 SendCmdTo7000 port 0110 0 Print x J ON x break case 9 guit 1 Print quit break Send of switch fend of while loop e ReceiveResponseFrom7000_ ms Function Receives a response from the l 7000 module syntax int ReceiveResponseFrom7000_ms int iPort unsigned char cCmd long ITimeout int iChksum Header include 7188xb h Description After calling the SendCmdTo 000 function the ReceiveResponseFrom 000_ms function must be called except for commands that do not require a response iPort 1 for COM1 2 for COM2 etc cCmd The response received from the l 7000 module If checksum is enabled the function will check and l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 134 remove the checksum The CR is also removed ITimeout Sets the timeout The unit is ms iChecksum 1 for checksum enabled O for checksum disabled Return Value On success returns
97. r the I 7188XB D has been switched on disconnect the INIT pin from the GND pin otep 3 Open an MS DOS command prompt window using the steps shown bellow l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 91 Gy Set Program Access and Defaults ct CAWINDOWSYSystem22Wwmd exe ft Windows XP Version 5 1 2666 so Gee Copyuright 1985 2661 Microsoft Corp o Windows Update SS ats and Settings Administrator gt m UO Windows Catalog a Pragrams EC Documents AF Professional Window Lag OFF Administrat Cancel Browse m Turn OFF Computer ig Start bobbed gt S 6 01 PM step 4 Type cd c 7188XB Demo BC_TC Hello Hello_C then press lt Enter gt Assume user copy the 7188XB folder to C drive letter Refer to Step2 in Sec 2 1 CARWINDO WSS ystem32 cmd exe C Copyr iaht 1985 2001 Microsoft corp C Documents and Settings Administratol scd c 7188XB Demo BC_TC Hel lo Hello_c C 7188XB Demo BC_TC Hel 1lo Hel lo_c gt _ step 5 Execute the 7188xw exe application as shown in the following figure l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 92 ch TIBBSEW 1 32 COMI 115200 N 8 1 EC D C TS D DIR AF 1882 BiDemoiBC ICAHelloiHello C Dix c 7188XB Demo BC_TC Hel lo Hel lo_ gt 7188xw 7188x for WIN32 version 1 32 2006 10 17 By ICPDAS Tim Tsai Current set Use COMI 115200 N 8 1 AutoRun Autodownload f1les None Current work directory C M7188XBXDemoX
98. rmation Note For more l 7000 commands please refer to the user s manual for 7000 DIO l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 59 4 7 Using the Red LED and 7 SEG LED Display The I 7188XBD includes a 5 digit 7 segment LED together with a decimal point which can be switched on or off using software Each digit of the LED is numerically identified from left to right using the numbers 1 to 5 and are individually programmable which can be very useful in real world applications and can be used to replace a monitor or touch screen in many applications Before attempting to use the LED the Init8DigitLed function must first be called then the ShowSDigitLed function can be used to display data The code required to display 7188d on 5 digit 7 segment LED is as follows InitLib Initiate the 7188xb library Inits5DigitLed Show5DigitLed 1 7 Show5DigitLed 2 1 Show5DigitLed 3 8 Show5DigitLed 4 8 Show5DigitLed 5 13 The ASCII code for d is 13 Hefer to the demo programs in the CD Napdos 7188XABC 7188XB Demo BC_TC LED folder for more information Il 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 60 4 8 Accessing the I 7188XB D Memory 4 8 1 Using Flash Memory The I 7188XB D module contains 512K bytes of Flash memory which includes space reserved for the MiniOS7 The MiniOS7 occupies the OxFOOO segment So user can use the other segments whose total
99. s function Shows how to use the I 7188XB D timer function to send receive data to or from 7000 series modules These are demo programs for all I O XBoard expansion boards that are applicable 4 12 to the I 7188XB D l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 53 4 5 COM Port Comparison The I 7188XB D COM ports are as follows COM Port COMI 80188 s on chip UART 0 5 wire RS 232 Default or 2 wire RS 485 COM2 80188 s on chip UART 1 2 wire RS 485 The I 7188XB D COM Ports can be set as RS 232 or RS 485 as below OM Port Type wire RS 485 Data Data wire RS 2382 TXD RXD GND wire RS 232 XD RXD GND RTS CTS The programming required for the 16C550 is very different from the 80188 UART Interrupt handling on the 80188 is also very different from the 8259 on a PC Therefore the RS 232 application programs for PC are not executed in the I 7188XB D The software driver for the l 7188XB D is an interrupt driven library that provides a 1K QUEUE buffer for each COM Port The software is well designed and easy to use The software driver provides the same interface for all two COM Ports so each port can be used in the same way without any difficulty l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 54 4 6 Using the COM Ports The 7188XB D has two communication ports e COMI can act as either an RS 232 Default or RS 485 port RS 232 TXD RXD RTS CTS and GND
100. s lib 7188xbl lib files as follows InstallCOMO InstallCOM 1 InstallCOM2 ISCOMO ISCOM 1 IsSCOM2 ToCOMO ToCOM1 ToCOM2 HeadComO ReadCom1 ReadCom2 EEPROM WriteEEP ReadEEP EnableEEP ProtectEEP LED and 5 digit LED LedOn LedOff InitbDigitLed Show5DigitLedWithDot FlashReadld FlashErase FlashRead FlashWrite COM port Flash Memory TimerOpen TimeClose TimerResetVlaue TimerReadValue StooWatchReset stopWatchRead StopWatchStop GetFileNo GetFileName GetFilePositionByNo GetFilePositionByName Timer and Watchdog Timer n to 000 series sendCmdTo7000 ReceiveResponseFrom7000 Programmable I O SetDio4Dir SetDio4High SetDio4Low GetDio4 Others Note For a more detailed description of the functions please refer to Appendix D Library Function List l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 29 3 2 Compiler and Linker A C Language compiler must be used to develop any applications Valid compilers include BC 3 1 5 02 TC 1 01 TC 2 01 MSC MSVC Prior to version 1 52 ICP DAS suggests that BC 3 1 is used as the compiler as the libraries provided have been created using the BC 3 1 compiler Special attention should be paid to the following items before using the compiler to develop custom applications e Generate a standard DOS executable program e Set the CPU to 80188 80186 e Set the floating point to EMULATION if floating point computation is required Make sure n
101. s loldnamessibee po Miscellaneous Output gnare Default Libraries Specific Libraries to Ignore Prevent Use of Extended Dictionary Iw Distinguish Letter Case Step 7 Remove the OLOGO option from the miscellancous Category Linker Options Build Options C Debug Specific Release Specific Common ta Bath Uptions String LIB ser LIB afscr LIB oldnames LIB shboe NOL S TACK 8120 Cancel UNERR R N ESE OLOGO Hep Use Project Defaults Category Category Settings Miscellaneous Input Suppress Display of Sign On Banner Miscellaneous String OLOGY Output l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 150 File Edit View Dwaan Browse Debug Toole Options Window Help New pen Edit HELLO MAE lose Compile File Cth FS 43412 ha rn Altt Fa Cab F5 scan Dependencies scan All Dependencies ay lt 1 gt Output ox Initializing Compiling c N7188gza demo msasc helloshello c Linking Microsoft E Segmented Executable Linker Version 5 60 339 Dec 5 1994 Copyright C Microsoft Corp 1984 1993 All rights reserved Object Modules obj NOI STA CK 5120 ONERROR NOEXE HELLO OBJ Object Modules obj Eun File HELLO exe HELLO EEE Liszt File c HELLO map nul Libraries lib c mzeswvc lib Libraries lib c mevc mfc lib Libraries lib LIB 7188XAL LIEB Libraries lib oldnames Librari
102. stem has been reset by the WatchDog Timer oyntax int IsResetByWatchDogTime void Header include 7188xb h Description Returns 0 when true Example Please refer to EnableWDTI function for more detailed information l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 129 Type 7 Files GetFileNo Retrieves total number of files stored in the Flash memory GetFileName GetFilePositionByNo Uses the file number to retrieve the file position _ Uses the file number to retrieve the file information There are many other custom file functions available Please refer to the 7188xb h header file and the user manual on the enclosed CD which can be found at CD Napdos minios7 documenit lib manual for 7188xabcundex htm for more detailed for more detailed information GetFilelnfoByNo Note Ihe file system for MiniOS7 supports custom programs for reading files but does not support custom programs for writing files e GetFileNo Function Gets the total number of files stored in the Flash memory oyntax int GetFileNo void Header X include 7188xb h Description Returns the number of files Example Please refer to GetFilePositionByNo for more detailed information e GetFileName Function Uses the file index to get the file name oyntax int GetFileName int no char fname Header X4 include 7188xb h Description no The file index The first file is index 0 fname Buffer to store
103. step 3 In System variables choose the variable Path and then click on the Edit button step 4 Add the target directory to the end of the Variable value using a semi colon as a separator For example C TC BIN C TC INCLUDE Environment Variables Edit System Variable Variable name Path variable value esiGTKY2 Dlb CA TCIBIN i System variables Variable Value Comper CUWINDOWSIsvsEema3ztYcmd exe FP MO HOST C NG MLUPBER OF 2 4 Windows MT CAPROGRAe T Berland CBUILDe tiProj otep 5 Click the OK button and then restart your computer in order for your changes to take effect l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 37 3 3 4 Build and Execute the Program Step 1 Open the MS DOS command prompt window in the same way as you did in step 3 of the Install Turbo C version 1 01 instructions NOTE You must close the original MS DOS command prompt window first Step 2 Type d and then press Enter to enter D drive letter Step 3 Type cd 7188XB test and press lt Enter gt o EY 0 VWWINDOMS unc exe CC Copyright 1985 2001 Microsoft Corp C Documents and Settings wi c_tsa gt d D M3Qcd 188XB test D X7188XB test NOTE Assume there is a folder 7188XB test built under d There is a 7188xb h and 7188xbl lib in the 7188XB test folder Step 4 Type tc and press ENTER to run t
104. system date to the RTC oyntax int SetDate int year int month int day Header X include 7188xb h Description year 2000 2080 month 1 12 day 1 31 Return Value On success returns NoError On error returns DateError 18 Example Please refer to GetTime for more detailed information GetWeekDay Function Reads the weekday from the RTC syntax int GetWeekDay void Header X include 7188xb h Description Reads the weekday from the RTC Return Value 02 Sunday 1 6 gt Monday to Saturday Example Please refer to GetTime for more detailed information Note GetWeekDay does not check whether the weekday is correct or not only reads the value from the RTC When using the MiniOS7 l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 113 date command to set the date the MiniOS7 will calculate the correct weekday and set the RTC If SetDate is called it will also calculate the correct weekday and set the RTC However if SetWeekDay is called the function must calculate the correct weekday itself l 188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 114 Type 5 Flash Memory Function Description FlashWrite There are many other functions related to the Flash memory Please refer to the 7188xb h header file and the user manual on the enclosed CD which can be found at CD Napdos minios 7 document lib_ manual for 7188xabcWndex htm for more detailed information
105. t the program RestoreCom port uninstall the COM driver Use the port variable to switch from COM1 to COM2 simply change port 1 to port 2 If the program is set to use COM 1 the code can be altered as follows int quit 0 data InitLib Initiate the 7188xb library InstallCom1 115200L 8 0 1 install the COM driver while quit if lsCom1 check if any data is in the COM1 input buffer data ReadCom1 read data from COM ToCom1 data send data via COM 1 if data q quitz1 if q is received exit the program RestoreCom1 uninstall the COM driver 4 6 1 To print from the COM port The I 7188XB D library also supports functions such as printf from the standard C library to produce a formatted output The printCom function can be used for all COM Ports and printCom1 2 can be sued for individual ports Before using the printCom function the InstallCom function must first be called The code is shown below l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 56 int port 2 to use COM2 int i InitLib Initiate the 7188xb library InstallCom port 115200L 8 0 1 install the COM2 driver for iz0 1 lt 10 i printCom port Test dir n i print data from COM2 RestoreCom port uninstall the COM driver 4 6 2 To Use COM1 COM2 for an RS 485 Application COM1 COM2 is a 2 wire RS 4
106. t to read keyboard input from a Host PC 7188xw exe location The 7188xw exe is located in the CD Napdos MiniOS 7 utility folder or at http ftp icpdas com pub cd 8000cd napdos minios utility on the web 7188xw exe command line oe for MiniOS7 Description eee Uses COM of the Host PC Sets the Baud Rate for the COM port on the Host PC default is 115200 S sets the number of display rows on the screen default is 25 max is 50 F1 Shows the 7188xw exe Shows the 7188xw exe help messages s messages a Shows the 7188xw exe help messages using the Chinese Big5 Alt F1 character set e Shows the 7188xw exe help messages using the Chinese Ctrl F1 GB2312 character set l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 89 Alt 1 Uses COM on the Host PC A2 E TY T NT T Tr Alt A owitches between normal mode and ANSI Escape code support mode Alt_C Switches to command mode Supports commands b Sets a new Baud Rate for the COM ports on the Host PC c Uses COM on the Host PC n e o Sets the parity to none even odd 5 6 7 8 Sets the data bits to 5 6 7 8 p Sets working directory of the Host PC q Quits command mode Alt D Sets the date of the RTC to the date on the Host PC Alt T Set the time of the RTC to the time on the Host PC Used to download a file to memory Alt E should be pressed only Alt E after the Press ALT E to download file message is shown on the scree
107. ta 0xAA55 Refer to the demo programs in the CD Napdos 7188XABC 7188XB Demo BC_TC Memory folder for more information 4 8 3 Using EEPROM The EEPROM is designed to store data that is not changed frequently such as e Module ID configuration settings e COM port configuration settings e Small databases The erase write cycle of the EEPROM is limited to1 000 000 erase write cycles so it should not be changed frequently when testing The EEPROM can be erased written in a single byte so it is very useful in real world applications The 1I 7188XB D has 2K bytes of EEPROM memory containing 8 blocks and each block contains 256 bytes giving a total of 2048 bytes of EEPROM memory Normally the EEPROM is in protected mode by default meaning that no data can be written to the EEPROM The EE WriteEnable function must be called to unprotect it before writing l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 63 any data For example To write data to EEPROM block1 address 10 first call the EE WriteEnable function The code is shown below int data 0x55 data2 InitLib Initiate the 7188xb library EE WriteEnable EE MultiWrite 1 10 1 amp data EE WriteProtect EE MultiRead 1 10 1 amp data2 now data2 data 0x55 Note To write an integer to EEPROM the EE_WriteEnable function must be called twice in the same manner as writing data to NVRAM Refer to the demo programs
108. ta currently stored in buffer of COMI Assigned to COM1 Example Please refer to InstallCom1 for an example e ToCom Function Sends data to the COM Port The COM Port number is not assigned oyntax int ToCom int port Header include 7188xb h Description Sends data to the COM Port The COM Port number is not assigned and can be modified using the port parameter port assigns the COM Port number Example Please refer to InstallCom for an example e ToCom1 Function Sends data to COM1 syntax int ToCom1 void Header include 7188xb h Description Sends data to COM1 Assigned to COM1 Example Please refer to InstallCom1 for an example printCom Function Prints data to COM and PC The COM Port number is not assigned syntax int printCom int port char fmt l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 107 Header include 7188xb h Description Prints data from the COM Port buffer The COM Port number is not assigned and can be modified using the port parameter Produces a formatted output similar to printf from the standard C library Example Please refer to InstallCom for an example printCom1 Function Prints data from the buffer of COM1 oyntax int printCom 1 char fmt Header X include 7188xb h Description Prints data from the buffer of COM1 Produces a formatted output similar to printf from standard C
109. utput e From an I O Expansion Bus e 000 series modules can directly control up to 256 modules giving thousands of I O points l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 75 5 2 Local Real Time Controller RTC I 7188XB D cC BM address n 7000 series module 7000 series module 7 In this configuration the 7000 series modules act as slave devices The control programs are implemented in the Host PC The operation steps are as follows e The PC sends commands to the 7000 series modules and receives some input data e The PC analyzes this input data and generates some output data e The PC sends commands to the 7000 series modules as output data If there are hundreds of 7000 series modules it will take the Host PC a long time to analyze and control these modules so the control program can be implemented in a local I 7188XB D The PC then only has to send control arguments to the I 7188XB D and the I 7188XB D will control the local 7000 series modules based on these control arguments In this way thousands of 7000 series modules can be controlled by the PC via the I 7188XB D some control functions are timing critical so the local l 7188XB D can handle these functions in real time without the need for control by Host PC l 7188XB Series User s Manual Ver 1 0 Apr 2007 7MH 020 10 76 5 3 Remote Local Controller I 7188XB D X504 fl 7000 series module 7000 series modul
Download Pdf Manuals
Related Search
Related Contents
ELECTRONIC SCALE BWB-800MA SEPARATE 「勤次郎JustTime-GPS」 ご注文フォーム MARLON 200 AUTO CRIMPER Origin Storage KB-65JY3 notebook spare part LPC Demo Project (MSD) Copyright © All rights reserved.
Failed to retrieve file