Home
User`s Manual
Contents
1. Addre l v Go System Tasks ff Hide the contents of L Program Files this drive _ RECYCLER Step2 In the folder MyFirm create a c file and name it as MyFirm c Design the MyFirm c file as follows The 4 callback functions must be used in user defined function MyFirm c Notepad DER File Edit Format Yiew Help KiloLoopcnt global variable lt fvoid UserDPRAMIrgFuncCunsigned char INTT mDst be cal f do nothing lt fvoid UsercanIrgFuncCunsigned char INTT musD be called f do nothing void usertnitFunc void Dimust be called Print mMyFirmware is running r n DebugPrint C MyFirmware is running rn C void UserLoopFunc void must be called if Loopcnt LOOoUL Ki loLoopcnt Print Loop is running lu k Pimes A Se MELE OSa CHES DebugPrint Loop is running lu k times r n KiloLoopcnt Loopcnt 0 I 8120W User s Manual Version 1 02 June 9 2009 44 Step3 Copy 186COMM Iib file and 186COMM h file into MyFirm folder Users can find them with version 1 03 in the path CAN SlotModule l8120W Demos For_User_Defined_Firmware Firm_Lib ver_103 in Field Bus CD File Edit Back P S pa Search mi Folders E View Favorites Tools Help 186Comm h C Header file 8 KB Other Places 186COMM LIB LIB File 79 KB B Firm_Lib B My Documents O Shared Documents ig My Computer My Network Plac
2. int EnableCyclicTxMsg unsigned char Handle int DisableCyclicTxMsg unsigned char Handle void ResetCyclicTxBuf void void SystemHardwareReset void void SystemInit void int GetLibVer void void RefreshWDT void void UserInitFunc void void UserLoopFunc void Table 5 1 Functions List of Firmware Library For User defined Firmware I 8120W User s Manual Version 1 02 June 9 2009 105 5 1 1 L1Off Description Turn off the yellow LED of I 8120W Syntax void L1Off void Parameter None Return None 5 1 2 L1On Description Turn on the yellow LED of I 8120W Syntax void L1On void Parameter None Return None I 8120W User s Manual Version 1 02 June 9 2009 106 5 1 3 L2Off Description Turn off the green LED of I 8120W Syntax void L2Off void Parameter None Return None 5 1 4 L2On Description Turn on the green LED of I 8120W Syntax void L1 Off void Parameter None Return None I 8120W User s Manual Version 1 02 June 9 2009 107 5 1 5 DPRAMInttToHost Description Call this function to signal the users applications an interrupt When users applications receive the interrupt signal from the user defined firmware check the value of interrupt indicator to know the meaning of this interrupt Therefore the user defined firmware can communicate with the Windows applicatio
3. times times He be times o s s s is s s s s s PIFF e running times pest I 8120W User s Manual Version 1 02 June 9 2009 52 4 APIs for Windows Application In this chapter the APIs for both default firmware and user defined firmware are described The content includes the APIs introductions error code description and the simple method of troubleshooting It is helpful to development users application The section 4 1 shows the list and information of all APIs supported by I 8120W The section 4 2 shows the explication of the return codes of the API functions It can help users to shoot their troubles when building an application 4 1 API Definitions and Descriptions All the functions provided by I 8120W are listed in the following table and the details for each function will be presented in the following sub section Function definition WORD 18120_GetDIlVersion void int 18120 AdujstDateTime BYTE SlotNo int 18120 _Reset BYTE SlotNo int 18120_Init BYTE SlotNo int 18120 HardwareReset BYTE SlotNo int 18120 _Check186Mode BYTE SlotNo BYTE Mode int 18120_Status BYTE SlotNo BYTE bStatus int 18120_AddCyclicTxMsg BYTE SlotNo BYTE Mode DWORD MsgID BYTE RTR BYTE DataLen BYTE Data DWORD TimePeriod DWORD TransmitTimes BYTE Handle int 18120_DeleteCyclicTxMsg BYTE SlotNo BYTE Handle int 18120 EnableCyclicTxMsg BYTE Slot
4. 18120 NoFilelnside Update the default firmware again by using Utility if it is used Confirm if user defined firmware is in I 8120W or not by using Utility 18120 DownloadFailure Close Utility and try to update the firmware one minute later Call your distributor to solve this problem 18120 _EEPROMDamage Call your distributor to solve this problem 18120 _NotEnoughSpace 1 8120W User s Manual The file size of the user defined firmware is too large to put it into the I 8120W Version 1 02 June 9 2009 100 Error ID Error Description Troubleshooting Close Utility and try to update firmware one 18120_StillDownloading minute later Call your distributor to solve this problem Close Utility and try to update the firmware 18120 _BoardModeError one minute later 18120 SetDateTimeFailure Call your distributor to solve this problem Call the function 18120 Config or 18120 _ConfigWithoutStruct before you call the function which gives you this return code 18120_SlotNotConfig Call the function 18120 Init at the start of 18120 _SlotNotlnit IRSE application 18120_ReplyError Call your distributor to solve this problem Table 4 7 Return Code Troubleshooting Note If users problem can t be fixed after following the recommended methods Please contact your distributor or email to service icpdas com to solve the problem I 8120W User s Manual Ver
5. Address input The specified address of DPRAM where users want to read data Data output The address of a variable applied to receive the data obtained by the 18120 DPRAMReadWord Return 18120_NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 DpramOverRange The Address of input parameter is over 6998 18120 SlotNotinit Call this function without calling the function 18120 _Init before I 8120W User s Manual Version 1 02 June 9 2009 92 4 1 37 18120_DPRAMReadDword lt For user defined firmware gt Description Read one double word data from the specified address of DPRAM of 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 DPRAMWriteDword BYTE SlotNo WORD Address DWORD Data Parameter SlotNo input 8120W slot No 0 7 Address input The specified address of DPRAM where users want to write data Data output The address of a variable applied to receive the data obtained by the function 18120 _DPRAMReadDword Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 DpramOverRange The Address of input parameter is over 6996 18120 SlotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 93 4 1 38 18120_DPRAMReadMultiByte lt For user defined firmware gt Description Read multi byte
6. Configure the baud message filter of SJA1000 After calling this function the I 8120W can start to send receive CAN messages to from the CAN network Syntax int 18120_Config BYTE SlotNo ConfigStruct CanConfig Parameter SlotNo input 8120W slot No 0 7 CanConfig input The address of a ConfigStruct structure variable used to configure the I 8120W The ConfigStruct structure is defined as following typedef struct BYTE AccCode 4 BYTE AccMask 4 BYTE BaudRate BYTE BT0 BT1 ConfigStruct AccCode 4 Acceptance code of CAN controller AccMask 4 Acceptance mask of CAN controller The AccCode is used for deciding what kind of ID the CAN controller will accept The AccMask is used for deciding which bit of ID will need to check with AccCode If the bit of AccMask is set to 0 it means that the bit in the same position of ID need to be checked and that ID bit value needs to match the bit of AccCode in the same position The regulations for 29 bit ID and 11 bit ID is shown in the table on the next page I 8120W User s Manual Version 1 02 June 9 2009 74 AccCode and AccMask Bit Position Filter Target high byte of the high word bit7 bitO bit10 bit3 of ID low byte of the high word bit7 bit5 bit2 bitO of ID low byte of the high word bit4 RTR low byte of the high word bit3 bitO no use high byte of the low word bit7 bitO bit7 bitO of 1st byte data low byte of the low word bit7
7. The block No is over 6 or the address is over 256 I 8120W User s Manual Version 1 02 June 9 2009 129 5 1 36 EEPROMWriteMultiByte Description Use this function to write some data to specified address of EEPROM If system has no power the data stored in EEPROM will not disappear Syntax int EEPROMWriteMultiByte unsigned int Block unsigned int Address char Data unsigned int DataNum Parameter Block input The EEPROM block No The range is from 0 to 6 Address input The EEPROM address where users will write the data Each block has 256 bytes Therefore the range of this parameter is from 0 to 255 data output The start address of a byte array used to store the data written to EEPROM DataNum input The parameter indicates that how many data users want to write Return _NO_ERR OK _EEPROM_ACCESS_ ERROR Can t write data to specified EEPROM address The EEPROM may be damaged _EEPROM_OVER_RANGE The block No is over 6 or the address is over 256 Or the specified range of writing data is over the block 6 and address 255 I 8120W User s Manual Version 1 02 June 9 2009 130 5 1 37 UserCANirqFunc lt must be called once gt Description This is a callback function and must be call once in user defined firmware When the firmware library receives an interrupt signal from CAN controller this function will pass the interrupt indicator of CAN controller The interrupt in
8. include MyDemo h in hHyDemoaDdig h i WinPACSDK h 18126 h ifdef DEBUG I 8120W User s Manual Version 1 02 June 9 2009 30 Step16 When finishing the program Click Build Set Active Configuration to select the project configuration to Win32 WCE ARMV4l Release E MyDemo Microsoft eMbedded Visual C MyDemoDle cpp B File Edit Yiew Insert Project Guid Yr cols Window Help 2 mj g e B Compile MyDemoDlg cpp Ctrl F7 Build MyDemo exe F ThyGemo big TIAI c kki Rebuild all MyDemo PAC270 Batch Build Clean 2 MyDemo files Start Debug lt 9 Source Files Update Remote Output File s is Boema T Bente moemoe 4 MyDemoDlg cp Ctrl FS lt MyDemo Yin32 WCE ARMYAI Release MyDemo W A ARMY AI Debug File Edit Yiew Insert project guild Tool Window Help 8 g y Ra B Compile MyDemoDlg cpp Ctrl F7 Build MyDemo exe F7 CMyDemoDlg All lt Rebuild all faa an Inannzn Ratrh Puiild Step18 Use ftp method to copy the MyDemo exe and 18120 dll to your WinPAC The MyDemo exe and 18120 dll must be put in the same folder You can find the 18120 dll in the following path of CD CAN SlotModule 18120W Demos WinPAC _Library Ver_200 Then run the MyDemo exe on the WinPAC If you want to know the details about how to use WinPAC please refer to the following website http www icpdas com products PAC winpac downlo
9. 02 June 9 2009 99 4 2 APIs Return Codes Troubleshooting Error ID Error Description Troubleshooting 18120 NoError 18120 _SlotNumberError Set the SlotNo parameter of function to match the DIP switch No Each 1 8120W PISO DNM DM or PISO CPM D T has unique DIP switch No Unplug the I 8120W and plug it again and turn on your PC until find it in the list of hardware management of Windows 18120_InitError Retry the function again Call the function 18120 _Init and configure I 8120W again 18120 SoftBufferlsEmpty Wait for a while and call the function again 18120 SoftBufferlsFull Use 18120 _ClearBufferStatus to clear the status of buffer overflow Reduce the bus loading of CAN network 18120_ TimeOut Wait for a while and call the function again Call the function 18120 _Init and configure I 8120W again Update default firmware again by using Utility if default firmware is used Confirm if user defined firmware is in I 8120W or not by using Utility 18120_SetCyclicMsgFailure Check if users already use 5 the cyclic messages Call the function 18120 _Init and configure I 8120W again 18120 DpramOverRange Check the Address or DataNum parameters of function if each of them or the sum of them exceeds 6999 18120 NoDpramCmd Wait for a while and call the function again 18120 ModeError Update the default firmware again by Utility tool if it is used
10. 10ms Provide 5 sets of cyclic transmission Timestamp of CAN message with 1ms precision 80186 80 MHz CPU 8 Kbytes DPRAM inside RTC Real Time Clock inside Allow user to program user defined firmware in 8120W Firmware updatable eVC demos and libraries are given C C function libraries of firmware is given I 8120W User s Manual Version 1 02 June 9 2009 7 TA Q Specifications CAN controller Phillips SJA1000T CAN controller frequency 16 MHz CAN transceiver Phillips 82C250 Follow IS011898 2 specification One CAN communication port Compatible with CAN specification 2 0 parts A and B Jumper select 120Q terminator resistor for CAN bus Provide default baud rate 10 kbps 20 kbps 50 kbps 125 kbps 250 kbps 500 kbps 800 kbps and 1 Mbps Allow user defined baud rate Connector 5 pin screw terminal connector Isolation voltage 2500Vrms on CAN side 80186 80 MHz CPU 8 Kbytes DPRAM 1 Kbytes for system 512 Kbytes Flash memory 128 Kbytes for system others for firmware 512 Kbytes SRAM RTC real time clock inside 2 Kbytes EEPROM 256 bytes for system 31 bytes NVRAM 3 indication LED Red LED for power Yellow and Green LEDs for users Power requirements 2W Environment Operating temp 25 C 75 C Storage temp 30 C 85 C Humidity 5 95 RH non condensing I 8120W User s Manual Version 1 02 June 9 2009 8 1 4 Product Check List Besides this manual the package i
11. BYTE Data int 18120_DPRAMWriteByte BYTE SlotNo WORD Address BYTE Data int 18120_DPRAMWriteWord BYTE SlotNo WORD Address WORD Data int 18120_DPRAMWriteDword BYTE SlotNo WORD Address DWORD Data int 18120 _DPRAMWriteMultiByte BYTE SlotNo WORD Address BYTE Data WORD DataNum int 18120 DPRAMReadByte BYTE SlotNo WORD Address BYTE Data int 18120 _DPRAMReadWord BYTE SlotNo WORD Address WORD Data int 18120 _DPRAMReadDword BYTE SlotNo WORD Address DWORD Data gt gt gt gt II gt gt int 18120 _DPRAMReadMultiByte BYTE SlotNo WORD Address BYTE Data WORD DataNum gt int 18120 DPRAMMemset BYTE SlotNo WORD Address BYTE Data WORD DataNum gt int 18120 _ReceiveCmd BYTE SlotNo BYTE Data WORD DataNum int 18120 SendCmd BYTE SlotNo BYTE Data WORD DataNum I 8120W User s Manual Version 1 02 June 9 2009 54 Function definition int 18120_InstallUserlSR BYTE SlotNo void UserlSR BYTE SlotNo BYTE InttValue int 18120 RemoveUserlSR BYTE SlotNo Table 4 1 1 8120W Windows APIs List Note In table 3 1 the mark and A indicate the valid condition of API functions The function marked by or A presents that this function is useful when the default firmware or user defined firmware is inside the I8120W respectively If users use default firmware all of the functions marked by could be applied However if users desig
12. C Proqram Files Windows CE Tools wce500 PAC270 mfc include _ClPrmatam Anny an N APA ha 1 Le Choose Directory Directory name TOOLS WCESO00 PAC2 7 0 ICPDAS INCLUDE Cancel amp ch Network amp Program Files Windows CE Tools wee500 E PAC270 ta DQ Drives Ec I 8120W User s Manual Version 1 02 June 9 2009 29 Step14 Select the Library files for the Show directories combo box Refer the Step 13 to set the Directories as follows C Program Files Windows CE Tools wce500 PAC270 lib ARMV41 C Program Files Windows CE Tools wce500 PAC270 mfc lib ARMV4I C Program Files Windows CE Tools wce500 PAC27O ati lib ARMV41 C Program Files Windows CE Tools wce500 PAC270 ICPDAS Iib Options Tabs Debug Compatibility Download Build Directories So Platform CPUs Show directories PAC270 Win32 WCE ARMYAI CiLibrary files gt CAPRCSRAM FILESIWINDOWS CE Coe imma CE t Step15 Program users application in the eVC IDE When programming the MyDemoDlg cpp users must include the WinPACSDK h and 18120 h to use APIs of WinPAC and 18120 The syntaxes are shown below include WinPACSDK h include 18120 h aj i Workspace MyDemo 1 project s MyDemo files Source Files A MyDemo cpp A MyDemo rc 4 MyDemoDig cpp StdAfx cpp 2 18120 1ib MyDemoDlg cpp impl ff include stdafx h
13. CAN Message 11 bit ID ID Hex Len Data Hex separated by space 20 bit 1D BFF RTR E FF FF FF FF FF FF FF FF I 8120W User s Manual Version 1 02 June 9 2009 32 If users want to analysis the CAN network please set the proper parameters of message filter baud and message format then click the Initialize button For the detail about how to use message filter and user defined baud please refer to the description of 18120 Config function Afterwards the utility will be shown as follows Filte Acc Mask FFFFFFFF CAN Statt SOK bps CAN Status Hex Clear Sampan Rx Msg Cnt e Poot d 250K bps 500K bps 800K b faTR oo 01 b2 03 dino bos 10K bps 20K bps Rx Msg Buffer Tx Msg Buffer Time After finishing the configuration users can see the CAN status is 0x0C if CAN controller works normally The Rx and Tx message buffers status also shows green light If you get the red lights it means the message buffers are overflow When 18120W_ Utility receive any CAN message the value of Rx Msg Cnt will be increased 1 8120W Utility Ver1 00 Filter Setting Hex Baud Setting Hex Slot NO stot 4 4 g Hex g Hex Msg Format a Acc Code 00000000 Baud 125Kbps v Hex O Dec Update Firmware Acc Mask FFFFFFFF BTO FF BTL FF O asc CAN Enable Sys Ms ee ZN Status Hex Ox00 Clear Status Disable Sys Msg Rx Msg Cnt oo000000004 NO mode m RTR
14. COM port of PC via the debug cable shown in section 2 2 execute the 7188xw exe Windows program Then a character keyed from keyboard will be caught by this function Syntax int GetKbhit void Parameter None Return The return code is the received character from keyboard input when 7188xw exe is executed and focused I 8120W User s Manual Version 1 02 June 9 2009 118 5 1 19 Print lt assist with debug cable and 7188xw exe gt Description This function is used for debugging of the user defined firmware Call this function to send the debug information to the 7188xw exe The function Print is similar with standard C function printf When users connect the debug port of I 8120W with the available RS 232 COM port of PC via the debug cable shown in section 2 2 execute the 7188xw exe Windows program Then the debug information sent by this function will be put on the screen of the 7188xe wxe Syntax int Print const char fmt Parameter fmt input The data format of keyboard input Please refer to standard C function printf to know how to use this parameters Return If it is successful the return code is a non zero value except the value of EOF defined by standard C C language 5 1 20 GetTime Description Use this function to get the current time from real time clock Syntax void GetTime int hour int minute int sec Parameter hour output The address of a varia
15. MiniOS7 OS Figure 3 2 8120W Default Firmware Software Architecture In some special cases 8120W provides the flexibilities to arrange the user defined firmware This feature may be helpful and powerful for some applications which have complex application protocols or need to improve the system efficiency Users can interpret the raw CAN messages by the pre defined application protocols on MiniOS7 platform and feedback the useful and simplified data to users Windows applications This software architecture can I 8120W User s Manual Version 1 02 June 9 2009 18 have the real time processing feature increase the execution performance and efficiently reduce the WP 8000 CPU loading The software architecture is shown below Windows CE Linux MiniOS7 18120 dll I 18120 a 18120 lib Figure 3 3 8120W User defined Firmware Software Architecture I 8120W User s Manual Version 1 02 June 9 2009 19 3 2 Application Programming With Default Firmware This section is only for default firmware of I 8120W It is useless if users want to develop their user defined firmware of I 8120W Figure 3 4 is a standard procedure for receiving a CAN messages This procedure let users obtain the CAN messages from CAN bus easily Figure 3 5 presents the Send CAN Message procedure When users want to design their application by using the APIs of 18120 dIl on WinPAC LinPAC IPAC this flowchart may be a good reference
16. NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 _InitError The l 8120W replies configuration error 18120 SlotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 76 4 1 23 18120_ConfigWithoutStruct lt For default firmware gt Description This function is similar with the function 18120 Config The difference is the input parameters of the function This function uses no structure parameter so that it is easy to be applied in some program environment such as VB Net Therefore about the input parameters of this function please refer to the function 18120 Config function for the details Syntax int 18120 ConfigWithoutStruct BYTE SlotNo DWORD AccCode DWORD AccMask BYTE BaudRate BYTE BTO BYTE BT1 Parameter SlotNo input l 8120W slot No 0 7 AccCode input Acceptance code of CAN controller AccMask input Acceptance mask of CAN controller BaudRate input The baud indicator of CAN controller BTO input User defined baud BT1 input User defined baud For more information about these parameters please refer to the section 3 2 28 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 _InitError The l 8120W replies configuration error 18120 S
17. OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 SoftBufferlsFull The transmission software buffer is overflow 18120 _SlotNotConfig Call this function without calling the function I8120 Config or 18120 ConfigWithoutStruct before 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 83 4 1 28 18120_SendWithoutStruct lt For default firmware gt Description Send a CAN message to software transmission buffer When the CAN bus is idle this CAN message will be sent to CAN network This function is similar with the function 18120 SendMsg The difference is that this function doesn t use any structure parameter It is easy to use in some program environment such as VB Net Note that if users make some mistakes of CAN bus wiring and configuration the CAN messages may not be transmitted successfully In this case the messages sent by users will be put in the transmission buffer Users can use the function 18120 _IsTxTimeout or 18120 Status to check if any error happens Syntax int 18120 SendWithoutStruct BYTE SlotNo BYTE Mode DWORD MsgID BYTE RTR BYTE DataLen BYTE Data Parameter SlotNo input 8120W slot No 0 7 Mode input O for 11 bit message ID 1 for 29 bit message ID MsgID input CAN message ID RTR input O for remote transmit request
18. a wide range of CAN applications Besides I 8120W uses the NXP SJA1000T and transceiver 82C250 which provide both CAN 2 0A and 2 0B specific re transmission function bus arbitration and error detection By owing to the benefits of WinPAC LinPAC and iPAC series MCU without increasing the CPU loading heavily it is a powerful one CAN port programmable device server by driving the CAN port of I 8120W with dual port RAM Therefore Users can combine the advantage of WinPAC LinPAC and iPAC series MCU with I 8120W and apply them on various industrial applications PISO CAN series cards M100U 1 8120W X 9 S S O CAN Sensor I 8120W User s Manual Version 1 02 June 9 2009 6 CAN Device 1 2 Features Support WinPAC 8000 series MCU driver for LinPAC and iPAC series MCU will be available soon Follow 1S011898 2 specification NXP SJA1000T CAN controller NXP 82C250 CAN transceiver CAN controller frequency 16 MHz 2500Vrms photo isolation protection on CAN side Switch for 1200 terminator resistor of CAN bus One CAN communication port Compatible with CAN specification 2 0 parts A and B Provide default baud rate 10 kbps 20 kbps 50 kbps 125 kbps 250 kbps 500 kbps 800 kbps and 1 Mbps Allow user defined baud rate 2048 records reception buffer and 256 records transmission buffer Cyclic transmission precision 0 5ms precision when cyclic time is below 10ms 1 error when cyclic time exceeds
19. and click OK button to add the library file of 18120W into MyDemo project Insert Files into Project Lookin EQMyDemo o y e CF EB Qarmvaidbg 18120 lib flenme SSK Fies of voe LT Files will be inserted into folder titled Source Files in projec I 8120W User s Manual Version 1 02 June 9 2009 27 Step11 After finishing the Step 10 the tree view of File View is shown below MyDemo PAC270 Win32 sall i Workspace MyDemo 1 project s 2 MyDemo files MyDemo cpp MyDemo rc a MyDemoDlg cpp d 5 StdAfx cpp S rader ries MyDemo h MyDemoDIlg h newres h Resource h StdAfx h 59 Resource Files ReadMe txt Resou Step12 Click the Tools Options to set the include and library directory E MyDemo Microsoft eMbedded Visual C MyDemoDlg cpp iB File Edit Yiew Insert Project Bull Tools window Help a cab E Wg y P y Source Browser cMyDemoDIg All class Alt F12 A Dor ec Dit Error Lookup Cones pace7o 7 Remote Call Profiler WCES00 _ Remote File Viewer WCES00 Workspace c e MyDemo files E MyDemo cpp MyDemo rc MyDemoDlg cpp StdAfx cpp 5 18120 lib 4 Header Files E MyDemo h MyDemoDlg h E newres h Resource h StdAfx h Resource Files ReadMe txt Es Es E m8 Class 1 8120W User s Manua
20. bitO bit7 bitO of 2nd byte data Table 4 4 AccCode and AccMask Definition For 11 bit ID AccCode and AccMask Bit Position Filter Target high byte of the high word bit7 bitO bit28 bit21 of ID low byte of the high word bit7 bitO bit20 bit13 of ID high byte of the low word bit7 bitO bit12 bit5 of ID low byte of the low word bit7 bit3 bit4 bitO of ID low byte of the low word bit2 RTR low byte of the low word bit1 bitO no use Table 4 5 AccCode and AccMask Definition For 29 bit ID For example In 29 bit ID message Array 0 Array 1 Array 2 Array 3 AccCode 00h 00h 00h AOh AccMask FFh FFh FFh 1Fh ID bit bit28 bit21 bit20 bit13 bit12 bit5 bit4 bitO ID Value XXXXXXXX XXXXXXXX XXXX XXXX 101xx willbe accepted Note The mark x means don t care And the mark h behind the value means hex format I 8120W User s Manual Version 1 02 June 9 2009 75 BaudRate Value Description User defined baud BTO BT1 are needed 10 K bps 20 K bps 50 K bps 125 K bps 250 K bps 500 K bps 800 K bps 8 1000 K bps Table 4 6 Relation Between BaudRate value and Baud NIL OO oa AJOJN gt BTO BT1 User defined baud rate used only if BaudRate 0 For example set BTO 0x04 and BT1 0x1C then baud setting for the CAN controller is 100Kbps For more detailed baud setting please refer to manual of SJA1000 Return 18120
21. function T_StopWatchContinue to enable this timer counter again If users want to use more than one stopwatch just input the different variable of structure STOPWATCH into these 4 functions One structure variable will be mapped to one stopwatch The time unit of these 4 functions and the members of STOPWATCH structure are millisecond Syntax void T_StopWatchStart STOPWATCH sw unsigned long T_StopWatchGetTime STOPWATCH sw void T_StopWatchPause STOPWATCH sw void T_StopWatchContinue STOPWATCH sw Parameter sw output The address of a STOPWATCH structure variable applied to describe the stopwatch The member of STOPWATCH structure is shown as following typedef struct unsigned long ulStart unsigned long ulPauseTime unsigned int uMode STOPWATCH Parameter ulStart obtains the start time of stopwatch Parameter ulPauseTime will return the last pause time of stopwatch Parameter uMode returns the status of the stopwatch If uMode is 0 it means that the stopwatch pauses If uMode is 1 the stopwatch is running Return The return code of T_StopWatchGetTime is the current time counts after the stopwatch started I 8120W User s Manual Version 1 02 June 9 2009 125 5 1 32 T CountDownTimerXXxXX series functions Description Call this function to use a countdown timer There are 5 functions for countdown timer operation When users want to start a countdown timer the function T_CountDownTimerStart must
22. g Hex Msg Format Acc Code 00000000 Baud 125K bps v Hex OQ Dec Update Firmware Acc Mask FFFFFFFF BTO FF Ti FF G asci CAN Status Enable Sys Ms z ys TU CaN Status Hex oxoc Clear Status Rx Msg Buffer a Disable Sys Msg Rx Msg Cnt 0000000006 Reset Counter Reset Counter Clear Clear Tx Msg Buffer I E FF Fe ee 000 2 04 123 22 33 44 77 8 0210288 001 2 04 321 0224161 002 2 08 1FFFFFFF 45 56 67 78 89 0236729 003_ 2 08 _ 12345678 0246921 V Show message on the list Y SaveToFile Send CAN Message 11 bit ID ID Hex Len Data Hex separated by space gt C zobitip F IRR B FR FF FF FF FF FF FF FF Send I 8120W User s Manual Version 1 02 June 9 2009 34 If users want to stop the data logger disable the SaveToFile checkbox At the same time the logger file will be shown on the same path of the 1I8120W_ Utility Coles LI 4b cM1s107 18120 18120W_ log_332008 20090303 I 8120W Utility Yer1 00 Filter Setting Hex Baud Setting Hex See sot v g Hex g Hex Msg Format Acc Code fooocooco Baud 125Kbps v Hex Dec Update Firmware Acc Mask FFFFFFFF BTO FF BT1 FF Jasc CAN Status Enable Sys Ms d CaN Status Hex oxac Clear Status oS eS Disable Sys Msg em Rx Msg Cnt 0000000006 Reset Counter Clear Tx Msg Buffer Sl 2 04 123 li 2 3 4 3S 66 77 88 0210288 2 04 321 0224161 2 08 1FFFFFFF 67 78 89 0236729 2 0B 12345678 02469
23. is used for deciding what kind of ID the CAN controller will accept The AccMask is used for deciding which bit of ID will need to check with AccCode If the bit of AccMask is set to 0 it means that the bit in the same position of ID need to be checked and that ID bit value needs to match the bit of AccCode in the same position AccCode and AccMask Bit Position Filter Target high byte of the high word bit7 bitO bit10 bit3 of ID low byte of the high word bit7 bit5 bit2 bitO of ID low byte of the high word bit4 RTR low byte of the high word bit3 bitO no use high byte of the low word bit7 bitO bit7 bitO of 1st byte data low byte of the low word bit7 bit0 bit7 bitO of 2nd byte data Table 5 3 AccCode and AccMask Definition For 11 bit ID AccCode and AccMask Bit Position Filter Target high byte of the high word bit7 bitO bit28 bit21 of ID low byte of the high word bit7 bitO bit20 bit13 of ID high byte of the low word bit7 bitO bit12 bit5 of ID low byte of the low word bit7 bit3 bit4 bitO of ID low byte of the low word bit2 RTR low byte of the low word bit1 bitO no use Table 5 4 AccCode and AccMask Definition For 29 bit ID I 8120W User s Manual Version 1 02 June 9 2009 134 For example In 29 bit ID message AccCode 00h 00h 00h AOh AccMask FFh FFh FFh 1Fh ID bit bit28 bit21 bit20 bit13 bit12 bit5 bit4 bitO ID Value XXXX XXXX XXXX XXXX XXXX XXX
24. l8120W WinPAC CANopen l8120W WinPAC DevNet l8120W WinPAC HostWDT l8120W WinPAC 1 8120W User s Manual gt 8120W demo programs gt Folder for user defined firmware gt Firmware library of 8120W gt Demo for getting CAN messages gt User defined firmware for 8120W gt Corresponding application for WinPAC gt Demo for sending CAN messages gt User defined firmware for 8120W gt Corresponding application for WinPAC gt Demo for a basic CANopen application gt User defined firmware for l 8120W gt Corresponding application for WinPAC gt Demo for a basic Device application gt User defined firmware for I 8120W gt Corresponding application for WinPAC gt Demo of watchdog between Host and I 8120W gt User defined firmware for I 8120W gt Corresponding application for WinPAC Version 1 02 June 9 2009 43 3 6 User defined Firmware Programming Here it is considered that how to build an execution file with 186COMM lib by using TC 1 01 compiler It may be a good model for development a user defined firmware Before starting the step by step procedure users need to install TC 1 01 Users can free download the TC 1 01 through the website http www icpdas com download download list htm Step1 Create a folder named MyFirm in the C disk Local Disk C Sees File Edit View Favorites Tools Help ay Back gt wi P Search m Folders E
25. of supported baud They are 5K 10K 20K 25K 50K 100K 125K 200K 250K 500K 800K 1M bps If these bauds can not satisfy set this parameter 0 and define the BTO and BT1 of SJA1000 BTO input User defined baud BT1 input User defined baud For the more information about how to use BTO and BT1 please refer to the data sheet of SJA1000 Return _NO_ERR OK _CAN_CHIP_SOFT_RESET_ERR SJA1000 can t be reset by software The CAN controller may be damaged I 8120W User s Manual Version 1 02 June 9 2009 132 5 1 40 GetCANBaud Description Get the current CAN baud of CAN controller Syntax void GetCANBaud unsigned long Baud char BTO char BT1 Parameter Baud output The address of a variable used to obtain the baud of CAN controller If this parameter is 0 the BTO and BT1 are useful BTO output The address of a variable used to get the BTO value obtained from SJA1000 BT1 output The address of a variable used to get the BT1 value obtained from SJA1000 For more information about how to use BTO and BT1 please refer to the data sheet of SJA1000 Return None I 8120W User s Manual Version 1 02 June 9 2009 133 5 1 41 SetCANMask Description Set the message mask of CAN controller Syntax int SetCANMask long AccCode long AccMask Parameter AccCode input Acceptance code of CAN controller AccMask input Acceptance mask of CAN controller The AccCode
26. software buffer and transmission software buffer of the I 8120W If the hardware buffer of SJA1000 is overflow call this function will also reset the SJA1000 Syntax int 18120 ClearBufferStatus BYTE SlotNo Parameter SlotNo input 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 SlotNotConfig Call this function without calling the function 18120 Config or 18120 ConfigWithoutStruct before 18120 _SlotNotInit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 72 4 1 21 18120 _ClearDataOverrun lt For default firmware gt Description Clear the data overrun status of SJA1000 When users use the function 18120 Status to get the status of SJA1000 and get the value 1 this function may be needed Syntax int 18120 ClearDataOverrun BYTE SlotNo Parameter SlotNo input 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 SlotNotConfig Call this function without calling the function 18120 Config or 18120 ConfigWithoutStruct before 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 73 4 1 22 18120_Config lt For default firmware gt Description
27. software buffer of cyclic transmission engine After calling this function all of the transmitted cyclic messages stop the procedure and all of cyclic messages are removed from the cyclic transmission engine Syntax void ResetCyclicTxBuf void Parameter None Return None 5 1 58 SystemHardwareReset Description Use this function to reset all hardware of I 8120W included 186 CPU Syntax void SystemHardwareReset void Parameter None Return None I 8120W User s Manual Version 1 02 June 9 2009 145 5 1 59 SystemInit Description Use this function to initiate the DPRAM LEDs cyclic transmission engine CAN transmission software buffer and CAN controller Syntax void Systemlnit void Parameter None Return None 5 1 60 GetLibVer Description Get the version of the firmware library Syntax int GetLibVer void Parameter None Return The return code is the version of the firmware library For example If 100 hex is return it means driver version is 1 00 I 8120W User s Manual Version 1 02 June 9 2009 146 5 1 61 RefreshWDT Description Call this function to refresh the watchdog of I 8120W When users design the user defined firmware this function must be called where the users procedure may have a processed period more than 500ms If the function RefreshWDT is not called in 800ms the 186 CPU of I 8120W will be reset Syntax vo
28. two terminal resistances as in the following figure According to the ISO 11898 2 spec each terminal resistance is 1200 or between 108Q 132Q The length related resistance should have 70 mQ m Users should check the resistances of the CAN bus before they install a new CAN network 120Q Moreover to minimize the voltage drop over long distances the terminal resistance should be higher than the value defined in the ISO 11898 2 The CAN_L Figure 2 4 CAN bus network topology following table can be used as a good reference O0CI Bus Cable Parameters Terminal Bus Length Length Related Resist nc meter Cross Section Resistance Q Type mQ m 0 40 70 0 25 23AWG 124 0 1 0 34mm7 22AWG 40 300 lt 60 0 34 22AWG 127 0 1 0 6mm7 20AWG 300 600 lt 40 0 5 0 6mm 150 300 20AWG 600 1K lt 20 0 75 0 8mm 150 300 18AWG Table 2 4 Relationship between cable characteristics and terminal resistance 1 8120W User s Manual Version 1 02 June 9 2009 2 5 LED Indicator amp I 8120W Mode The LED status is changed when I 8120W is in different mode There are three modes and each mode describes as following 1 Download mode In this case Green and yellow LEDs interlace flash once per second At the same time I 8120W is ready to update the firmware by Utility Therefore users can use Utility to download the newer default firmware or the user defined firmware int
29. users want to delay the procedure of user defined firmware more than 500 ms The the function RefreshWDT must be applied to avoid the watchdog timeout This function is not allowed to put into interrupt service routine Syntax void DelayMs unsigned int DelayTime_ms Parameter DelayTime_ms input The delay time of procedure The unit is 1 ms Return None 5 1 30 CM100_InstallUserTimer Description This function can allow users to use timer interrupt When users put their timer interrupt service routine in this function this interrupt service routine will be executed every millisecond Be careful that too much program in the interrupt service routine will disturb the normal procedure of user defined firmware Syntax void CM100_InstallUserTimer void Fun void Parameter Fun void input The pointer which points a function with format void XXX void The XXX is the name of a function Return None I 8120W User s Manual Version 1 02 June 9 2009 124 5 1 31 T_StopWatchXXX series functions Description Call this function to use a stopwatch There are 4 functions for stopwatch operation When users want to start a stopwatch the function T_StopWatchStart must be applied Then users can use the function T_StopWatchGetTime to obtain the current time counts of this stopwatch If users need to disable the time counter use the function T_StopWatchPause to achieve this purpose Call the
30. 0_ SJA1000Config users always call this function to enable the SJA1000 sequentially Syntax int 18120 EnableSJA1000 BYTE SlotNo Parameter SlotNo input 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotlnit Call this function without calling the function 18120 _Init before 18120 ReplyError The response of the I 8120W is not match with the expected value I 8120W User s Manual Version 1 02 June 9 2009 68 4 1 17 18120_DisableSJA1000 Description Call this function will disable all functions of SJA1000 such as sending CAN message receiving CAN message and interrupt Afterwards users can call the function 18120 EnableSJA1000 to recover the all functions of SJA1000 Syntax int 18120 DisableSJA1000 BYTE SlotNo Parameter SlotNo input l 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotlnit Call this function without calling the function 18120 Init before 18120 ReplyError The response of the I 8120W is not match with the expected value I 8120W User s Manual Version 1 02 June 9 2009 69 4 1 18 18120 _Restorel8120 lt must be called once gt Description When users want to close the application users must call this function to release the system resource and the interrupt function If uses don t call this function
31. 18120 _Init before I 8120W User s Manual Version 1 02 June 9 2009 96 4 1 41 18120_SendCmd lt For user defined firmware gt Description Call this function to send the command to user defined firmware The maximum command length is 512 bytes Afterwards users can use the function DPRAMReceiveCmd of firmware library to get this command About the function DPRAMReceiveCmd please refer to section 5 1 16 for more information Syntax int 18120 SendCmd BYTE SlotNo BYTE Data WORD DataNum Parameter SlotNo input l 8120W slot No 0 7 Data input The start address of a byte array of a sent command DataNum input The word value indicates how many bytes users will send to user defined firmware Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 DpramOverRange The command length is over 512 bytes 18120 SlotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 97 4 1 42 18120_InstallUserlSR lt For user defined firmware gt Description Using this function can allow users to apply ISR interrupt service routine When users put their ISR into this function all of interrupt signals defined by users in user defined firmware will trigger the users ISR Besides the interrupt signal CAN _COMM_CMD_FROM_18120 defined in 18120 h will also pass to users ISR when the WinPA
32. 20W Syntax int 18120 Reset BYTE SlotNo Parameter SlotNo input l 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 ModeError The I 8120W is in download mode and can t be changed to firmware mode 4 1 4 18120_Init lt must be called once gt Description Initiate the specific I 8120W This function will be used when the application is at beginning After calling this function users must call the function 18120 HardwareReset to finish the initialization of the I 8120W Syntax int 18120_Init BYTE SlotNo Parameter SlotNo input l 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No I 8120W User s Manual Version 1 02 June 9 2009 57 4 1 5 18120_HardwareReset lt must be called once gt Description Reset the I 8120W hardware such as CAN controller DPRAM 186 CPU and so forth Syntax int 18120 HardwareReset BYTE SlotNo Parameter SlotNo input l 8120W slot No 0 7 Return 18120 NoError OK 18120 _SlotNumberError There is no l 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 ModeError The I 8120W is in download mode and can t be changed to firmware mode 18120 SlotNotinit Call this function without calling the function 18120 Init b
33. 20W The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 DPRAMWriteByte BYTE SlotNo WORD Address BYTE Data Parameter SlotNo input 8120W slot No 0 7 Address input The specified address of DPRAM where users want to write data Data input The byte data written to the DPRAM of I 8120W Return 18120 NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 DpramOverRange The Address of input parameter is over 6999 18120 SlotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 87 4 1 32 18120_DPRAMWriteWord lt For user defined firmware gt Description Write one word data into the specified address of DPRAM of l 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 _DPRAMWriteWord BYTE SlotNo WORD Address WORD Data Parameter SlotNo input l 8120W slot No 0 7 Address input The specified address of DPRAM where users want to write data Data input The word data written to the DPRAM of I 8120W Return 18120_NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 DpramOverRange The Address of input parameter is over 6998 18120 SlotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 88 4 1 33 1
34. 21 2 08 1 0854096 2 08 2 0900919 V Show message on the list Send CAN Message O 11 bit ID ID Hex Len Data Hex separated by space X 29 bit FF IRTR E FF FF FF FF FF FF FF FF Fad Eve 120W Utility Ver 1 00 rene 1 27 PM A E ss If the CAN network has some problem or the messages buffers are overflow users can click Clear Status button to recover the CAN status Rx Msg Buffer and Tx Msg Buffer The Reset Counter is used to clear the Rx Msg Cnt If users click Pause button 18120W_Utiltiy will stop to receive the CAN messages Click Clear button can clear the receiving list All the positions of these buttons are shown as the screen shot on the next page Because the display capability of WinPAC 8000 18120W_Utility may receive the 20 frames per second without data lose Users can disable the Show messages on the list checkbox and enable SaveToFile The receiving speed can be up to 200 frames per second I 8120W User s Manual Version 1 02 June 9 2009 35 I 8120W Utility Ver1 00 Filter Setting Hex Slot No Slot 4 v g Hex Update Firmware Acc Mask FFFFFFFF Enable Sys Msg Disable Sys Msg Baud Setting Hex Baud 125K bps w BT1 FF BTO FF CAN Status CAN Status Hex Rx Msg Cnt Ox0 2 04 123 11 22 33 4 3S 66 77 Msg Format Hex Dec ASCII 0210288 2 04 2 08 2 08 2 08 2 08 321 1FFFFFFF 12345678 1 2 Send CA
35. 4 18120_Init lt must be called ONCE gt issccessseceesseceneeenenseenenseenenes 57 4 1 5 18120 _HardwareReset lt must be called once gt 1 11ss01seeeeee 58 4 1 6 18120 _ Check186Mode 0cccccccccceseeeeneeeeeeeeeeneseneeeeeeenees 59 4 1 7 16120 Slatus ra ets aaa a parr rara ailesi t iosas iiiaae 60 4 1 8 18120 _ AddCyclicTxMsg 11 cccceseceeeeeeeeeeeeeeeeneeeeseneneeeeees 61 4 1 9 18120_DeleteCy Clic TXMSG 11cccssscceeeennneeeeeeeeeeeeeeeneeneeeeeees 62 4 1 10 18120_Enable Cyclic TXMSG 11cccsssscsseeeneeeeeeeeeeneeseneeeneeeeees 63 4 1 11 18120_DiSableCy Clic TXMSG 11 cscsseeeeeeeeeeeeeneeeeeeeentteeeees 64 4 1 12 IBTZ20 OUI PUIB 10 viiikciuiatiseatsctinestentbsnnigwtineniivtinustansieuainens 64 4 1 13 18120 IN DUIB 16 visinisdsisinisduisavandudnavdndudntuandudntudndudaaudadudnave 65 4 1 14 ABTZOASTR TIMCOUE siiieoiiigersshieaiaiiiesdiweatavmsaraineasanweenanweusdne 66 I 8120W User s Manual Version 1 02 June 9 2009 2 4 1 15 18120 SetSYSICINMSG wicsccicinciceieerasenceenedcersanecsaaneneacedeerees 67 4 1 16 18120_EnableSJA1000 sssssseeeeeeeeeeeeeeeeeeeeeees 68 4 1 17 18120_DisableSJA1000 0 ssseseseeeeeeeeeeeeeeeeeeeees 69 4 1 18 18120_Restorel8120 lt must be called once gt ss se1sseseeseeseees 70 4 1 19 18120_ClearSoftBuffer lt For default firmware gt 71 4 1 20 18120_ClearBufferStatus lt For default firmware gt 00 00008 72 4 1 21 1
36. 6 iiisicisivicdsinicindeinieiduintuindudecviedudecudecudns 112 DPRAMReadWord sisivistisnsicereaivenienaascenieanacctteaassseseanaeded 112 DPRAMReadDword 11 1ccseeeeeesseseneeeceeeeeeeesseeeeeneeneeeenees 113 DPRAMReadMultiByte 1 cssseeeeeeeeeeeeeeeeeneeeneteeeeeeneees 114 DPRAMMOM SCE iisscacsccttesssasscteseccetaweaseitsscacectusnaneaassnacate 115 DPRAMRGCCIVOCING iissseiss iccicaciccarstavencicieucccreksvenntekevente 116 DPRAMSendCmd vvciscesriiineceesecctensssunsszrinicneuswenesexeceassene 117 GetKbhit lt assist with debug cable and 7188xW eXe gt 118 Print lt assist with debug cable and 7188XW CX gt 1110100000 119 C2 1 1 eRe ee Oe a ah ee an ee ee sone ane 119 DOETIING noina aa a eaa araneta 120 GOLD Ae A A A A TE 120 OTD AIG nnen a a a a a aE 121 GetWeek Day ssis n aa a ea a aaa aaa a h 121 ReadNVRAM wieivcoscessvecrcevsveevtuesus ctdevweerdeveweetdeccweeudvecwecus 122 WriteNVRAM sssiiscuisuscsuiusuieauiueivabiusiuatiubiiiabiwstsuabbudisnbuas 122 GOTTIME TICKS 1OOUS i saccnieiccccsiaiscccsteeecudsiuistucsieacdccsduaecuens 123 GOLTIME TICKS nirin a a aaa aaan 123 D lay MS cis ccceicescctnsnsendesectiactesadeseiecseccevartuasdesusunctaartueraus 124 CM100_InstallUSerTiMer 11 cc0sscccesseeeesseeeesseeeeeeneneees 124 T_StopWatchxXXX series functions sasaaa 125 T_CountDownTimerXxXX series fuNnctions 1008 126 EEPROMReadByte cccccscseeeeeeeeeeeeeeeeeeneneneeeeeeeeeeeenees 127 EEPROMRe d
37. 8120 _ClearDataOverrun lt For default firmware gt 73 4 1 22 18120_Config lt For default firmmware gt 1110ccccssseessseeeeeteeees 74 4 1 23 18120_ConfigWithoutStruct lt For default firmware gt 77 4 1 24 18120_RxMsgCount lt For default firmware gt 11000ceesseee 78 4 1 25 18120_ReceiveMsg lt For default firmware gt 79 4 1 26 18120_ReceiveWithoutStruct lt For default firmware gt 81 4 1 27 18120_SendMsg lt For default firmmware gt 11ccccsssssssseeeeeeees 83 4 1 28 18120_SendWithoutStruct lt For default firmware gt 0 0008 84 4 1 29 18120_SJA1000Config lt For user defined firmware gt 85 4 1 30 18120_DPRAMInttTol8120 lt For user defined firmware gt 86 4 1 31 18120_DPRAMWriteByte lt For user defined firmware gt 87 4 1 32 18120_DPRAMWriteWord lt For user defined firmware gt 88 4 1 33 18120 _DPRAMWriteDword lt For user defined firmware gt 89 4 1 34 18120_DPRAMWriteMultiByte lt For user defined firmware gt 90 4 1 35 18120_DPRAMReadByte lt For user defined firmware gt 91 4 1 36 18120_DPRAMReadWord lt For user defined firmware gt 92 4 1 37 18120_DPRAMReadDword lt For user defined firmware gt 93 4 1 38 18120_DPRAMReadMultiByte lt For user defined firmware gt 94 4 1 39 18120 _DPRAMMemset lt For user defined firmware gt 95 4 1 40 18120_ReceiveCmd lt For user defined f
38. 8120_DPRAMWriteDword lt For user defined firmware gt Description Write one double word data into the specified address of DPRAM of I 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 DPRAMWriteDword BYTE SlotNo WORD Address DWORD Data Parameter SlotNo input 8120W slot No 0 7 Address input The specified address of DPRAM where users want to write data Data input The double word data written to the DPRAM of I 8120W Return 18120 NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 DpramOverRange The Address of input parameter is over 6996 18120 SlotNotinit Call this function without calling the function 18120 _Init before I 8120W User s Manual Version 1 02 June 9 2009 89 4 1 34 18120_DPRAMWriteMultiByte lt For user defined firmware gt Description Write multi byte data into specified address of DPRAM of I 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 DPRAMWriteMultiByte BYTE SlotNo WORD Address BYTE Data WORD DataNum Parameter SlotNo input l 8120W slot No 0 7 Address input The specified start address of DPRAM where users want to write data Data input The start address of a byte array written to the DPRAM of I 8120W DataNum input The byte number of an data array written to the DPRAM of I 8120W Return 18120 NoError OK 18120 SlotNum
39. 9 2009 126 Using parameter ulTime will get time interval of countdown timer Parameter ulStartTime returns the start time of countdown timer Parameter ulPauseTime can obtain the last pause time of countdown timer Parameter uMode returns the status of the countdown timer If uMode is 0 it means that the countdown timer pauses If uMode is 1 the countdown timer is running Return The return code of T_CountDownTimerlsTimeUp is _NO_ERR or _COUNT_DOWN_TIMER_TIME_UP If the countdown timer is timeout the return code is _COUNT DOWN_TIMER_TIME_UP If not the return code is _NO_ERR The return code of T_CountDownTimerGetTimeLeft is the rest time of the countdown timer 5 1 33 EEPROMReadByte Description Use this function to read the data of the specified address of EEPROM Syntax int EEPROMReadByte unsigned int Block unsigned int Address unsigned char Data Parameter Block input The EEPROM block No The range is from 0 to 6 Address input The EEPROM address where users will read the data Each block has 256 bytes Therefore the range of this parameter is from 0 to 255 data output The address of a variable used to obtain the data of specified address of EEPROM Return _NO_ERR OK _EEPROM_OVER_RANGE The block No is over 6 or the address is over 256 I 8120W User s Manual Version 1 02 June 9 2009 127 5 1 34 EEPROMReadmultiByte Description Use this function to read some data
40. AC_Library Ver_200 S MyDemo E 5 A File Edit view Favorites Ic amp Q sack amp S Address B C MyDemo a a armv4idbg ej MyDemoDlg c res h MyDemoDlg MyDemo cpp h newres h ReadMe txt h Resource h lej Std fx cpp h stdafx h 18120 li b 2 0 0 0 hi a zs 18120 h Q N I 8120W User s Manual Version 1 02 June 9 2009 26 File Edit View Favorites Tools Help ay Back gt K Search m Folders Ei Address F CAN SlotModule 18120W Demos WinPAC_Library ver_200 EJ co i MyDemo vcp fs MyDemo vow 7 KB 18120 lib LIB File 13 KB Shared Documents 4 My Computer Step9 Select File View tag and expand the tree view Right click the Source Files folder icon and click Add Files to Folder item MyDemo PAC270 Win32 WCE ARMY4I MyDemoD g Workspace MyDemo 1 project s if 3 MyDemo files Coes ae gt MyDemo Cy New Folder include s oclude t clude t MyDemo 3 Header File es Add to Source Control MyDemo IV Docking View E 5 MyDemo Hide B newres h HHHH Resource Properties ChHyDemol 2 StdAfx h C Resource Files ChyDemoD1g CDial ZA AF Step10 In the popup dialog select All Files lib in the Files of type filed Select the file 18120 lib
41. AM space which can be applied is from address 0 to 6999 Syntax int DPRAMWriteMultiByte unsigned int Address char Data unsigned int DataNum Parameter Address input The specified start address of DPRAM where users want to write data Data input The start address of a byte array written to the DPRAM of I 8120W DataNum input The byte numbers of an data array written to the DPRAM of I 8120W Return _NO_ERR OK _DPRAM_OVER_RANGE The sum of Address and DataNum of input parameters is over 6999 I 8120W User s Manual Version 1 02 June 9 2009 111 5 1 11 DPRAMReadByte Description Read one byte data from specified the address of DPRAM of l 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int DPRAMReadByte unsigned int Address unsigned char Data Parameter Address input The specified address of DPRAM where users want to read data Data output The address of a variable used to receive the data obtained by the function DPRAMReadByte Return _NO_ERR OK _DPRAM_OVER_RANGE The Address of input parameter is over 6999 5 1 12 DPRAMReadWord Description Read one word data from the specified address of DPRAM The DPRAM space which can be applied is from address 0 to 6999 Syntax int DPRAMReadWord unsigned int Address unsigned int Data Parameter Address input The specified address of DPRAM where users want to read data Data output
42. C LinPAC iPAC get a DPRAM command from the user defined firmware Syntax int 18120_InstallUserISR BYTE SlotNo void UserlSR BYTE SlotNo BYTE InttValue Parameter SlotNo input 8120W slot No 0 7 UserlSR BYTE SlotNo BYTE InttValue input The pointer which points a function with format void XXX Byte SlotNo Byte InttValue The XXX is the function name of users ISR The parameter SlotNo indicates the number of the board which produces an interrupt signal The parameter InttValue is the interrupt indicator which may be the value CAN _COMM_CMD_FROM_18120 or be the interrupt indicator transmitted from user defined firmware Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 DpramOverRange The command length is over 512 bytes 18120 SlotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 98 4 1 43 18120_RemoveUserlSR lt For user defined firmware gt Description When users don t need the ISR function call this function to remove users ISR Syntax int 18120 RemoveUserlSR BYTE SlotNo Parameter SlotNo input l 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1
43. CANIrqFunc and UserDPRAMIrqFunc are not used These warning will not have any affection to user defined firmware ex C TC BIN TC EXE Step15 Use ftp to copy the MyFirm exe built before to the WinPAC LinPAC For iPAC you need use the COM1 of iPAC and 7188xw exe to download it Step16 Use 18120W_ Utility to download user defined firmware to the I 8120W Users can refer to section 3 4 for more details I 8120W User s Manual Version 1 02 June 9 2009 50 3 7 Debug Tools for User defined Firmware Programming If users just apply default firmware for their application this section can be ignored This section introduces the debug methods when users deign their firmware Basically when users develop the user defined firmware the debug message can be put into the code section of user defined firmware which may have bugs inside Then compile user defined firmware and download it into I 8120W Owing to check the debug message the bugs could be found The following paragraph show how to use 7188xw exe assisted with debug cable to debug users firmware The firmware library provides two functions for applying The function GetKbhit allows users to received a character in firmware This character is produced when users key something on 7188xw exe Then users can use this feature to trigger some specified event for debugging The function Print allows users to send debug messages to 7188xw exe Afterwards these debug messages w
44. Description Use this function to activate SJA1000 Afterwards users can send receive CAN messages by other functions Syntax void EnableSJA1000 void Parameter None Return None I 8120W User s Manual Version 1 02 June 9 2009 136 5 1 45 DisableSJA1000 Description Call the function DisableSJA1000 to stop the functions of transmission CAN messages reception CAN messages and interrupt Syntax void DisableSJA1000 void Parameter None Return None 5 1 46 GetCANStatus Description Obtain the status register of SJA1000 by using this function Syntax int GetCANStatus void Parameter None Return The return code is the value of status register of SJA1000 Its meanings is described below Bit NO Description 7 MSB Bus status 1 for bus off O for bus on 6 Error status 1 for at least one error O for OK 5 SJA1000 Transmit status 1 for transmitting O for idle 4 SJA1000Receive status 1 for receiving 0 for idle 3 SJA1000 Transmit complete status 1 for complete 0 for incomplete 2 SJA1000 Transmit buffer status 1 for released O for locked 1 Data overrun status 1 for SJA1000 reception buffer overrun 0 for OK 0 LSB Receive buffer status 1 for at least one message stored in the SJA1000 reception buffer 0 for empty Table 5 5 The Description of Status Register of SJA1000 I 8120W User s Manual Version 1 02 J
45. I 81 20W User s Manual Warranty All products manufactured by ICP DAS are warranted against defective materials for a period of one year from the date of delivery to the original purchaser Warning ICP DAS assume no liability for damages consequent to 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 nor for any infringements of patents or other rights of third parties resulting from its use Copyright Copyright 2007 by ICP DAS All rights are reserved Trademark The names used for identification only maybe registered trademarks of their respective companies I 8120W User s Manual Version 1 02 June 9 2009 1 Tables of Content 1 General Information sasssesssnnnnnnnnennnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnmnnn 6 Aad TATFOGUGUOM PRETE TEE E E 6 Tid a siaccsacanccasacancccaacancccuccaaccduacincccnasdacrdntsducvantnanendatsducntnanananaaanine 7 T3 Specification S ta a eaa aee aeeoa aa seeen 8 1 4 Product Check List s icccccscicesccissssenicsecceandssssossteseeneedsaseerstesceecdeasee 9 2 Hardware Configuration cccccccccsssseseeeeeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeneees 10 2 1 Hardware Profile siciccctssscccccacsicastesnasentecnecectsenerentuenaseccussaseneuananeness 10 2 2 SUMPEF Selectman acer ai aere
46. If users need to send some specified CAN messages every period of time the flowchart shown in figure 3 6 may give a good example Owing to these procedures it may satisfy most application of users application with default firmware of I 8120W Following the operation principle of 8120W can help users with building their application easier and faster When users want to combine these three procedure for various application the functions 18120_Init 18120 HardwareReset and 18120 Config are only called once during the start of application Users can check the demo of default firmware to know how to implement these flowcharts on users application The following list shows all of the demos of I 8120W for default firmware These demos are only used when the default firmware is inside the 8120W Users can learn the basic skills about how to setup an application of I 8120W on WinPAC LinPAC iPAC main control unit Demos gt 8120W demo programs WinPAC_Lib gt The WinPAC APIs of I 8120W For_Default_Firmware gt Folder for default firmware Default_Firmware gt Default firmware of I 8120W WinPAC gt Folder for WinPAC demo eVC gt Folder for the demos by eVC RecMsg gt Demo for receiving CAN messages SendMsg gt Demo for sending CAN messages SendCyclicMsg gt Demo for sending CAN messages cyclically Note In the following flowcharts users must call 18120 Restorel1820 function before user c
47. If value is over 255 only low byte of data will be written to NVRAM Return _NO_ERR OK _ACCESS_NVRAM_FAILE The address of NVRAM is invalid I 8120W User s Manual Version 1 02 June 9 2009 122 5 1 27 GetTimeTicks100us Description Read 8120W time ticks by using this function When the firmware starts I 8120W time ticks are counted Reset the firmware will clean the accumulated counters of this value If the accumulated counters are over the value OxFFFFFFFF the counters also reset to 0 Syntax unsigned long GetTimeTicks100us void Parameter None Return The time ticks numbers when firmware started The unit is 0 1 ms 5 1 28 GetTimeTicks Description Call this function to read I 8120W time ticks When I 8120W has power the time ticks are counted This function can t be called in interrupt service routine Reset the operation system of I 8120W will clean the accumulated counters of this value If the accumulated counters are over the value OxFFFFFFFF the counters are also reset to 0 Syntax long GetTimeTicks void Parameter None Return The time ticks numbers The unit is 1 ms I 8120W User s Manual Version 1 02 June 9 2009 123 5 1 29 DelayMs Description Use this function to pending the procedure of user defined firmware Because of watchdog mechanism users can t delay for a long time The l 8120W watchdog timer is set to 800 ms It is recommend that if
48. Init before 4 1 9 18120_DeleteCyclicTxMsg Description Remove the specified cyclic transmission message which is added by the function 18120 AddCyclicTxMsg Syntax int 18120 DeleteCyclicTxMsg BYTE SlotNo BYTE Handle Parameter SlotNo input l 8120W slot No 0 7 Handle input The handle of cyclic transmission message which is obtained by the function 18120 _AddCyclicTxMsg Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 SetCyclicMsgFailure The I 8120W replies erroneously 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 62 4 1 10 18120_EnableCyclicTxMsg Description Enable the cyclic transmission message which is added by the function 18120 AddCyclicTxMsg before After enabling the specified cyclic transmission message I 8120W will transmit the specified CAN message by configured time period Syntax int 18120_EnableCyclicTxMsg BYTE SlotNo BYTE Handle Parameter SlotNo input l 8120W slot No 0 7 Handle input The handle of cyclic transmission message which is obtained by the function 18120 _AddCyclicTxMsg Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 SetCyclicMsgFailure The I 8120W replies erron
49. MUItiBy te 0ccccccceeeeeeeeeeeeeteeeeeeeeees 128 EEPROM WriteByte i isiviciniacecccsincsinsvendviceviatucncsiadwiciveniuane 129 EEPROMW riteMultiByte 00cccccesseeeeeeeeeeteeeeeeeeees 130 UserCANlrqFunc lt must be called once gt s11ccccccesseeeeeeeeee 131 SUA 1000HardwareReset cccccceseeeeceeeeeeeesseeeeeneeeeeeeeees 132 SCICANB AUG te ccnninnnninninnnnnnnnannicmnnae 132 Ge etCANBa d siaaa a aai 133 SetGCANMASK ic cbicsiccuive ccteveciavencreneceuveritenvecttexvertenvetes 134 GOtCANMASK cccccccccssssseeeeeseseeeeeeseeeeesssnsseseeeeseeenoeeeenes 135 CANGOINNG ccisitissriaceicduinicisccintndscwdndsisicintcdsnudadsdedudsieanciene 136 ENnaDleS dA 1000 iivviiiuiressroieausipeasrensraiansanivanwestveisrananeacdeaee 136 I 8120W User s Manual Version 1 02 June 9 2009 4 5 1 45 DisableStA 1000 vevccivitssssccnccncivccesnanentaancdcecesneusncnewescuceand 137 0 1 46 GetCANStat S isiin r a it 137 5 1 47 ClearDataQverrUnStatus cccccccccceeeeeeeeeeeeeeeeeeeeeeeetteees 138 5 1 48 SENUCANMS OG ics ccihccinisteatniistgcdinusuiusencsisudinesiiutiaunigedinspess 138 5 1 49 Clear XSONBURGC vviiiisisisieccinscisccistsdadsdecwiaccdseadscncsawdecvine 139 5 1 0 GOICANMSG iiipin reinaan aae eaea 140 5 1 51 ClearRxSoftBuffer 11 cccccccccesseeeeeeeseeeeeeseeneeseneeeeeenees 141 5 1 52 AXMSQCOUNT scactiestcasecaventeadas ccarsunnsuasican dntusaanteausuandntuteaiss 141 5 1 53 AGACY CHC TXMSG sivci
50. N Message 8 11 bit Ip __1D Hex 29 bit ID SFF oC Ce te 0224161 0236729 0246921 0854096 0900919 1220623 34 45 56 67 78 Cv Show message on the list SaveToFile Len Data Hex separated by space IRR E feecrrrererrrrrr Send Sometimes when users initialize the l 8120W the system information may be shown to debug tool description in section 3 7 Users can use button Enable Sys Msg Disable Sys Msg to enable disable the system information 7188XW 1 34 COM4 115200 N 8 1 FC 0 CTS 0 DIR D TestArea 7188xw Begin Key Thread 1 version 1 63 f irmvare version 1 03 f irmvare module firmware library for host command to run module firmware library for host command to run Firmware version 1 07 Slot NO Slot 4 y Update Firmware Enable Sys Msg Dianie Sys Meg i I 8120W User s Manual Version 1 02 June 9 2009 36 Program download If users want to update the firmware of I 8120W or download the user defined firmware into I 8120W the following steps may be a good reference First choose the proper No of the slot which has plugged the I 8120W Then click the Update Firmware button I 8120W Utility Ver1 00 Filter Setting Hex Baud Setting Hex Slot AEC 1 ED g Hex g Hex Msg Format Acc Code ooo00000 Baud 125Kbps iv Hex Dec Update Firmware gt Acc Mask FFFFFFFF BTO FF BT1 FF O asc CAN Status CAN Status Hex Clear St
51. No BYTE Handle int 18120 _DisableCyclicTxMsg BYTE SlotNo BYTE Handle void 18120 _OutputByte BYTE SlotNo WORD woOffset BYTE bValue int 18120_InputByte BYTE SlotNo WORD woOffset BYTE GetData int 18120_IsTxTimeout BYTE SlotNo BYTE Status int 18120 _SetSystemMsg BYTE SlotNo BYTE Mode int 18120_EnableSJA1000 BYTE SlotNo I 8120W User s Manual Version 1 02 June 9 2009 53 Function definition Note int 18120_DisableSJA1000 BYTE SlotNo OA int 18120_Restorel8120 BYTE SlotNo OA int 18120 _ClearSoftBuffer BYTE SlotNo int 18120 _ClearBufferStatus BYTE SlotNo int 18120 _ClearDataOverrun BYTE SlotNo int 18120 _Config BYTE SlotNo ConfigStruct CanConfig OH OVO TO int 18120 _ConfigWithoutStruct BYTE SlotNo DWORD AccCode DWORD AccMask BYTE BaudRate BYTE BTO BYTE BT1 O int 18120 _RxMsgCount BYTE SlotNo int 18120 _ReceiveMsg BYTE SlotNo PacketStruct CanPacket OJO int 18120_ReceiveWithoutStruct BYTE SlotNo BYTE Mode DWORD MsgID BYTE RTR BYTE DataLen BYTE Data DWORD UpperTime DWORD LowerTime int 18120_SendMsg BYTE SlotNo PacketStruct CanPacket int 18120_SendWithoutStruct BYTE SlotNo BYTE Mode DWORD MsgID BYTE RTR BYTE DataLen BYTE Data O int 18120_SJA1000Config BYTE SlotNo DWORD AccCode BYTE BaudRate BYTE BTO BYTE BT1 gt int 18120_DPRAMInttTol8120 BYTE SlotNo
52. Sub 9 pin connector for PC RS 232 port JP4 When users download the firmware which is not proper for I 8120W or has some bug so that the I 8120W can t work normally Set this jumper to reset status until the green and yellow LEDs of I 8120W interlace flash once per second Then set this jumper to normal status Afterwards the I 8120W is in download mode Users can kill the old firmware and download the new one into I 8120W by using Utility tool If users want to run default firmware or user defined firmware normally please keep this jumper in normal status Please section 2 5 for more detail about LED action and I 8120W mode XE P4 Reset e e JP4 Normal Table 2 1 Jumper or switch selections I 8120W User s Manual Version 1 02 June 9 2009 2 3 Connector Pin Assignment The I 8120W is equipped with one 5 pin screw terminal connector for wire connection of the CAN bus The connector s pin assignment is specified as following GND Pin CAN_H Pin 2 N A Pin 3 CAN_L Pin 4 N A Pin 5 Figure2 2 5 pin screw terminal connector a eno emu ooOOSSSSSSSS 2 CAN_H_ CAN_H bus line dominant high 4 CANL CAN _L bus line dominant low Table 2 2 Pin assignment of 5 pin screw terminal connector I 8120W User s Manual Version 1 02 June 9 2009 13 2 4 Wire connection In order to minimize the reflection effects on the CAN bus line the CAN bus line has to be terminated at both ends by
53. The address of a variable applied to receive the data obtained by the function DPRAMReadWord Return _NO_ERR OK _DPRAM_OVER_RANGE The Address of input parameter is over 6998 I 8120W User s Manual Version 1 02 June 9 2009 112 5 1 13 DPRAMReadDword Description Read one double word data from the specified address of DPRAM of 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int DPRAMReadDword unsigned int Address unsigned long Data Parameter Address input The specified address of DPRAM where users want to read data Data output The address of a variable applied to receive the data obtained by the function DPRAMReadDword Return _NO_ERR OK _DPRAM_OVER_RANGE The Address of input parameter is over 6996 I 8120W User s Manual Version 1 02 June 9 2009 113 5 1 14 DPRAMReadmultiByte Description Write the multi byte data into the specified address of DPRAM of l 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int DPRAMReadMultiByte unsigned int Address char Data unsigned int DataNum Parameter Address input The specified start address of DPRAM where users want to read data Data output The start address of a byte array applied to receive the data from DPRAM of I 8120W DataNum input The byte numbers which users will want to read from the DPRAM of I 8120W Return _NO_ERR OK _DPRAM_OVER_RANGE Th
54. X 101xx will be accepted Note The mark x means don t care And the mark h behind the value means hex format Return _NO_ERR OK _CAN_CHIP_SOFT_RESET_ERR SJA1000 can t be reset by software The CAN controller may be damaged 5 1 42 GetCANMask Description Get the current message mask status of CAN controller Syntax void GetCANMask long AccCode long AccMask Parameter AccCode output The address of a variable used to obtain the acceptance code of SJA1000 AccMask output The address of a variable used to obtain the acceptance mask of SJA1000 Return None I 8120W User s Manual Version 1 02 June 9 2009 135 5 1 43 CANConfig Description Configure the baud message filter of CAN controller After calling this function users need to call the function EnableSJA1000 to active CAN controller SJA1000 Syntax int CANConfig unsigned long Baud char BTO char BT1 long AccMask long AccCode Parameter Baud input The baud of CAN controller BTO input User defined baud BT 1 input User defined baud AccCode input Acceptance code of CAN controller AccMask input Acceptance mask of CAN controller For the more information about these parameters please refer to the section 3 4 49 and 3 4 51 Return _NO_ERR OK _CAN_CHIP_SOFT_RESET_ERR SJA1000 can t be reset by software The CAN controller may be damaged 5 1 44 EnableSJA1000
55. ad winpac _8000 download documents htm I 8120W User s Manual Version 1 02 June 9 2009 31 3 4 Introduction of 18120W_Utility Tool I8120W_ Utility is designed for 8120W on WinPAC LinPAC iPAC main control unit It provides some useful functions when users want to update default firmware or download the user defined firmware The following section shows you how to use it on your main control unit 18120W_ Utility for WinPAC Beside the function of download firmware 18120W_Utility on WinPAC also provides the functions to monitor access the CAN messages Users can find it in the path CAN SlotModule l8120W Tools WinPAC of the Field Bus CD When you want to use it you need to put the 18120 dll and the 18120W_ Utility in the same folder This file can be found in the path CAN SlotModule l8120W Demos WinPAC_Lib Ver_200 CAN Network Access When the utility boots up users can choose the proper No of the slot which has plugged the I 8120W I 8120W vue Xs Yeri 00 Filter Setting Hex Baud Setting Hex Msg Format Slot NO loto vy foto N pfact 0 Acc Code foooooo00 Baud 125Kbps Y Hex O Dec Hslot 1 Slot 2 Slot 3 Acc Mask FFFFFFFF BTO JFF BTL FF J ASCII CAN Status CAN Status Hex Clear Status Pause Rx Msg Buffer Updat Enabl Slot 4 ers 5 me Rx Msg Cnt Reset Counter Tx Msg Buffer wo wed ere coo or oe os oe Dos oe Tor te V Show message on the list SaveToFile Send
56. are Library UserInitFunc void Initialization Firmware Library UserLoopFunc void Procedure e DPRAM Interrupt Signal Interrupt Indicator UserDPRAMIrqFunc unsigned char INTT UserCANIrqFunc unsigned char INTT CAN Controller Interrupt Signal Interrupt Indicator 186COMM lib User c Figure 5 1 Firmware Library Operation Architecture Besides 186COMM lib also supports some functions for handling the hardware of I 8120W such as DPRAM access functions EEPROM access functions NVRAM access functions LED control functions real time clock access function timer functions debug functions and CAN bus access functions All the functions are listed in the table 5 1 and detailed information for every function is presented in the following sub section Function definition void L1Off void void L1On void void L2Off void void L2On void void DPRAMInttToHost char InttValue void UserDPRAMIrqFunc unsigned char INTT int DPRAMWriteByte unsigned int Address unsigned char Data int DPRAMWriteWord unsigned int Address unsigned int Data int DPRAMWriteDword unsigned int Address unsigned long Data int DPRAMWriteMultiByte unsigned int Address char Data unsigned int DataNum int DPRAMReadByte unsigned int Address unsigned char Data I 8120W User s Manual Version 1 02 June 9 2009 103 Function definition int DPRAMReadWor
57. ase refer to the section 3 2 28 Return 18120 NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 _InitError The l 8120W replies configuration error 18120 SlotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 85 4 1 30 18120_DPRAMInttTol8120 lt For user defined firmware gt Description Send an interrupt signal to 8120W This interrupt signal will pass to the user defined firmware Therefore users can do something for it Be careful that too many interrupt signals at a short time will affect the normal procedure of the user defined firmware Syntax int 18120 DPRAMInttTol8120 BYTE SlotNo BYTE Data Parameter SlotNo input l 8120W slot No 0 7 Data input Interrupt indicator The range is from 0x00 to Oxdf Users can define their own interrupt indicator and do some specified thing for it in user defined firmware Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 DpramOverRange The data of input parameter is over Oxdf 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 86 4 1 31 18120_DPRAMWriteByte lt For user defined firmware gt Description Write one byte data into the specified address of DPRAM of l 81
58. atus Disable Sys Msg Rx Msg Cnt tEK PR eset Counter Tx Msg Buffer NO Mode m RTR po or o2 o3 o4 o5 o o Time Enable Sys Msg Pause Rx Msg Buffer V Show message on the list SaveToFile Send CAN Message 11 bit ID ID Hex Len Data Hex separated by space 59 bit ID Br RTR B FF FF FF FF FF FF FF FF Send The download dialog will be pop up Users can see the firmware name modified date and file size of the firmware stored in the l 8120W Then click Update button to continue Filter Setting Hex Baud Setting Hex Slat NO Slot 4 G Hex g Hex Msg Format Acc Code Jooooooo0 Baud 125K bps v Hex C Dec Update Firmware Acc Mask FFFFFFFF BTO FF BT1 FF C asci CAN Status Enable Sys Msg CAN Status Hex Clear Status Disable Sys Msg Pause Rx Msg Buffer g Buffer Firmware CM1S107 EXE Modified 2009 3 3 11 37 15 Size 112918 V Show message on the list SaveToFile Send CAN Message 11 bit ID ID Hex Len Data Hex separated by space 2o bit1D BF RR B FE FF FF FF FF FF FF FF Send I 8120W User s Manual Version 1 02 June 9 2009 37 In the browsers select the file which you want to download Then click OK button to go on the download procedure Take a note that when users click OK button the download procedure will be started The original firmware stored in the I 8120W will be killed RATSI20W _Utility Name cmsi07 Type Exe
59. be applied Then If users need to disable the countdown timer use the function T_CountDownTimerPause to achieve this purpose Call the function T_CountDownTimerContinue to enable this countdown timer again Users can use the function T_CountDownTimerlsTimeUp to check if the countdown timer is timeout or not Or use the function T_CountDownTimerGetTimeLeft to obtain the rest time of countdown timer If users want to use more than one countdown timer just input the different variable of structure COUNTDOWNTIMER into these 5 functions One structure variable will be mapped to one countdown timer The time unit of these 5 functions and the members of COUNTDOWNTIMER structure are millisecond Syntax void T_CountDownTimerStart COUNTDOWNTIMER cdt unsigned long timems void T_CountDownTimerPause COUNTDOWNTIMER cdt void T_CountDownTimerContinue COUNTDOWNTIMER cdt int T_CountDownTimerlsTimeUp COUNTDOWNTIMER cdt unsigned long T_CountDownTimerGetTimeLeft COUNTDOWNTIMER cdt Parameter timems input The time interval which indicates that how much time the countdown timer will countdown cdt output The address of a COUNTDOWNTIMER structure variable used to describe the countdown timer The member of COUNTDOWNTIMER structure is shown as following typedef struct unsigned long ulTime unsigned long ulStartTime unsigned long ulPauseTime unsigned int uMode COUNTDOWNTIMER I 8120W User s Manual Version 1 02 June
60. before close application the system may be crashed or be unstable Syntax int 18120 Restorel8120 BYTE SlotNo Parameter SlotNo input l 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 ModeError The l 8120W is in download mode and can t be changed to firmware mode 18120 SlotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 70 4 1 19 18120_ClearSoftBuffer lt For default firmware gt Description Clear the software buffer of the I 8120W When users get the return code 18120 _SoftBufferlsFull from the function 18120 SendWithoutStruct 18120 SendMsg 18120 ReceiveWithoutStuct or 18120 ReceiveMsg this function may be needed Syntax int 18120 _ClearSoftBuffer BYTE SlotNo Parameter SlotNo input l 8120W slot No 0 7 Return 18120 _NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotConfig Call this function without calling the function 18120 Config or 18120 ConfigWithoutStruct before 18120 _SlotNotInit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 71 4 1 20 18120 ClearBufferStatus lt For default firmware gt Description Use this function to clear the status of reception
61. berError There is no I 8120W on the specific slot No 18120 DpramOverRange The sum of Address and DataNum of input parameters is over 6999 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 90 4 1 35 18120_DPRAMReadByte lt For user defined firmware gt Description Read one byte data from the specified address of DPRAM of l 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 DPRAMReadByte BYTE SlotNo WORD Address BYTE Data Parameter SlotNo input 8120W slot No 0 7 Address input The specified address of DPRAM where users want to read data Data output The address of a variable used to receive the data obtained by the 18120_DPRAMReadByte Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 DpramOverRange The Address of input parameter is over 6999 18120 SlotNotinit Call this function without calling the function 18120 _Init before I 8120W User s Manual Version 1 02 June 9 2009 91 4 1 36 18120 _DPRAMReadWord lt For user defined firmware gt Description Read one word data from the specified address of DPRAM of l 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 _DPRAMReadWord BYTE SlotNo WORD Address WORD Data Parameter SlotNo input 8120W slot No 0 7
62. ble used to receive the hour value of current time minute output The address of a variable used to receive the minute value of current time sec output The address of a variable used to receive the second value of current time Return None I 8120W User s Manual Version 1 02 June 9 2009 119 5 1 21 SetTime Description Use this function to modify the time of real time clock Syntax int SetTime int hour int minute int sec Parameter hour input The hour value set to real time clock minute input The minute value set to real time clock sec input The second value set to real time clock Return _NO_ERR OK _SET_TIME_ERROR The input value of hour minute or sec is invalid 5 1 22 GetDate Description Use this function to get the current date from real time clock Syntax void GetDate int year int month int day Parameter year output The address of a variable used to receive the year value of current date month output The address of a variable used to receive the month value of current date day output The address of a variable used to receive the day value of current date Return None I 8120W User s Manual Version 1 02 June 9 2009 120 5 1 23 SetDate Description Use this function to modify the date of real time clock Syntax int SetDate int year int month int day Parameter year input The year value set to real time c
63. command from DPRAM of I 8120W DataNum output The address of a variable is applied to receive the command length Return _NO_ERR OK _NO_DPRAM_CMD There is no command transmitted from user defined firmware _DPRAM_OVER_RANGE The command length is over 512 bytes I 8120W User s Manual Version 1 02 June 9 2009 116 5 1 17 DPRAMSendCmd Description Call this function to send the command to users applications of WinPAC LinPAC iPAC The maximum command length is 512 bytes Afterwards users can use the function 18120 ReceiveCmd to get this command About the function 18120 ReceiveCmd please refer to section 4 1 40 for more information The maximum command length can t exceed to 512 bytes Syntax int DPRAMSendCmd char Data unsigned int DataNum Parameter Data input The start address of a byte array of a sent command DataNum input The word value indicates how many bytes users will send to the user defined firmware Return _NO_ERR OK _DPRAM_OVER_RANGE The command length is over 512 bytes I 8120W User s Manual Version 1 02 June 9 2009 117 5 1 18 GetKbhit lt assist with debug cable and 7188xw exe gt Description This function is used for debugging of the user defined firmware Call this function to get a character keyed from keyboard The function GetKbhit is similar with standard C function getch When users connect the debug port of the I 8120W with the available RS 232
64. cture Users Programs Application 18120 dII 18120 a l 8120W APIs 18120 lib Operation System Windows CE Linux MiniOS7 Default 8120W Firmware or User defined Firmware MiniOS7 Opeartion System CAN Bus Figure 3 1 8120W Basic Software Architecture I 8120W User s Manual Version 1 02 June 9 2009 17 The basic software architecture of I 8120W in WinPAC LinPAC iPAC is shown as figure 3 1 Take WinPAC for the example The Windows CE APIs for I 8120W are provided by 18120 dll Users can apply this dll file with embedded Visual C to create the WinCE applications The Windows CE applications will communicate with I 8120W via DPRAM Besides the basic functions for the general purpose applications users can even design their special firmware for various CAN applications If users just need the general functions apply the APIs marked with lt for default firmware gt to build their Windows applications These APIs provide users to configure the CAN controller get the status of CAN controller send receive CAN messages to from CAN bus and send CAN messages with cyclic transmission engine These features help users to reach the purposes of bus monitor bus access network debugging network setup and etc The software architecture is shown below P Windows CE Linux MiniOS7 Users Application Programs APIs For APIs For 18120 dll I Default Firmware User defined Firmware 18120 a 18120 lib
65. cution Files exe v When the procedure is finished users can see the firmware information of new firmware Click OK button to close the download dialog Afterwards the new firmware will be run automatically Filter Setting Hex Baud Setting Hex Slot No Siot 4 v g Hex g Hex Msg Format Acc Code Joooooo0o Baud 125K bps v Hex O Dec Update Firmware Acc Mask FFFFFFFF BTO FF BT1 FF C asci CAN Status CAN Status Hex Clear Status Se 18120W_Utility OK 1x a Enable Sys Msg Disable Sys Msg Pause Rx Msg Buffer Firmware CM1S107 EXE Modified 2009 3 3 11 37 15 Size 112918 V Show message on the list SaveToFile Send CAN Message 11 bit ID ID Hex Len Data Hex separated by space 29 bit 10 BRE RTR B FR FF FF FF FF FF FF FP Send I 8120W User s Manual Version 1 02 June 9 2009 38 3 5 Basic concept of User defined Firmware Programming If users just apply default firmware for their application this section can be ignored This section describes about how to build a user defined firmware A CAN application can be implemented corresponding to the good cooperation of WinPAC LinPAC iPAC application and the user defined firmware Generally speaking the user defined firmware processes the part of CAN communication protocol and some algorithms of input and output The WinPAC LinPAC iPAC application gets the processed data from user defined firmware and shows them on the HMI i
66. d unsigned int Address unsigned int Data int DPRAMReadDword unsigned int Address unsigned long Data int DPRAMReadMultiByte unsigned int Address char Data unsigned int DataNum int DPRAMMemset unsigned int Address char data unsigned int DataNum int DPRAMReceiveCmd char Data unsigned int DataNum int DPRAMSendCmd char Data unsigned int DataNum int GetKbhit void int Print const char fmt void GetTime int hour int minute int sec int SetTime int hour int minute int sec void GetDate int year int month int day int SetDate int year int month int day int GetWeekDay void int ReadNVRAM int Address int WriteNVRAM int Address int data unsigned long GetTimeTicks100us void long GetTimeTicks void void DelayMs unsigned int DelayTime_ms void CM100_InstallUserTimer void Fun void void T_StopWatchStart STOPWATCH sw unsigned long T_StopWatchGetTime STOPWATCH sw void T_StopWatchPause STOPWATCH sw void T_StopWatchContinue STOPWATCH sw void T_CountDownTimerStart COUNTDOWNTIMER cdt unsigned long timems void T_CountDownTimerPause COUNTDOWNTIMER cdt void T_CountDownTimerContinue COUNTDOWNTIMER cdt int T_CountDownTimerlsTimeUp COUNTDOWNTIMER cdt unsigned long T_CountDownTimerGetTimeLeft COUNTDOWNTIMER cdt int EEPROMReadByte unsigned int Block unsigned int Ad
67. data into the specified address of DPRAM of l 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 _ DPRAMReadMultiByte BYTE SlotNo WORD Address BYTE Data WORD DataNum Parameter SlotNo input 8120W slot No 0 7 Address input The specified start address of DPRAM where users read to write data Data output The start address of a byte array applied to receive the DPRAM data DataNum input The byte numbers which users will want to read from the DPRAM of I 8120W Return 18120 NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 DpramOverRange The sum of Address and DataNum of input parameters is over 6999 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 94 4 1 39 18120_DPRAMMemset lt For user defined firmware gt Description Set multi byte DPRAM data to be the specified value The DPRAM space which can be applied is from address 0 to 6999 Syntax int 18120 DPRAMMemset BYTE SlotNo WORD Address BYTE Data WORD DataNum Parameter SlotNo input l 8120W slot No 0 7 Address input The specified start address of DPRAM where users want to write data Data input The data written to DPRAM of I 8120W DataNum input The byte numbers which users will want to write to DPRAM of I 8120W Return 18120 NoError OK 18120 Slo
68. dicator shows what kinds of CAN controller interrupt are active Therefore users only need to design their interrupt routine according to deal with the different interrupt indicators It is not allowed to put an infinite loop in to this function and users must keep the program of this function as short as possible Syntax void UserCANIrqFunc unsigned char INTT Parameter INTT input The interrupt indicator from CAN controller The meanings of indicators are shown as following Indicator Hex Meaning 0x01 Receive a message successfully 0x02 Transmit a message successfully 0x04 Error warring 0x08 Data Overrun 0x10 CAN controller wake up 0x20 Bus Passive 0x40 Arbitration Lost 0x80 Bus Error Table 5 3 CAN Interrupt Indicator Description Return None I 8120W User s Manual Version 1 02 June 9 2009 131 5 1 38 SJA1000HardwareReset Description Reset the CAN controller by reset the pin of SJA1000 After calling this function users must configure the baud and message mask of CAN controller Then use the function EnableSJA1000 to activate the SJA1000 to send and receive CAN messages Syntax void SJA1000HardwareReset void Parameter None Return None 5 1 39 SetCANBaud Description Set the CAN baud of CAN controller Syntax int SetCANBaud unsigned long Baud char BTO char BT1 Parameter Baud input The baud of CAN controller There are 12 kinds
69. dress unsigned char Data int EEPROMReadMultiByte unsigned int Block unsigned int Address char Data unsigned int DataNum int EEPROMWriteByte unsigned int Block unsigned int Address unsigned char Data int EEPROMWriteMultiByte unsigned int Block unsigned int Address char Data unsigned int DataNum void UserCANIrqFunc unsigned char INTT void SJA1000HardwareReset void int SetCANBaud unsigned long Baud char BTO char BT1 I 8120W User s Manual Version 1 02 June 9 2009 104 Function definition void GetCANBaud unsigned long Baud char BTO char BT1 int SetCANMask long AccCode long AccMask void GetCANMask long AccCode long AccMask int CANConfig unsigned long Baud char BTO char BT1 long AccMask long AccCode void EnableSJA1000 void void DisableSJA1000 void int GetCANStatus void void ClearDataOverrunStatus void int SendCANMsg char Mode unsigned long MsgID char RTR char DataLen char Data void ClearTxSoftBuffer void int GetCANMsg char Mode unsigned long MsgID char RTR char DataLen char Data unsigned long UpperTime unsigned long LowerTime void ClearRxSoftBuffer void int RxMsgCount void int AddCyclicTxMsg char Mode unsigned long MsgID char RTR char DataLen char Data unsigned long TimePeriod unsigned long TransmitTimes unsigned char Handle int DeleteCyclicTxMsg unsigned char Handle
70. e and download it Test the firmware and debug by using debug tools Figure 3 8 Development Procedure of User defied Firmware I 8120W User s Manual Version 1 02 June 9 2009 41 Start of Application 18120_Init 18120 HardwareReset 18120 _Config 18120_ConfigWithoutStruct send Message cyclically YES Call Cyclic Series Functions Access DPRAM ES Have a Command Process Received Command Exit Program YES 18120 _Restorel8120 End of Application Figure 3 9 Procedure of Applications for User defied Firmware I 8120W User s Manual Version 1 02 June 9 2009 42 Briefs of the demo programs The following list shows all of the demos for user defined firmware These demos show two things The one is how to program the firmware of I 8120W by using firmware library Another is how to build a corresponding application on WinPAC LinPAC iPAC by using the I 8120W APIs When users use the demos of user defined firmware the firmware of I 8120W in these demo folders are needed to download into the I 8120W firstly Each demo folder has its own firmware of I 8120W This firmware is written according to the application program in the same demo folder After finishing the firmware download users can use the demo of WinPAC LinPAC IPAC to communicate the firmware just download before Demos For_User_Defined_Firmware Firm_Lib RxMsg l8120W WinPAC TxMsg
71. e 9 2009 81 18120 _SlotNumberError There is no l 8120W on the specific slot No 18120 SoftBufferlsEmpty There is no CAN message in reception software buffer 18120 _SoftBufferlsFull Users can still get CAN message from the reception software buffer but the software buffer is overflow 18120 TimeOut The I 8120W has no response 18120 SlotNotConfig Call this function without calling the function I8120 Config or 18120 ConfigWithoutStruct before 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 82 4 1 27 18120_SendMsg lt For default firmware gt Description Send a CAN message to software transmission buffer When the CAN bus is idle this CAN message will be sent to CAN network Note that if users make some mistakes of CAN bus wiring and configuration the CAN messages may not be transmitted successfully In this case the messages sent by users will be put in the transmission buffer Users can use the function 18120_IsTxTimeout or 18120 Status to check if any error happens Syntax int 18120_SendMsg BYTE SlotNo PacketStruct CanPacket Parameter SlotNo input l 8120W slot No 0 7 CanPacket input The address of a PacketStruct structure variable used to describe the sent CAN message About the definition of PacketStruct please refer to the description of 18120 ReceiveMsg function Return 18120 NoError
72. e aoan aea aeree enia 11 2 3 Connector Pin Assignment ssssssssssnnnnneenennnnnnnnnnnnnnnnnnnnnnnn nnna 13 2 4 Wire connection ss sssesesssnnnnnnnrennnnnnnnnnnnnnnnnnnnnnnnnnn nnmnnn nenna 14 2 5 LED Indicator amp l 8120W Mode cccccceeseeeseeeeeeeeeeeeeeeeeeeeeeees 15 2 6 Hardware Installation ccccccccsssseeeeeeeeeeeeeeseeeeeeeeeeeeeeeeseneeeeeneees 16 3 18120W Programming e ei ii tintin nnn niin nnn nn niin 17 3 1 Software ArchiteCture ccccscscsseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeesenseeeeeeees 17 3 2 Application Programming With Default Firmware 20 3 3 Application Programming cceceeeeeeeseeeeeeeeeeeeeeeeeeeeeeeeeeees 24 3 4 Introduction of 18120W_Utility TOOL cccsseeeeeeeeeeeeeeeeeeeeeeees 32 3 5 Basic concept of User defined Firmware Programming 39 3 6 User defined Firmware ProgrammMing eeeeeeeeeeeeeeeeseeeees 44 3 7 Debug Tools for User defined Firmware Programming 51 4 APIs for Windows Application ccccceseeeeeeeeeeeeeeeeeeeneeeeeeeeeeeeneeees 53 4 1 API Definitions and Descriptions cccccessseeeeeeeeeeeeeeeeeeeeees 53 4 1 1 18120_GetDIIVErsiOn c11sccccsscccesseceenseuesseseeseeeeseesenseesenes 56 4 1 2 18120_ AdujstDate Time 1ssseseeeeeeeeeeeeeeeeeeeees 56 4 1 3 18120 OSCE sssiwiccvetnnscuinietnicenien aieiacserus eendeaeemuenneaanen 57 4 1
73. e sum of Address and DataNum of input parameters is over 6999 I 8120W User s Manual Version 1 02 June 9 2009 114 5 1 15 DPRAMMemset Description Set the multi byte DPRAM data to be the specified value The DPRAM space which can be applied is from address 0 to 6999 Syntax int DPRAMMemset unsigned int Address char data unsigned int DataNum Parameter Address input The specified start address of DPRAM where users want to write data Data input The data written to DPRAM of I 8120W DataNum input The byte numbers which users will want to write to DPRAM of I 8120W Return _NO_ERR OK _DPRAM_OVER_RANGE The sum of Address and DataNum of input parameters is over 6999 I 8120W User s Manual Version 1 02 June 9 2009 115 5 1 16 DPRAMReceiveCmd Description Use this function to receive the command transmitted from the windows applications When users use the function 18120_SendCmd to a send command in users application of WinPAC LinPAC iPAC call this function to receive the command which comes from the application If users do not receive the command until another command is given from users application the former one will be covered by the latter one About the function 18120 SendCmd please refer to 4 1 41 for more information Syntax int DPRAMReceiveCmd char Data unsigned int DataNum Parameter Data output The start address of a byte array is applied to receive the
74. efore Syntax int DeleteCyclicTxMsg unsigned char Handle Parameter Handle input The handle of the cyclic transmission message which is obtained by the function AddCyclicTxMsg Return _NO_ERR OK _CYCLIC_HANDLE_ERR The handle value can t be found in the cyclic transmission engine I 8120W User s Manual Version 1 02 June 9 2009 143 5 1 55 EnableCyclicTxMsg Description Enable a cyclic transmission message which is added by the function AddCyclicTxMsg before After enable the specified cyclic transmission message I 8120W will transmit the specified CAN message by configured time period Syntax int EnableCyclicTxMsg unsigned char Handle Parameter Handle input The handle of cyclic transmission message which is obtained by the function AddCyclicTxMsg Return _NO_ERR OK _CYCLIC_HANDLE_ERR The handle value can t be found in the cyclic transmission engine 5 1 56 DisableCyclicTxMsg Description Disable a cyclic transmission message which is enabled by the function EnableCyclicTxMsg before Syntax int DisableCyclicTxMsg unsigned char Handle Parameter Handle input The handle of cyclic transmission message which is obtained by the function AddCyclicTxMsg Return _NO_ERR OK _CYCLIC_HANDLE_ERR The handle value can t be found in the cyclic transmission engine I 8120W User s Manual Version 1 02 June 9 2009 144 5 1 57 ResetCyclicTxBuf Description Clear the
75. efore I 8120W User s Manual Version 1 02 June 9 2009 58 4 1 6 18120_Check186Mode Description Obtain the specified 8120W if it is in download mode or in firmware mode Syntax int 18120 _Check186Mode BYTE SlotNo BYTE Mode Parameter SlotNo input 8120W slot No 0 7 Mode output The address of a variable used to get the I 8120W mode If this value is O it indicates that the I 8120W is in download mode If 1 it is in firmware mode When I 8120W is in download mode it can only update the firmware and the firmware will not work at the same time Users can use the function 18120 Reset to set the I 8120W into firmware mode Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 ReplyError The response of the I 8120W is not match with the expected value 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 59 4 1 7 18120 Status Description Obtain the status of the CAN controller for the specific 8120W Syntax int 18120_Status BYTE SlotNo BYTE bStatus Parameter SlotNo input 8120W slot No 0 7 bStatus output The address of a variable is applied to get the status value of CAN controller NAME STATUS Bus Status Error Status bus off bus on ok Transmit Stat
76. eously 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 63 4 1 11 18120_DisableCyclicTxMsg Description Disable the cyclic transmission message which is enabled by the function 18120_EnableCyclicTxMsg Syntax int 18120 _DisableCyclicTxMsg BYTE SlotNo BYTE Handle Parameter SlotNo input 8120W slot No 0 7 Handle input The handle of cyclic transmission message which is obtained by the function 18120 _AddCyclicTxMsg Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 SetCyclicMsgFailure The I 8120W replies erroneously 18120 SlotNotlnit Call this function without calling the function 18120 Init before 4 1 12 18120_OutputByte Description Write the data to the specified SJA1000 register of the I 8120W Syntax void 18120 _OutputByte BYTE SlotNo WORD wOffset BYTE bValue Parameter SlotNo input l 8120W slot No 0 7 wOffset input The register address of SJA1000 bValue input The value written to the specified register Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 64 4 1 13 18120_InputByte Descrip
77. es Sees Help ar Back amp J i ss Search A MyFirm c 1 KB C Source file Fie Edit View Favorites Tools 186Comm h 5 KB C Header file 186COMM LIB 79 KB LIB File I 8120W User s Manual Version 1 02 June 9 2009 45 f Ver 103 DER Step4 Run the TC 1 01 development environment Click the Options Full menus to expand the all functions list in the menus et C TC BIN TC EXE S Fa ject WWW AA lt lt lt i EO A A AAAS se O O Di Help Use or don t use full set of menu commands AS Step5 Click the Project Open project to create a new project Input the project name MyFirm PRJ and click OK button to continue ex C TC BIN TC EXE o o yN Grane I 8120W User s Manual Version 1 02 June 9 2009 46 52 g oO z ae 3 tees 2528 oO fe Seg Ege EIT og LS Oc Ee SEszES Q o oe oe c 5 z Cx D 2 se 6 a Oi Sec amp r E a bo oE o PdFeES 32538 o gt a 5 J Z gt es gt f mo i Step8 Click the Options Compiler Code generation to set the compiler model to the large mode Afterwards click More to set the Floating point and Instruction Set parameters the Emulation and 80186 item will be used respectively Then click OK to save the configura
78. ess of a variable is used to obtain the transmission status of I 8230W The value 0 means that the transmission status is normal If the value is 1 the transmission status is timeout Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 66 4 1 15 18120_SetSystemMsg Description When the I 8120W boots up the firmware of the I 8120W prints some information about firmware version to the debug tool description in section 3 7 If users don t want to see the system information call this function once Syntax int 18120 SetSystemMsg BYTE SlotNo BYTE Mode Parameter SlotNo input 8120W slot No 0 7 Mode input If the value is 0 the system information is disable If the value is 1 the system information is enable Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 67 4 1 16 18120 EnableSJA1000 Description This function will enable the transmission reception and interrupt of SJA1000 If the SJA1000 by using the function 18120 DisableSJA1000 calling this function can recover the SJA1000 to be enabled Moreover after using the function 1812
79. for useless 1 is for useful DataLen input CAN message data length The maximum value is 8 Data input The start address of the data buffer of a CAN message The maximum space of Data is 8 bytes TimePeriod input The time period of cyclic transmission This parameter is formatted by 0 1ms The minimum value is 5 TransmitTimes input The numbers of CAN messages will be transmitted After the 8120W transmit all of the CAN messages which users decide the numbers of by using this parameter I 8120W will disable this cyclic transmission message automatically Users can enable this cyclic transmission message to require the l 8120W to send these CAN messages again by using the function 18120 EnableCyclicTxMsg If this parameter is set to 0 the I 8120W will send CAN message cyclically and continuously after users enable this cyclic transmission message I 8120W User s Manual Version 1 02 June 9 2009 61 Handle output The address of a variable is used to get the handle of a cyclic transmission When users want to enable or disable the specified cyclic transmission this value must be needed Return 18120 NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 SetCyclicMsgFailure The cyclic transmission messages are over 5 messages or I 8120W replies erroneously 18120 SlotNotinit Call this function without calling the function 18120
80. format is not used 1 for remote transmit request is used DataLen input Data length of a transmitted CAN message The maximum value is 8 Data input The start address of a buffer is used to store the transmitted data of a CAN message Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 SoftBufferlsFull The transmission software buffer is overflow 18120 _SlotNotConfig Call this function without calling the function I8120 Config or 18120 ConfigWithoutStruct before 18120 SlotNotlnit Call this function without calling the function 18120_Init before I 8120W User s Manual Version 1 02 June 9 2009 84 4 1 29 18120_SJA1000Config lt For user defined firmware gt Description Configure the message filter and baud of SJA1000 About the input parameters of this function please refer to the function 18120 Config for the details After using this function users must use the function 18120 EnableSJA100 to enable the SJA1000 of I 8120W Syntax int 18120 SJA1000Config BYTE SlotNo DWORD AccCode DWORD AccMask BYTE BaudRate BYTE BTO BYTE BT1 Parameter SlotNo input 8120W slot No 0 7 AccCode input Acceptance code of CAN controller AccMask input Acceptance mask of CAN controller BTO input User defined baud BT 1 input User defined baud For the more information about these parameters ple
81. from EEPROM Syntax int EEPROMReadMultiByte unsigned int Block unsigned int Address char Data unsigned int DataNum Parameter Block input The EEPROM block No The range is from 0 to 6 Address input The start EEPROM address where users will write the data Each block has 256 bytes Therefore the range of this parameter is from 0 to 255 data output The start address of a byte array used to receive the data from EEPROM DataNum input The parameter indicates that how many data users want to obtain Return _NO_ERR OK _EEPROM_OVER_RANGE The block No is over 6 or the address is over 256 Or the specified range of reading data is over the block 6 and address 255 I 8120W User s Manual Version 1 02 June 9 2009 128 5 1 35 EEPROMWriteByte Description Use this function to write the data to specified address of EEPROM If system has no power the data stored in EEPROM will not disappear Syntax int EEPROMWriteByte unsigned int Block unsigned int Address unsigned char Data Parameter Block input The EEPROM block No The range is from 0 to 6 Address input The EEPROM address where users will write the data Each block has 256 bytes Therefore the range of this parameter is from 0 to 255 data input The data written to EEPROM Return _NO_ERR OK _EEPROM ACCESS ERROR Can t write data to specified EEPROM address The EEPROM may be damaged _EEPROM_OVER_RANGE
82. g Description Obtain a received CAN message from the software buffer Syntax int GetCANMsg char Mode unsigned long MsgID char RTR char DataLen char Data unsigned long UpperTime unsigned long LowerTime Parameter Mode output The address of a variable used to get the mode of a CAN message If value is 0 the received CAN message is with 11 bit ID The 29 bit ID of a CAN message will have value 1 MsgID output The address of a variable used to get the CAN message ID RTR output The address of a variable used to obtain the status of this CAN message 0 for remote transmit request format is not used 1 for remote transmit request is used DataLen output The address of a variable used to get the data length of a CAN message The range of this value is from 0 to 8 Data output The start address of a buffer used to get the data of a CAN message Users need to put an 8 byte element array in this filed UpperTime output The address of a variable used to obtain the higher double word of time stamp of a CAN message LowerTime output The address of a variable used to obtain the lower double word of time stamp of a CAN message The unit for UpperTime and LowerTime is 0 1ms Return _NO_ERR OK _RX_SOFT_BUF_EMPTY The reception software buffer of CAN message is full Users need to use ClearRxSoftBuffer to clear this status when this return code is got _SOFT_BUF_FULL Reception software buffe
83. ge ID RTR input Set the remote transmit request is used or not O is for useless 1 is for useful DataLen input CAN message data length The maximum value is 8 Data input The start address of the data buffer of a CAN message The maximum space of Data is 8 bytes TimePeriod input The time period of cyclic transmission This parameter is formatted by 0 1ms The minimum value is 5 TransmitTimes input The numbers of CAN messages will be transmitted After the I 8120W transmit all of the CAN messages which users decide the numbers of by using this parameter I 8120W will disable this cyclic transmission message automatically Users can enable this cyclic transmission message to require the I 8120W to send these CAN messages again by using the function EnableCyclicTxMsg If this parameter is set to 0 the I 8120W will send CAN message cyclically and continuously after users enable this cyclic transmission message Handle output The address of a variable used to get the handle of a cyclic transmission When users want to enable or disable the I 8120W User s Manual Version 1 02 June 9 2009 142 specified cyclic transmission this value must be needed Return _NO_ERR OK _CYCLIC_CONFIG_ERR The cyclic transmission messages are over 5 messages or the time period is less than 0 5ms 5 1 54 DeleteCyclicTxMsg Description Remove a cyclic transmission message which is added by the function AddCyclicTxMsg b
84. hand _CYCLIC_CONFIG_ERR Check the parameter Handle and try it _CYCLIC_HANDLE_ERR again Check the address or space range of EEPROM OVER RANGE written EEPROM and try it again Wait for a while and call the function again EE RROMAC CESS ERROR Call your distributor to solve this problem Table 5 6 Return Code Troubleshooting Note If users problem can t be fixed after following the recommended methods Please contact your distributor or email to service icpdas com to solve the problem I 8120W User s Manual Version 1 02 June 9 2009 150
85. iasastessesenisaverantncnacaccureassveuananencuenccans 142 5 1 54 DeleteCy clic TXMUSG 0ccccccccseeeseeeeeeeeeeeeeseeneeseneeeeeeees 143 5 1 55 EnmableCy clic TXMSGO 2 10cccccccceesseseeeeeceeeeeeseeeessnnneeeeeees 144 5 1 56 DiSsableCyclic TXMSG 1cccccccseseseeeeeeeeeeeeseeseeeseeeeeenees 144 5 1 57 RESCICYCHCOTXBUN viiiisiscsiacuicscintcccartaducccwiadsecewanduiucuenceans 145 5 1 58 SystemHardwareReset cccccsccseseeeeeeeeeeeeeeeeeseeeeeeeeeees 145 5 1 59 Systeminit ciccciecissivivendescdeesdeccdeendeeuderddwstvactvenduscdensdunsins 146 5 1 60 GOLLID VF sicasccsudeas cian tnarsusedetusiavdnasecutdeaastardeansnavduanecauduaets 146 8 1267 ACTOSAW DT vwiiiststntucitnanucnantnencnavenaueneuneenenenanenauenewenewend 147 5 1 62 UserlnitFunc lt must be called once gt 11111ssssseeeesseseeeeeees 147 5 1 63 UserLoopFunc lt must be called OnCe gt 111111cceeeeeeeeeeeeeees 148 5 2 Firmware Library Return Codes Troubleshooting 149 I 8120W User s Manual Version 1 02 June 9 2009 5 1 General Information 1 1 Introduction The CAN Controller Area Network is a serial communication bus especially suited to interconnect smart devices to build smart systems or sub system As standalone CAN controller 8120W with WinPAC LinPAC and iPAC series MCU main control unit represents an economic solution It has one CAN communication ports with 5 pin screw terminal connector and is useful to
86. id RefreshWDT void Parameter None Return None 5 1 62 UserlnitFunc lt must be called once gt Description When users design the user defined firmware this callback function must be called once Users can put some procedures into this function These procedures are those which will be executed only one time in user defined firmware When I 8120W boots up the firmware library will call this callback function once Syntax void UserInitFunc void Parameter None Return None I 8120W User s Manual Version 1 02 June 9 2009 147 5 1 63 UserLoopFunc lt must be called once gt Description When users design the user defined firmware this callback function must be called as soon as possible Users can put their main procedures into this function Then the main procedure will be executed in every period of time The time period is correlated with the complexity of users main procedure When I 8120W boots up the firmware library will call the function UserlnitFunc once and then call the function UserLoopFunc in every period of time until 8120W is turned off It is not allowed to put a infinite loop in this function Syntax void UserLoopFunc void Parameter None Return None I 8120W User s Manual Version 1 02 June 9 2009 148 Error ID 5 2 Firmware Library Return Codes Troubleshooting If default firmware is used users do not need to read this section Troubleshooti
87. ill be put on the screen of 7188xw exe Before debugging your firmware you need to prepare an debug cable Plug the debug cable to the JP2 of I 8120W described in section 2 2 Connect an available PC COM port with the D Sub 9 pin connector of debug cable The architecture is shown as following figure Available D Sub 9 pin COM port Connector ae m 4 pin Connector JP2 connector Then use Notepad exe to modify the 7188xw ini to set the number of specified PC COM port which is connecting with debug cable The configuration screen is displayed as following figure Finally put this 7188xw ini and 7188xw exe in the same folder and execute the 7188xw exe Users can find 7188xw ini and 7188xw exe in the Field Bus CD The path is CAN SlotModule l 8120W Tools PC I 8120W User s Manual Version 1 02 June 9 2009 51 C4 means PC COM4 If users use PC COM1 modify it to C1 7188xw ini Notepad Sele File Edit Format Yiew Help Then any keyboard input to 7188xw exe on the PC will be caught by user defined firmware via GetKbhit function The debug messages sent by Print function in firmware will also be displayed on the screen of 7188xw exe 7188XW 1 26 COM4 115200 N 8 1 FC 0 CTS 1 DIR D TestArea 71 88xw x times jle running running running running running running running running running running times jds times jis times jie times jde times times o
88. irmWare gt wi 96 4 1 41 18120_SendCmd lt For user defined firmware gt s001 ss00eeee 97 4 1 42 18120_InstallUserlSR lt For user defined firmware gt s 98 4 1 43 18120_RemoveUser SR lt For user defined firmware gt 99 4 2 APIs Return Codes Troubleshooting cccsssssseseeeeeeeeeeeeeeeees 100 5 Functions of Firmware Library eeeeeeee nit i ieee 102 5 1 Firmware Library Definitions and Descriptions 102 BAD DEV ORR A 106 5 1 2 LIOM sisisi ED EPEC EE REE PEOEE UEP EEEEREEPEOEE ERP REE TREE PEREPEE 106 co a 7s Se E 107 BA UEP OM iaaa ada iaaa aao 107 5 1 5 DPRAMInttToHOSt siisiuisisinarisininauistvinandstvdnavdstvincudnavanceae 108 5 1 6 UserDPRAMIrqFunc lt must be called once gt 0000000 108 I 8120W User s Manual Version 1 02 June 9 2009 3 5 1 7 5 1 8 5 1 9 5 1 10 5 1 11 5 1 12 5 1 13 5 1 14 5 1 15 5 1 16 5 1 17 5 1 18 5 1 19 5 1 20 5 1 21 5 1 22 5 1 23 5 1 24 5 1 25 5 1 26 5 1 27 5 1 28 5 1 29 5 1 30 5 1 31 5 1 32 5 1 33 5 1 34 5 1 35 5 1 36 5 1 37 5 1 38 5 1 39 5 1 40 5 1 41 5 1 42 5 1 43 5 1 44 DPRAMWriteByte siscsicincsceceswessstncreccutsanesssananeacndecrasaneuane 109 DPRAMWriteWord siiccicsscinziccxcceacinasisiacscindicesccasaonasincaddy 109 DPRAMWriteDword 1 ssssecsssssseeseeeeeeeneesseeeeensneeeeenees 110 DPRAMWriteMultiByte 2200cccceeeeeeeeeeeeneeeteeeeeeeneees 111 DPRAMRGAOB 1
89. l MyDemo 1 proj A Remote Heap Walker WCE500 Z File 7 Remote Kernel Tracker WCE500 A Remote Performance Monitor WCE500 Z Remote Process Viewer WCESOO Pr Remote Registry Editor WCES00 A Remote Spy WCESO0 Ph Remote System Information WCESO0 Pr Remote Zoomin WCES00 Select Remote Tools gt Customize TE Macro Record Quick Macro Ctrl Shift R Play Quick Macro Ctrl Shift P Configure Platform Manager Version 1 02 June 9 2009 28 Step13 Set the Platform to PAC270 Set the CPUs to Win32 WCE ARMV4I Select the Include files for the Show directories combo box Set the Directories as follow C Program Files Windows CE Tools wce500 PAC270 include ARMV4I C Program Files Windows CE Tools wce500 PAC270 mfc include C Program Files Windows CE Tools wce500 PAC27O ati include C Program Files Windows CE Tools wce500 PAC270 ICPDAS include If users want to add a new path in the Directories double click in the empty filed of the Directories and click button to select the proper folder which you want to set Then click OK to continue Options An Tabs Debug Compatibility Download Build Directories gt So Platform CPUs Show directories Win32 WCE ARMV4l dfinclude files gt Directories _ _ a x re E Program Files Windows CE Tools wce500 PAC270 Include ARMV4
90. lock month input The month value set to real time clock day input The day value set to real time clock Return _NO_ERR OK _SET_DATE_ERROR The input value of year month or day is invalid 5 1 24 GetWeekDay Description Use this function to obtain what day is today Syntax int GetWeekDay void Parameter None Return Return Code Meaning 0 Sunday 1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday Table 5 2 Relation Between Return Code and Day of Week I 8120W User s Manual Version 1 02 June 9 2009 121 5 1 25 ReadNVRAM Description Use this function to get one byte data of NVRAM Syntax int ReadNVRAM int Address Parameter Address input The NVRAM address where users will read the data The range of this parameter is from 0 to 30 Return _ACCESS_NVRAM_FAILE The address of NVRAM is invalid Others The value obtained from NVRAM The range of return value is from 0 to 255 5 1 26 WriteNVRAM Description Use this function to write one byte data to specified address of NVRAM If system has no power the data stored in NVRAM will not disappear Syntax int WriteNVRAM int Address int data Parameter Address input The NVRAM address where users will write the data The range of this parameter is from 0 to 30 data input The data written to NVRAM The range of this parameter is from 0 to 255
91. lose the application on WinPAC LinPAC iPAC main control Or the interrupt and system resource will not be released and it may cause system crash or make system be unstable I 8120W User s Manual Version 1 02 June 9 2009 20 Start of Application 18120_Init 18120 HardwareReset 18120 Config 18120 ConfigWithoutStruct 18120_RxMsgCount gt 0 m 18120_ReceiveMsg 18120 ReceiveWithoutStruct Exit Program YES 18120 Restorel8120 End of Application Figure 3 4 Flowchart of Receiving CAN Massages I 8120W User s Manual Version 1 02 June 9 2009 21 Start of Application 18120 Init 18120 _HardwareReset 18120_Config 18120 _ConfigWithoutStruct NO Send CAN Message 18120_SendMsg 18120 _SendWithoutStruct 18120 IsTxTimeout YES Exit Program YES 18120 Restorel8120 End of Application Figure 3 5 Flowchart of Sending CAN Massages I 8120W User s Manual Version 1 02 June 9 2009 22 Start of Application 18120 Init 18120 HardwareReset 18120 _Config 18120 ConfigWithoutStruct NO Need a cyclic message 18120 AddCyclicTxMsg _Enable a cyclic message 18120 EnableCyclicTxMsg Disable a cyclic message 18120 DisableCyclicTxMsg 18120 _DeleteCyclicTxMsg YES 18120 _Restorel8120 End of Application Figure 3 6 Flowchart of Cyclic Transmitting CAN Massages Sen g I 8120W User s Manual Version 1 02 June 9 2009 23 3 3 Application Pr
92. lotNotinit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 77 4 1 24 18120_RxMsgCount lt For default firmware gt Description Obtain the number of CAN messages available in the reception software buffer of the WinPAC LinPAC iPAC Syntax int 18120 _RxMsgCount BYTE SlotNo WORD RxMsgCnt Parameter SlotNo input l 8120W slot No 0 7 RxMsgCnt output The address of a variable is used to get the numbers of the available CAN messages in the software buffer Return 18120 NoError OK 18120 SlotNumberError There is no l 8120W on the specific slot No 18120 SlotNotConfig Call this function without calling the function 18120 Config or 18120 ConfigWithoutStruct before 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 78 4 1 25 18120_ReceiveMsg lt For default firmware gt Description Obtain the received messages from software buffer Before using this function the CAN controller must be configured by using the function 18120_Config or 18120 _ConfigWithoutStruct Syntax int 18120_ReceiveMsg BYTE SlotNo PacketStruct CanPacket Parameter SlotNo input l 8120W slot No 0 7 CanPacket output The address of a PacketStruct structure variable used to get a CAN message The PacketStruct structure is defined as following typedef s
93. n their own firmware by using firmware library refer to section 3 6 only the functions marked by is useful In order to make the descriptions more simplified and clear the attributes for the input and output parameter of APIs are given as input and output respectively They are described as follows Keyword Set parameter by user before Get the data from this parameter calling this function after calling this function input Yes No output No Table 4 2 Description of API parameter Hint I 8120W User s Manual Version 1 02 June 9 2009 55 4 1 1 18120 _GetDllVersion Description Obtain the version information of the library of I 8120W Syntax WORD 18120_GetDllIVersion void Parameter None Return Function library version information For example If the value 200 is return it means the library version is 2 00 4 1 2 18120_ AdujstDateTime Description Adjust date and time of I 8120W by using the system time of WinPAC LinPAC iPAC Syntax int 18120 AdujstDateTime BYTE SIlotNo Parameter SlotNo input l 8120W slot No 0 7 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 TimeOut The I 8120W has no response 18120 SetDateTimeFailure Set date and time failure I 8120W User s Manual Version 1 02 June 9 2009 56 4 1 3 18120 Reset Description Reset the CAN controller SJA1000 of the I 81
94. ncludes the following items o I 8120W CAN module o Software CD ROM o Release note and Quick start o One debug cable model number is 4PCA 0904 Attention If any of these items are missing or damaged please contact your local field agent Keep aside the shipping materials and carton in case you want to ship or store the product in the future I 8120W User s Manual Version 1 02 June 9 2009 9 2 Hardware Configuration 2 1 Hardware Profile Transmission Reception LED Error LED PWR Tx Rx ERR l Power LED CAN Connector I 8120W User s Manual Version 1 02 June 9 2009 10 2 2 Jumper Selection e e JP4 CAN Connector JPI I 8120W Connector The following table shows the definition of jumpers or switch Users need to refer to this table to configure the I 8120W hardware Jumper Description Status swl Swi SWw1 CAN Port 120Q terminal resistance E E Enable Disable Jumper for writing protection of flash memory It can lock unlock the flash memory to enable disable the firmware mee JP1 download procedure In harsh environment it is useful to prevent flash memory access from noise or disturbances Lock Unlock I 8120W User s Manual Version 1 02 June 9 2009 11 Jumper Description Status JP2 Debug port for user defined firmware Users can connect the debug port with the PC RS 232 port via the debug cable 4 pin connector for JP2 D
95. ng _SET_TIME_ERROR Check the time format of input parameters and retry it again _SET_DATE_ERROR Check the date format of input parameters and retry it again _ACCESS_NVRAM_FAILE Try it again Call your distributor to solve this problem _NO_ERR OK _COUNT_DOWN_TIMER_TIME_UP 1 The countdown timer started by users is timeout CAN_CHIP_SOFT_RESET_ERR Call the function SJA1000HardwareReset and try it again Call your distributor to solve this problem _CAN_CHIP_CONFIG_ERR Check the parameters of baud BTO BT1 acceptance code and acceptance mask and try it again RX_SOFT_BUF_EMPTY Wait for a while and call the function again _SOFT_BUF_FULL Use the function ClearTxSoftBuffer or the function ClearRxSoftBuffer to clear the status of buffer overflow Reduce the bus loading of CAN network _DPRAM_WRITE_ERR Wait for a while and call the function again Call your distributor to solve this problem _DPRAM_READ_ERR Wait for a while and call the function again Call your distributor to solve this problem _DPRAM_OVER_RANGE Check the address or space range of written DPRAM and try it again I 8120W User s Manual _NO_DPRAM_CMD Wait for a while and call the function again Version 1 02 June 9 2009 149 Error ID Troubleshooting Check if users already use 5 the cyclic messages Set the parameters TimePeriod to more t
96. ns by the definitions of interrupt indicators Because of the interrupt mechanism too many calls of this function will increase host CPU loading and disturb the normal procedure of users applications on WinPAC LinPAC iPAC Syntax void DPRAMInttToHost char InttValue Parameter InttValue input The interrupt indicator sent to users Windows application The range is from 0x00 Oxdf Return None 5 1 6 UserDPRAMIrqFunc lt must be called once gt Description This is a callback function and must be call once in user defined firmware When firmware library receives an interrupt signal from users Windows applications it will pass the interrupt indicator from users Windows applications to this function Users can have some proper procedures in this function to process each interrupt indicator It is not allowed to put an infinite loop in to this function and users must keep the program of this function as short as possible Syntax void UserDPRAMIrqFunc unsigned char INTT Parameter INTT input The interrupt indicator from users Windows application Return None I 8120W User s Manual Version 1 02 June 9 2009 108 5 1 7 DPRAMWriteByte Description Write one byte data into the specified address of DPRAM of l 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int DPRAMWriteByte unsigned int Address unsigned char Data Parameter Address inp
97. nterface or gives a command to user defined firmware to do some specified process The relationship between WinPAC LinPAC iPAC applications and the user defined firmware is shown as the figure 3 7 on the next page The Figure 3 8 and 3 9 shows the basic flowchart of developing the user defined firmware and corresponding WinPAC LinPAC iPAC applications To develop the user defined firmware users can create a C C project and include several c file and 186COMM lib Put the 4 callback functions in one of these c file Program the codes into these 4 callback functions If necessary build your functions and global variables Then compile this project and you can get your user defined firmware Download it by using utility tool and test it Afterwards according to the functions of user defined firmware design your WinPAC LinPAC iPAC applications We provide some communication functions in the firmware library 186COMM lib By using these functions users can communicate WinPAC LinPAC iPAC applications with user defined firmware via DPRAM Besides firmware library also supports most functions of hardware on I 8120W such as DPRAM accessing EEPROM accessing RTC access timer function and so forth In the WinPAC LinPAC iPAC applications the communication functions are also given by 18120 dll Moreover it also provides some useful functions such as cyclic transmission engine hardware reset function SJA1000 configuration functions DPRAM acces
98. o 8120W 2 Firmware mode If users use default firmware of I 8120W the green LED will be flashed once when 8120W receive transmit one CAN message to CAN bus successfully If bus loading is heavy the green LED will turn on always When some error occurs the yellow LED will be turned on Users can use 18120 Status function to get the situation except buffer status Reading or sending CAN messages can get the buffer status from the return code of functions If Il 8120W uses user defined firmware users can design the action of green LED or yellow LED by themselves 3 Reset mode If users reset the I 8120W by JP4 described in section 2 2 both green and yellow LED will turn on about 1 second Afterwards l 8120W is forced to enter the download mode When l 8120W is out of control because the bug of user defined firmware or other problems use this method to reset firmware and download newer firmware again Note that if users always set the JP4 to reset status the I 8120W will switch the mode between reset mode and download mode I 8120W User s Manual Version 1 02 June 9 2009 15 2 6 Hardware Installation When users want to use I 8120W the hardware installation needs to be finished as following steps 1 Shutdown your main control unit WP 8xxx LP 8xxx or iPAC 8xxx 2 Configure the SW1 for the terminal resistance Check JP1 and JP4 status If users want to update the firmware of I 8120W set JP1 to unlock mode The mo
99. ogramming When you want to design a WinPAC application the VB NET C NET or eVC development environment may be needed If users want to develop applications for LinPAC or iPAC C C language is the only one choice Therefore you need LinPAC SDK software for LinPAC applications or need BC TC for iPAC application Users can free download the eVC WinPAC SDK LinPAC SDK and TC 1 01 compiler through the following website eVC http www microsoft com downloads details aspx Familyld 1DACDB3D 50D1 4 1B2 A107 FA75AE960856 amp displaylang en WinPAC SDK http www icpdas com products PAC winpac download winpac _8000 download sdk htm LinPAC SDK and TC 1 01 http www icpdas com download download list htm eVC Programming Step1 Download eVC 4 0 and install it in your PC Step2 Download WinPAC SDK for eVC and install it in your PC Step3 If users want to know the details about WinPAC SDK please refer to the SDK users manual Users can download it from our website http ftp icpdas com pub cd winpac napdos wp 8x4x_ce50 document sdk document Step4 Execute the eVC FA m Settings R Accessories m DAQPro p2 Search gt Microsoft Office a M Microsoft Visual Studio 6 0 za Help and Support f Microsoft eMbedded visual C 4 0 ff eMbedded Visual C 4 0 s AE Run T ISaGRAF 3 4 SB MSN Messenger 7 0 go Shut Down Hanaho I 8120W User s Manual Version 1 02 June 9 2009 24 S
100. oo n1 02 o3 o4 o5 o o7 time V Show message on the list SaveToFile Send CAN Message 11 bit ID ID Hex Len Data Hex separated by space Cj zobitip FF IRTIR B FF FF FF FF FF FF FF FF I 8120W User s Manual Version 1 02 June 9 2009 33 When the messages are received they will be shown on the list Users can also use Send button to send a CAN message Furthermore users can use SaveToFile checkbox to save the data into a txt file When users enable the checkbox the following received messages will be saved I 8120W Utility Ver1 00 Filter Setting Hex Baud Setting Hex BE sot 4 g Hex g Hex Msg Format Acc Code foooooo00 Baud 125Kbps iv Hex Dec Update Firmware Acc Mask FFFFFFFF BTO FF BT1 IFF Casc CAN Status Enable Sye Meg ee Hex oxoc Clear Status Rx Msg Buffer a Disable Sys Ms ys S9 Rx Msg Cnt 0000000004 Reset Counter Reset Counter Clear Clear Tx Msg Buffer 11 2 33 44 5 66 77 BB Ag LFFFFFFF N 2 23 34 S 5 60 7 B 12345678 Y V Show message on the list SaveToFile Send CAN Message 8 11 bit ID ID Hex Len Data Hex separated by space Cy2sbitio fFF IRR fB FF FF FF FF FF FF FF FF Send When the SaveToFile checkbox is enabled assume that there are two messages received by 18120W_Utilty These two messages will be saved into the txt file I 8120W Utility Ver1 00 Filter Setting Hex Baud Setting Hex are ota wi g Hex
101. r is full Users need to use function ClearRxSoftBuffer to clear the CAN transmission buffer I 8120W User s Manual Version 1 02 June 9 2009 140 5 1 51 ClearRxSoftBuffer Description Call this function to clear the reception software buffer of CAN messages Syntax void ClearRxSoftBuffer void Parameter None Return None 5 1 52 RxMsgCount Description Call this function to know how many available CAN messages stored in the reception software buffer Syntax int RxMsgCount void Parameter None Return The return code is the numbers of CAN messages stored in reception software buffer I 8120W User s Manual Version 1 02 June 9 2009 141 5 1 53 AddCyclicTxMsg Description Add a cyclic transmission message into the cyclic transmission engine Afterwards uses can enable or disable this cyclic transmission messages by using the function EnableCyclicTxMsg and the function DelectCyclicTxMsg Maximum 5 set of cyclic transmission messages can be applied After adding a cyclic transmission message the handle for this message will be returned The less value of handle indicates the higher priority of this cyclic transmission message Syntax int AddCyclicTxMsg char Mode unsigned long MsgID char RTR char DataLen char Data unsigned long TimePeriod unsigned char Handle Parameter Mode input O for 11 bit message ID 1 for 29 bit message ID MsgID input CAN messa
102. re detail information could be found on the session 2 2 3 If users want to debug the firmware of I 8120W from debug port connect the JP3 with special cable For more detail please refer to session 2 2 4 Plug the CAN bus cable s into the 5 pin screw terminal connector When the procedure described above is completed plug I 8120W into proper slot of main control unit then turn on the main control unit I 8120W User s Manual Version 1 02 June 9 2009 16 3 18120W Programming In this chapter it shows that how to develop the application and user defined firmware Section 3 1 describes the software architecture of 8120W Section 3 2 shows the procedures of programming an application by using default firmware Some application demos are given here Section 3 3 introduces how to build application according to your user defined firmware by step by step method Section 3 4 introduces the 18120W_ Utility When users want to update the default firmware or download user defined firmware into 8120W This tool must be used Section 3 5 shows the basic concept about the relationship between user defined firmware and the corresponding application Section 3 6 gives a profile about how to design the user defined firmware by step by step introduction Section 3 7 provides two ways to debug the user defined firmware If users just use the default firmware for their application the Section 3 5 3 6 and 3 7 can be ignored 3 1 Software Archite
103. sing and etc If users want to develop the user defined firmware C C language is the only one choice Therefore you need BC TC for user defined firmware Users can free download the TC 1 01 compiler through the following website http www icpdas com download download list htm I 8120W User s Manual Version 1 02 June 9 2009 39 Algorithms and data processing of users applicaion DPRAM Communication Functions of 18120 dill WinPAC LinPAC iPAC Applications Algorithms and data processing of user defined firmware CAN Access Functions of 186COMM lib User defined Firmware CAN Network Figure 3 7 Relationship Between Applications amp User defined Firmware I 8120W User s Manual Version 1 02 June 9 2009 40 Create a c or cpp file which includes UserlnitFunc UserLoopFunc UserCANIrqFunc and UserDPRAMIrqFunc Put initial process into callback function of UserlnitFunc Put main process into callback function of UserLoopFunc Use DPRAMReceiveCmd to check if any command is sent from Windows application If necessary create other functions or global variables for user defined firmware NO Use CAN Interrupt YES Put CAN ISR into callback function UserCANIrqFunc NO Use DPRAM Interrupt YES Put DPRAM ISR into callback function UserDPRAMIrqFunc Create a project which include the c file and 186COMM lib Compile this project to build an execution fil
104. sion 1 02 June 9 2009 101 5 Functions of Firmware Library If the default firmware is used users do not need to read this chapter This chapter introduces all the functions provided by firmware library 186COMM lib The content includes the description and list of functions of 186COMM lib error code description and simple method of troubleshooting It is helpful to build the user defined firmware The section 5 1 shows the list and information of all functions supported by 186COMM lib The section 5 2 is the basic troubleshooting when users apply the functions of 186COMM lib and get an unexpected return code 5 1 Firmware Library Definitions and Descriptions When users want to design their own firmware the functions of firmware library are needed In order to reduce the development cycle the firmware library 1B6COMM lib provides 4 callback functions If users want to do some initial job put the program into the function UserInitFunc Users normal procedure can be put in the function UserLoopFunc The firmware library will execute this callback function as soon as possible If users would like to process some interrupt signal from DPRAM or CAN controller use the callback functions UserDPRAMIrqFunc and UserCANiIrqFunc to do that These 4 callback functions must be applied in users c file even users don t want to use them The architecture is show as figure 5 1 I 8120W User s Manual Version 1 02 June 9 2009 102 Firmw
105. tNumberError There is no I 8120W on the specific slot No 18120 DpramOverRange The sum of Address and DataNum of input parameters is over 6999 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 95 4 1 40 18120 _ReceiveCmd lt For user defined firmware gt Description Use this function to receive the command transmitted from the user defined firmware When users use the function DPRAMSendCmd to a send command in the user defined firmware call this function to receive the command from the user defined firmware If users do not receive the command until another command is given from the user defined firmware the former one will be covered by the latter one About the function DPRAMSendCmd please refer to 5 1 17 for more information Syntax int 18120 _ReceiveCmd BYTE SlotNo BYTE Data WORD DataNum Parameter SlotNo input l 8120W slot No 0 7 Data output The start address of a byte array applied to receive the command from DPRAM of I 8120W DataNum output The address of a variable applied to receive the command length Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 NoDpramCmd There is no command transmitted from user defined firmware 18120 DpramOverRange The command length is over 512 bytes 18120 SlotNotinit Call this function without calling the function
106. tep5 Click File New to create a new project E Microsoft eMbedded Visual C Eile Edit View Insert Project Build T New Ctrl N Open Ctrl 0 Step6 Select WCE MFC AppWizard exe to be the template of this project The project name is MyDemo The location of this project is C MyDemo The CPU type in the CPUs field is set to Win32 WCE ARMV41l Then click OK to go on the next step Files Projects Workspaces 2 WCE Application Project name E WCE ATL COM AppWizard Gomy WCE Dynamic Link Library GMydeme w WCE MFC pe Contoivizati Location BAWCE MFC AppWizard exe CCAMyDemo a C ddt OWin32 WCE MIPS16 OWin32 WCE MIPSII OWin32 WCE MIPSII_FP I 8120W User s Manual Version 1 02 June 9 2009 25 Step7 Select Dialog based item for this demo Choose the language which you want to see in your resources file Here English United States item is used Click Finish button to finish the project creation WCE MFC AppWizard exe Step 1 of 4 Application 0 What type of application would you like to create C Single document What language would you like your resources in lt English United States ceappwzenu dll gt gt Step8 Copy the l 8120 library files 18120 h and I8120 lib into the MyDemo folder in disk C You can find these files in the following path of CD CAN SlotModule l8120W Demos WinP
107. tion itions Step9 Click the Option Debugger to set the Source Debugging parameter Here select None for this parameter setting C TC BIN TC EXE Window Full menus Compiler Transfer Make Display Swappin al cca Heap Size K bytes I 8120W User s Manual Version 1 02 June 9 2009 48 tory parameter irec tory parameter Irec tories to set the Output D Irec MyFirm for the Output D Click the Option D Here set the C Step10 ME ies r F oul gah ransfe Environmen Linker Director SWS W ae SF AN WN t lick the Options save to save A SEES YW YH ing c SEs Ys AAA SS Z Wye EES Ye M B ILE EEE LE i LE A nvironment 1es Misuse es Ye bi SILI LLL L the parameters sett f SEE iy ing Ue 7 Ss EES EE ty ty EEE ME CELE i Yi ty ty EE ff ie MY FIRMS BIN T A abrar Director After finish this project BIN TC TC TC Step11 49 1 02 June 9 2009 Version 1 8120W User s Manual Step12 After finishing the parameters setting click the Compile build all to produce the execution file Users can find the execution file in the MyFirm folder Its name is MyDemo exe The warning messages may occur during the compiling procedure because the INTT parameters of User
108. tion Read the data from the specified SJA1000 register of the I 8120W Syntax int 18120_InputByte BYTE SlotNo WORD wOffset BYTE GetData Parameter SlotNo input l 8120W slot No 0 7 wOffset input The register address of SJA1000 GetData output The address of a variable is used to get the data of the specific register of SJA1000 Return 18120 NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 65 4 1 14 18120_IsTxTimeout Description Use this function to check if the I 8120W finish the transmission of CAN message or not When users call the function 18120_SendMsg or 18120 _SendWithoutStruct 8120W firmware will put the CAN message into message buffer until the SJA1000 is available When users use this function to check if the CAN message is transmitted or not the 8120W may not reply immediately until 1 second later Generally the transmission timeout of the I 8120W is due to wrong baud broken line and loose connector Therefore when users want to use this function it is recommended that put this function in a timer schedule to check if the transmission timeout of the 8120W occurs or not Syntax int 18120_IsTxTimeout BYTE SlotNo BYTE Status Parameter SlotNo input l 8120W slot No 0 7 Status output The addr
109. truct packet LONGLONG MsgTimeStamps BYTE mode DWORD id BYTE rtr BYTE len BYTE data 8 PacketStruct MsgTimeStamps This parameter will record the time when I 8120W got a CAN message This is formatted by 0 1 ms The time base of this value refers to the hardware clock of l 8120W When the personal computer boots up the hardware clock starts to count mode 0 for 11 bit message ID 1 for 29 bit message ID id CAN message ID rtr O for remote transmit request format is not used 1 for remote transmit request is used len Data length of a CAN message data 8 data of a CAN message Return 18120 NoError OK I 8120W User s Manual Version 1 02 June 9 2009 79 18120 _SlotNumberError There is no l 8120W on the specific slot No 18120 SoftBufferlsEmpty There is no CAN message in reception software buffer 18120 SoftBufferlsFull Users can still get CAN message from the reception software buffer but the software buffer is overflow 18120 TimeOut The I 8120W has no response 18120 SlotNotConfig Call this function without calling the function 18120 Config or 18120 ConfigWithoutStruct before 18120 SlotNotlnit Call this function without calling the function 18120 Init before I 8120W User s Manual Version 1 02 June 9 2009 80 4 1 26 18120 _ReceiveWithoutStruct lt For default firmware gt Description Obtain a received message from software buffer This function is similar with the f
110. unction 18120 _ReceiveMsg The difference is that this function doesn t use any structure parameter It is easy to use in some program environment such as VB Net Syntax int 18120_ReceiveWithoutStruct BYTE SlotNo BYTE Mode DWORD MsgID BYTE RTR BYTE DataLen BYTE Data DWORD UpperTime DWORD LowerTime Parameter SlotNo input 8120W slot No 0 7 Mode output The address of a variable used to get the mode of a CAN message If value is 0 the received CAN message is with 11 bit ID The 29 bit ID of a CAN message will have value 1 MsgID output The address of a variable used to get the CAN message ID RTR output The address of a variable used to obtain the status of this CAN message 0 for remote transmit request format is not used 1 for remote transmit request is used DataLen output The address of a variable used to obtain the data length of a CAN message The range of this value is from 0 to 8 Data output The start address of a buffer used to get the data of a CAN message Users need to put an 8 byte element array in this filed UpperTime output The address of a variable used to obtain the higher double word of time stamp of a CAN message LowerTime output The address of a variable used to obtain the lower double word of time stamp of a CAN message The unit of UpperTime and LowerTime are 0 1ms Return 18120 NoError OK I 8120W User s Manual Version 1 02 Jun
111. une 9 2009 137 5 1 47 ClearDataOverrunStatus Description When the data overrun status is obtained by using the function GetCANStatus call this function to clear this status Syntax void ClearDataOverrunStatus void Parameter None Return None 5 1 48 SendCANMsg Description Send a CAN message to software transmission buffer When the CAN bus is idle this CAN message will be send to CAN network Syntax int SendCANMsg char Mode unsigned long MsgID char RTR char DataLen char Data Parameter Mode input 0 for 11 bit message ID 1 for 29 bit message ID MsgID input CAN message ID RTR input O for remote transmit request format is not used 1 for remote transmit request is used DataLen input Data length of a transmitted CAN message The maximum value is 8 Data input The start address of a buffer used to store the transmitted data of a CAN message Return _NO_ERR OK _SOFT_BUF_FULL Transmission software buffer is full Users need to transmit CAN message later Or use the function ClearTxSoftBuffer to clear the transmission buffer I 8120W User s Manual Version 1 02 June 9 2009 138 5 1 49 ClearTxSoftBuffer Description Call this function to clear the transmission software buffer of CAN messages Syntax void ClearTxSoftBuffer void Parameter None Return None I 8120W User s Manual Version 1 02 June 9 2009 139 5 1 50 GetCANMs
112. us Receive Status transmit idle receive idle Transmission Complete Status complete incomplete Transmit Buffer Status release locked Data Overrun Status overrun absent Receive Buffer Status full not empty empty Table 4 3 Bit interpretation of the bStatus Return 18120_NoError OK 18120 SlotNumberError There is no I 8120W on the specific slot No 18120 SlotNotlnit Call this function without calling the function 18120_Init before I 8120W User s Manual Version 1 02 June 9 2009 60 4 1 8 18120_AddCyclicTxMsg Description Add a cyclic transmission message into 18120W firmware Afterwards uses can enable or disable this cyclic transmission messages by using the function 18120 _EnableCyclicTxMsg and 18120 DelectCyclicTxMsg The maximum number of the cyclic transmission messages is 5 After adding a cyclic transmission message the handle for this message will be returned The less value of handle indicates the higher priority of this cyclic transmission message Syntax int 18120 AddCyclicTxMsg BYTE SlotNo BYTE Mode DWORD MsgID BYTE RTR BYTE DataLen BYTE Data DWORD TimePeriod DWORD TransmitTimes BYTE Handle Parameter SlotNo input l 8120W slot No 0 7 Mode input 0 for 11 bit message ID 1 for 29 bit message ID MsgID input CAN message ID RTR input Set remote transmit request is used or not 0 is
113. ut The specified address of DPRAM where users want to write data Data input The byte data written to the DPRAM of I 8120W Return _NO_ERR OK _DPRAM_OVER_RANGE The Address of input parameter is over 6999 5 1 8 DPRAMWriteWord Description Write one word data into the specified address of DPRAM of l 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int DPRAMWriteWord unsigned int Address unsigned int Data Parameter Address input The specified address of DPRAM where users want to write data Data input The word data written to the DPRAM of I 8120W Return _NO_ERR OK _DPRAM_OVER_RANGE The Address of input parameter is over 6998 I 8120W User s Manual Version 1 02 June 9 2009 109 5 1 9 DPRAMWriteDword Description Write one double word data into the specified address of DPRAM of 8120W The DPRAM space which can be applied is from address 0 to 6999 Syntax int DPRAMWriteDword unsigned int Address unsigned long Data Parameter Address input The specified address of DPRAM where users want to write data Data input The double word data written to the DPRAM of I 8120W Return _NO_ERR OK _DPRAM_OVER_RANGE The Address of input parameter is over 6996 I 8120W User s Manual Version 1 02 June 9 2009 110 5 1 10 DPRAMWriteMultiByte Description Write multi byte data into the specified address of DPRAM of l 8120W The DPR
Download Pdf Manuals
Related Search
Related Contents
Manual del usuario Chapter 1 Introducing the Payroll Attendance Collection System TOHO ELECTRONICS INC. 取扱説明書 通信編 T。SHーBA 東芝吊下げ装置アダプター取扱説明書 Lightolier MFE-T5 User's Manual RealPresence Group 700 AM(FL) (CAN) fre foreword.qxp Samsung LE32B550 Manuel de l'utilisateur Samsung WF0790NCX User Manual Copyright © All rights reserved.
Failed to retrieve file