Home

4.1 DLL Function Definition and Description

image

Contents

1. Then the Install Shield will start the driver installation process and copy the related material to the indicated directory and then register the driver on your computer The driver target directory is as below for the different systems Windows NT 2000 WINNT SYSTEM32 DRIVERS Windows 98 Me XP WINDOWS SYSTEM32 DRIVERS PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 13 4 Installation DLL Driver The DLL driver is the collection of function calls on the PISO CAN400 PISO CAN200 cards used for Windows 98 Me NT 2000 XP systems The application structure is presented in the following figure The user application programs which have been developed by the following designated tools VB Delphi and Borland C Builder etc can call the PISOCAN DLL driver in user mode And then the DLL driver will bypass the function call into the KP_CAN sys and windrvr6 sys to access the hardware system as shown in the following Figure Application pisocan dll User Mode KP CAN sys windrvr6 sys PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 14 4 1 DLL Function Definition and Description All the functions provided in the PISO CAN400 200 are listed in the following table and detailed information for every function is presented in the following sub section However in order to make the descriptions more simplified and clear the attributes for the both the input and output parameter functions are
2. given as input and output respectively as shown in following table Keyword Set parameter by user before calling this function Get the data from this parameter after calling this function input Yes No output No PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 15 Table 4 1 DLL function definition Function definition Int CAN GetDliVersion Int CAN TotalBoard Int CAN GetCardinf BYTE BoardNo DWORD dwVID DWORD dwDID DWORD dwSVID DWORD dwSDID DWORD dwirqNo Int CAN_ActiveBoard BYTE wBoardNo Int CAN_CloseBoard BYTE wBoardNo int CAN_BoardlsActive BYTE BoardNo int CAN_Reset BYTE BoardNo BYTE Port int CAN_Init BYTE wBoardNo BYTE Port int CAN_Config BYTE BoardNo BYTE Port ConfigStruct CanConfig int CAN EnableRxlrg BYTE BoardNo BYTE Port int CAN_DisableRxlrq BYTE BoardNo BYTE Port int CAN RxiraStatus BYTE BoardNo BYTE Port BYTE bStatus int CAN Installlra BYTE BoardNo int CAN_Removelrq BYTE BoardNo int CAN_IrqStatus BYTE BoardNo BYTE bStatus int CAN_Status BYTE BoardNo BYTE Port BYTE bStatus int CAN_SendMsg BYTE BoardNo BYTE Port PacketStruct CanPacket int CAN_RxMsgCount BYTE BoardNo BYTE Port int CAN_ReceiveMsg BYTE BoardNo BYTE Port PacketStruct CanPacket int CAN ClearSoftBuffer BYTE BoardNo BYTE Port int CAN_ClearDataOverru
3. sten of Application y CAN_ActiveBoard y CAN_Reset y CAN_Init v CAN_Config v CAN_SendMsg v CAN_CloseBoard y Ena of Application Figure 4 1 Flow Chart Send CAN Massage PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 42 Ce N tart of Application v CAN_ActiveBoard y CAN_Reset Ad CAN Init y CAN_Config lt CAN_RxMsgCount gt 0 NO CAN_ReceiveMsg y CAN_CloseBoard e End of Application Figure 4 2 Flow Chart Receive CAN Massage PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 43 E D Start of Application CAN_ActiveBoard y CAN_Reset y CAN_Init v CAN_Config y CAN_EnableRxlrq y CAN Installlrg 4 CAN_RxMsgCount gt 0 NO YES y CAN_ReceiveMsg v CAN_DisableRxirq y CAN_Removelrq y CAN_CloseBoard Y Era of Application Figure 4 3 Flow Chart Receive CAN Massage with IRQ PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 44 5 Demo Programs for Windows All of demo programs will not work normally if DLL driver would not be installed correctly During the installation process of DLL driver t
4. It can be installed in a 5V 32 bit PCI slot and is supported with actual Plug amp Play technology PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 4 1 2 Features PCI BUS interface 2500Vrms photo isolation protection Four or two independent CAN communication ports Compatible with CAN specification 2 0 parts A and B On board optical isolation protection Programmable transfer rate up to 1 Mbps Jumper select 1200 terminator resistor for each port Direct memory mapping to the CAN controllers 33MHz 32bit 5V PCI bus V2 1 plug and play technology Driver supported for Windows 98 ME NT4 2000 XP 1 3 Specifications CAN controller Phillips SJA1000T CAN transceiver Phillips 82C250 251 Signal support CAN_H CAN L CAN controller frequency 16 MHz Connector 5 pin screw terminal connector or 9 pin D sub male connector Isolation voltage 2500Vrms Power requirements CAN400 5V 640mA CAN200 5V 380mA Environmental Operating temp 0 60 C Storage temp 20 80 C Humidity 0 90 non condensing Dimensions 130mm X 110mm PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 5 1 4 Product Check List Besides this manual the package includes the following items o PISO CAN400 CAN200 card o ADP 9 Board for PISO CAN400 only On Software CD ROM o User manual It is recommended that users read the release note first All the important information needed will be provided in the
5. No Use CAN_L No Use No Use Shield No Use CAN_H 1 2 3 4 5 6 7 8 GO PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 11 2 4 Installation 1 Configure the jumper settings on your PISO CAN400 PISO CAN200 in accordance with your particular requirements 2 Shutdown your system and take off the chassis of your machine 3 Plug in your PISO CAN400 CAN200 into a suitable empty PCI slot 4 Replace your chassis 5 Plug your CAN bus cable s into the 5 pin screw terminal connector or the 9 pin D sub connector 6 When the hardware installation is complete please turn on the computer again PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 12 3 Software Installation The PISO CAN400 PISO CAN200 can be used in 98 Me NT 2000 XP Windows environments For these Windows operation systems the recommended installation procedure is given as follows Step 1 Step 2 Step 3 Step 4 Step 5 Insert the product CD into the CD ROM driver and wait a few seconds until the installation program starts automatically If it cannot be started automatically for some reason please double click the file NAPDOS AUTO32 EXE on this CD Click the first item Toolkits Software Manuals Click the item PCI Bus DAQ Card Click PISO CAN 400 200 Click install Toolkit for Windows 98 Or Me NT 2000 XP which is based on the operation system you used
6. e Return CAN_NoError OK CAN_DriverError Kernel driver can t be opened CAN BoardNumberError BoardNo is not correct or exceeds the current total board number CAN_ActiveBoardError This board is not activated CAN RemovelrgFailure Disable or stop IRQ failure PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 30 4 1 15 CAN_IrqStatus Description Obtain IRQ status of the PISO CAN200 400 board Syntax int CAN_IrqStatus BYTE BoardNo BYTE bStatus Parameter BoardNo input PISO CAN board number 0 7 bStatus output 0 gt IRQ disable 1 IRQ enable Return CAN_NoError OK CAN_DriverError Kernel driver can t be opened CAN BoardNumberError BoardNo is not correct or exceeds the current total board number CAN ActiveBoardError This board is not activated PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 31 4 1 16 CAN_Status Description Obtain the status of CAN controller for PLISO CAN400 200 board Syntax int CAN_Status BYTE BoardNo BYTE Port BYTE bStatus Parameter BoardNo input PISO CAN board number 0 7 bStatus output Status value of CAN controller Table 4 2 Bit interpretation of the bStatus STATUS Bus Status bus off bus on Error Status error ok Transmit Status transmit idle Receive Status receive idle Transmission Complete Status complete incomplete Transmit Buffer
7. 2 frame area the CAN message received by CAN port 2 will be presented in TEXT box This is shown in the below screenshot Note that if port 2 displays a warning message like CAN Data Overrun then it is an indication that the un read messages within the 64 bytes RXFIFO CAN buffer have been covered by another message This means that the messages that are being received from the CAN bus may be in error and or they may be missing part of the message Then the user can click on the Clear Overrun button to clear the RXFIFO buffer overrun status within the CAN controller PISO CAN400 200 demo Port 1 ID hex RTA DLC 1 2 3 4 5 6 7 8 EXIT 123 0 8 11 22 33 44 55 es 77 es Extened 29 bit ID Status E Send Port 2 01 Mode 0 1D 123h ATR 0 DLC 8 Datafhex 11 22 33 44 55 66 77 88 TimeStamp 3734 3343581 377 sec Figure 6 1 The form of demo program PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 46 DEMO2 In demo 2 we provide a demonstration on how to send out a CAN message through port 1 and receive the CAN message in port 2 by means of the interrupt mode Contained within this operation the user can key in the CAN message into the port 1 frame area and click on the Send button to send out the CAN message At the same time the CAN message will be received at port 2 by means of the interrupt mode As shown in the following figure port 2 can automatically receive the CAN me
8. PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 21 4 1 7 CAN_Reset Description Hardware reset CAN controller Syntax int CAN Reset BYTE BoardNo BYTE Port Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 Return CAN_NoError OK CAN_DriverError Kernel driver can t be opened CAN BoardNumberError BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 22 4 1 8 CAN_Init Description Initiate CAN controller Syntax int CAN Init BYTE BoardNo BYTE Port Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 Return CAN_NoError OK CAN_DriverError Kernel driver can t be opened CAN_BoardNumber Error BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated CAN_InitError Initiating CAN controller failure PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 23 4 1 9 CAN_Config e Description Configure CAN controller After calling this function the CAN controller will enter operating mode Syntax int CAN_Config BYTE BoardNo BYTE Port ConfigStruct CanConfig Para
9. card or not The message filter general concept is shown in Figure A 1 The Acceptance Code Register is mainly used for deciding what kind of message ID the CAN card will accept The Acceptance Mask Register is mainly used for deciding which bit of message ID will need to check by using the Acceptance Code Register If the bit of the Acceptance Mask is set to 0 it means that the bit in the same position of message ID needs to be checked Acceptance Filtering CAN Message ven AMRO AMR1 AMR2 AMR3 a Fees a 8 Bits used for acceptance filtering Receive da FIFO Filter OR Extended Frame RTR bit 11 bit Identifier p 18 bit Identifier j Bits used for acceptance filtering Figure A 1 Acceptance Filter PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 54 Example 1 Assume that a message with a Standard Frame is considered The Acceptance Code Registers ACRn and Acceptance Mask Registers AMRn is set as follows n 0 1 upper 4 bits ACRn 01xx x010 xxxx XXXX XXXX XXXX XXXX AMRn 0011 1000 1111 1111 1111 1111 1111 Accepted messages ID 28 ID 18 RTR x don t care only the upper 4 bits of ACHT and AMR1 are used O1xx x010 XXXX In this case the ACRO and the AMRO are used for the upper 8 bits of message ID The upper 4 bits of the ACR1 and AMR1 are used for the lower 3 bits of the message ID and RTR bit The lower 4 bits of the ACR1 and AMR1 are useless The ACR2 a
10. release note as follows o Where you can find the software driver utility and demo programs o How to install software amp utility o Where is the diagnostic program o FAQ s and answers 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 PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 6 2 Hardware Configuration This section will describe the hardware settings of the PISO CAN400 PISO CAN200 This information includes the wire connection and terminal resistance configuration for the CAN network 2 1 Board Layout it H PCI bridge chip PIO CAN200 Figure2 1 PISO CAN200 Board LAYOUT PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 7 Je GI kees some B smoor JP8 oS e es m smoor PCI bridge chip P2 D seer ela PIO CAN400 Figure2 2 PISO CAN400 Board LAYOUT Figure2 3 ADP 9 Board LAYOUT For PISO CAN400 Only PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 8 2 2 Jumper Selection Table 2 1 Jumper Selections Description Status CAN Port 3 Connector connecting PISO CAN400 board and ADP 9 board JP1 vi H 123 Pin1 CAN L Pin2 CAN H Pin3 Shield CAN Port 4 Connector connecting PISO CAN400 board and ADP 9 board Port 1 terminator resister 120 Q sel
11. Error Set to Acceptance Code Register error CAN SetAMRError Set to Acceptance Mask Register error CAN SetBaudRateError Set Baud Rate error CAN EnableRxlrgFailure Enable CAN chip receive interrupt CAN DisableRxliraFailure CAN InstalllraFailure Installing PCI board IRQ failure CAN_RemovelrqFailure Removing PCI board IRQ failure CAN_TransmitBufferLocked Transmit buffer in CAN chip is locked CAN Transmitlncomplete Previously transmission is not yet completed CAN_ReceiveBufferEmpty CAN chip RXFIFO is empty CAN_DataOverrun Data was lost because there was not enough space in CAN chip RXFIFO CAN_ReceiveError Receive data is not completed CAN_SoftBufferlsEmpty Software buffer in driver is empty PISO CAN400 PISO CAN 200 User s Manual CAN SoftBufferlsFull Software buffer in driver is full Ver 1 2 07 28 06 41 4 3 Flow Diagram for Application In this section we will show the operation procedure of PISO CAN board for sending and receiving CAN message Figure 4 1 presents the Send CAN Message procedure Figure 4 2 and 4 3 stand for the receiving CAN Message in polling and in interrupt mode respectively Users need to follow the operation principle of PISO CAN board for correctly and easily send and receive the CAN message through CAN network For more detail information please refer to the demo programs in section 5
12. O CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 2 4 2 Table of Return Code RR RR RR RR RR RR RR RR RR RR RR RR RR RR RR RR Re Re 41 4 3 Flow Diagram for Application EE OE ER EE 42 5 Demo Programs for WindOWS sesse ER RR RR RR RR RR RR RR RR RR RR RR RR RR RR RR RR RR RR RR n 45 6 Utility Program for WindOWS essens ee RR RR EER anna ann nana RER ERG ee 48 7 ee El Tt E 54 7 1 Acceptance FINCTING seinen 54 PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 3 1 General Information 1 1 Introduction The CAN Controller Area Network is a serial communication protocol which efficiently supports distributed real time control with a very high level of security It is especially suited for networking intelligent devices as well as sensors and actuators within a system or sub system In CAN networks there is no addressing of subscribers or stations in the conventional sense but instead prioritized messages are transmitted As a stand alone CAN controller PISO CAN400 PISO CAN200 represents an economic solution within which an active CAN board can have two or four independent CAN bus communication ports with either a 5 pin screw terminal connector or a 9 pin D sub connector It can be used as master slave function to cover a wide range of CAN applications In addition the PISO CAN400 PISO CAN200 uses the new Phillips SJA1000T and transceiver 82C250 251 which provide the bus arbitration and error detection
13. PISO CAN400 D T PISO CAN200 D T 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 2003 by ICP DAS All rights are reserved Trademark The names used for identification only maybe registered trademarks of their respective companies PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 1 Tables of Content 1 General IMTOFMAU OM EE KS GEKEN WE EG EES VER ve we ee Ge ee 4 1 1 E E d EE 4 ER TE 5 1 3 Specification S serie GR ee GR Ge Se ee De re GN 5 1 4 Product CHECK LIST issie ee sa ER El ee aa ni 6 Hardware Configuration ees ees esse see e ee RR RE EER ena naaa EE ER RR ER RR EER anna nana ee RR Ee 7 2 1 Board LAV OU Ui eed ede ee aa Ed wee Ede eds ed aa 7 2 2 Jumper Sel e HOM id ee de Ee Oe ee wed goe ee eN N Ge ee 9 2 3 Connector Pin Assignment sees EER RR ER RR RE REG e 10 2 3 1 5 pin screw terminal connector emma 10 2 3 2 9 pin D sub male co
14. Status release locked PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 32 Data Overrun Status overrun absent bitO Receive Buffer Status Return CAN_NoError OK full not empty empty CAN BoardNumberError BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 33 4 1 17 CAN_SendMsg Description Send a CAN message immediately Syntax int CAN SendMsg BYTE BoardNo BYTE Port PacketStruct CanPacket Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 CanPacket input The point of structure for CanPacket is defined as following typedef struct packet LONGLONG MsgTimeStamps BYTE mode DWORD id BYTE rtr BYTE len BYTE dataf 8 PacketStruct MsgTimeStamps Not use in this function mode 0 11 bit identifier 1 29 bit identifier id Identifier PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 34 rtr Remote transmission request len Data length data 8 data byte Return CAN_NoError OK CAN_BoardNumber Error BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated CAN_Tra
15. YTE BoardNo BYTE Port BYTE bStatus Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 bStatus output O receive interrupt disable 1 receive interrupt enable Return CAN_NoError OK CAN_DriverError Kernel driver can t be opened CAN BoardNumberError BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 28 4 1 13 CAN Installlrg Description Enable or start IRQ for PISO CAN400 200 Board Before calling this function CAN EnableRxlird must to be called first Syntax int CAN_Installlrq BYTE BoardNo Parameter BoardNo input PISO CAN board number 0 7 Return CAN_NoError OK CAN_DriverError Kernel driver can t be opened CAN_BoardNumber Error BoardNo is not correct or exceeds the current total board number CAN_ActiveBoardError This board is not activated CAN_InstalllrqFailure Enable or start IRQ failure PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 29 4 1 14 CAN_Removelrq e Description Disable or stop IRQ for PISO CAN400 200 Board After calling this function the interrupts for all CAN controllers on board will be disabled Syntax int CAN Removelra BYTE BoardNo Parameter BoardNo input PISO CAN board number 0 7
16. as following typedef struct packet LONGLONG MsgTimeStamps BYTE mode DWORD id BYTE rtr BYTE len BYTE data 8 PacketStruct PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 37 MsgTimeStamps This parameter will record the time with system clock counter when the CAN message is received from SJA1000 The system clock counter starts to count after the PC boots up If more than one CAN messages are received and stored in the 64 byte SJA1000 FIFO the time stamps of these CAN messages may be closed mode 0 11 bit identifier 1 29 bit identifier id Identifier rtr Remote transmission request len Data length data 8 data byte Return CAN_NoError OK CAN_BoardNumber Error BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated CAN_ConfigError Port has not been configured successfully CAN ReceiveBufferEmpty CAN controller s RXFIFO is empty CAN SoftBufferlsEmpty Software RX Buffer Is empty CAN SoftBufferlsFull Software RX Buffer Is full PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 38 4 1 20 CAN_ClearSoftBuffer e Description Clear the software buffer of the PISOCAN DLL driver Syntax int CAN_ClearSoftBuffer BYTE BoardNo BYTE Port Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 Retur
17. e Dialog Please click the Board No combo box to select which CAN board plugged on the pc will be used Then click Active Board button to activate it Configuration se Board p3 p Port1 Port2 Port3 Port4 Acceptance Code Acceptance Mack Baud Rate ACM 0 FI ACM 1 ed P et OO Check the Port Enable check boxes to enable CAN ports Then select CAN port tag According to CAN communication requirement users need to set the proper baud rate acceptance code and acceptance mask The Baud Rate combo box has eight kinds of baud 10K 20K 50K 125K 250K 500K 800K and 1M Users can also define the special baud by using BTO and BT1 field If users select the user defined baud rate users must have the background of the CAN chip SJA1000 Afterwards click OK to save the configuration PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 48 Configuration Baud No Board 0 2 Active Board Close Board M Port 3 l Port 4 Port1 Port2 Port3 Port4 Acceptance Code Acceptance Mask Baud Rate ACM 0 FF 125K D Ami EE gro oo ACM 2 FF ACM 3 EF BT 1 00 2 Main Dialog The CAN Utility main dialog is as following figure There are 2 tags and 4 tags for two port card PISO CAN 200 and four port card PISO CAN 400 respectively In the bottom of the main dialog the status bar shows five parameters board number port status baud rate acceptance code and acceptance mask for t
18. ection JP2 JP2 1 es BE 12 3 3 Pint CAN L Pin2 CAN H Pin3 Shield Port 2 terminator resister 120 Q selection Port 3 terminator resister 120 Q selection Port 4 terminator resister 120 Q selection PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 2 3 Connector Pin Assignment The PISO CAN400 T PISO CAN200 T are equipped with four two sets of 5 pin screw terminal connectors and the PISO CAN400 D PISO CAN200 D are equipped with four two sets of 9 pin D sub male connectors for wire connection of the CAN bus The connector s pin assignment is specified as follows 2 3 1 5 pin screw terminal connector The 5 pin screw terminal connector of the CAN bus interface is shown in Figure 2 4 The details for the pin assignment are presented in Table 2 2 CAN L Shield CAN H Figure2 4 S5 pin screw terminal connector Table 2 2 Pin assignment of 5 pin screw terminal connector 5 pin screw terminal connectors pin assignment No Use CAN_L Shield CAN_H No Use PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 10 2 3 2 9 pin D sub male connectors The 9 pin D sub male connector of the CAN bus interface is shown in Figure 2 5 and the corresponding pin assignments are given in Table 2 3 CAN L Shield CAN H Figure2 5 9 pin D sub male connector Table 2 3 Pin assignment of the 9 pin D sub male connector D sub male connector pin assignment
19. he install shields will register the correct kernel driver to the operation system and copy the DLL driver and demo programs to the correct position based on the driver software package you have selected Win98 Me NT win2000 XP After driver installation the related demo programs and development library and declaration header files for different development environments are presented as follows Demo 2 demo program BCB3 gt for Borland C Builder 3 CAN H gt Header file PISOCAN LIB gt Linkage library for BCB Delphi4 gt for Delphi 4 CAN PAS 2 Declaration file VB6 gt for Visual Basic 6 CAN BAS gt Declaration file The list of demo programs DEMO1 Transmit and receive CAN messages DEMO2 Transmit and receive CAN messages with IRQ PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 45 A brief introduction of the demo programs DEMO1 Demo1 is the example used for starting the PISO CAN board This demo program is designed to send out the CAN message through Port 1 and receive the CAN message immediately at port 2 in the same PISO CAN board Before exercising this demo the user needs to finish the CAN median wiring connection between port 1 and port 2 Based on this demo the user can key in the CAN message into the port 1 frame area and then click the Send button in order to send out the CAN message to port 2 If you click the Receive button in the CAN port
20. he selected port a CANUtility PISO CAN 400 Open Save Configure About Port Port2 Port3 Port4 Mode ID RITR Dien DOG Dich DaN D3 D4 Dem D6 D7 Timer ms 0 2ab o s 1a 2b 3c ad Se or 77 s8 0 NO Model ID RTR L DOT Di D2 D3 D4 D5 D6 D Timer Status pag Modify Delete Send D6 D7 Time Stampsis a Rx Panos Format IDM Scrolling see Port Status Enable Band Rate 125K ACC Code 00 00 00 00 ACC Mask FF FF FF FF PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 49 3 CAN Transmission Function In the CAN port transmits part page as follow figure there are four function buttons for transmission list to use Open Save Configure About Port Port2 Port3 Port4 Mode IDihex RIR Den DOO Dih D2h D3h D4th D5 D6th D h Timerims DESCH po ge d2 a 500 ta 2B SC 4D 3E OF TE 0 88 77 G6F SE 4D 3C 2B 1A 500 Add Button User can key in the CAN message into the text boxes above the transmission list Then click add button to insert this CAN message into transmission list The transmission list can include maximum 20 CAN messages After adding the message into transmission list users can send this message to CAN network by using Send button Modify Button If users want to modify the content of some CAN message in the transmission list select this CAN messages in the transmission list firstly Then this CAN message
21. information will be shown in the text boxes above the transmission list Users can modify the CAN message in these text boxes directly Finally click Modify button to save the modification in the transmission list Delete Button If some CAN message in the transmission list is useless users can select it and click delete button to delete this CAN message from transmission list Send Button After users select one CAN message from transmission list click Send button to send this CAN message once from the selected CAN port If the timer parameter of this CAN message is not 0 the CAN message will be send depending on this timer parameter periodically In this case the status filed of this CAN message in transmission list will display Run and the text shown on the Send button will be changed to Pause If uses want to stop the message transmission click this button again There are only 5 CAN message can be sending cyclically from one CAN port at the same time PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 50 Ed CAN Utility Open Save Configure About Port Port2 Port3 Pond Mode Die RIR Den DOH Dm D2 D3 DAN Det Demi DIM Timer ms eben o 8 ss 77 eF 5E 4D 3c 2B TA ao Ao Mode D LRIR L DO pi D2 Ds Da p3 1 D6 1 D7 Tamer Sams Add LA 2B 3C 4D SE DR 77 68 0 8 8 77 ee SE 4D 3 2B 1A 501 CFD IT Delete 02 0 2CD 4 CAN Receive Function The followi
22. l Ver 1 2 07 28 06 25 4 1 10 CAN EnableRxlrg Description Enable receive interrupt for CAN controller Syntax int CAN EnableRxlra BYTE BoardNo BYTE Port Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 Return CAN_NoError OK CAN_DriverError Kernel driver can t be opened CAN_BoardNumber Error BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated CAN_EnableRxirqFailure Enable receive interrupt failure PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 26 4 1 11 CAN DisableRxlrg e Description Disable receive interrupt of the CAN controller Syntax Int CAN DisableRxIrq BYTE BoardNo BYTE Port Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 e Return CAN_NoError OK CAN_DriverError Kernel driver can t be opened CAN_BoardNumber Error BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated CAN DisableRxlraFailure Disable receive interrupt failure PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 27 4 1 12 CAN RxlrgStatus Description Obtain receive interrupt status of the CAN controller Syntax int CAN RxlrgStatus B
23. message in the ID mask list Afterwards if the CAN port receives the message with the ID set in ID mask list the CAN message will not shown in the reception list ID Masker ID 2BB Hex 2BB Scrolling Button When the button is pushed down the reception list is always scrolled automatically to the last received CAN message If this button is pushed up the reception list will stop to scroll automatically but reception list still get the CAN messages from CAN port The default status of this button is pushed down Clear Button Click this button to delete all CAN messages shown in the reception list PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 52 4 Menu Function There are four functions on the CAN Utility menu ES CANDtility SS Configure About Save Transmission Data Format ID Masker List Save Reception List Mos Open If users had have saved the transmission data format ID mask list information by using CAN Utility before users can click Open function to load the older records into these lists of CAN Utility If users only activate two CAN ports of the CAN and open a record file of four ports Both the lists of four ports will be loaded but the lists of port 3 and port 4 are useless Save It provides two functions Save Transmission Data Format ID Masker List and Save Reception List The first function is used for saving the transmission list data format list and ID ma
24. meter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 ConfigStruct input The point of structure for ConfigStruct is defined as following typedef struct config BYTE AccCode 4 BYTE AccMask 4 BYTE BaudRate BYTE BTO BT1 ConfigStruct AccCode 4 Acceptance code for CAN controller AccMask 4 Acceptance mask for CAN controller BaudRate 0 gt user defined must to set BTO BT1 1 10Kbps 2 20Kbps 3 S0Kbps 4 125Kbps 5 250Kbps PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 24 6 gt 500Kbps 7 BOOKbps 8 1Mbps BTO BT 1 user defined baud rate used only if BaudRate 0 For example BT0 0x04 BT1 0x1C then baud rate setting for the CAN controller is 100Kbps For more detail baud rate setting please refer to manual of SJA1000 CAN controller Return CAN NOoError OK CAN DriverError Kernel driver can t be opened CAN BoardNumberError BoardNo is not correct or exceeds the current total board number CAN PortNumberError Port number is not correct CAN ActiveBoardError This board is not activated CAN SoftfResetError CAN controller software reset error CAN_SetACRError Set Acceptance code to CAN controller error CAN_SetAMRError Set Acceptance mask to CAN controller error CAN_SetBaudRateError Set baud rate to CAN controller error CAN_ConfigError CAN controller enter operating mode failure PISO CAN400 PISO CAN 200 User s Manua
25. n CAN_NoError OK CAN BoardNumberError BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 39 4 1 21 CAN_GetSystemFreq e Description Clear the data overrun status bit for the CAN controller Syntax int CAN_ClearDataOverrun BYTE BoardNo BYTE Port Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 Return CAN_NoError OK CAN_BoardNumber Error BoardNo is not correct or exceeds the current total board number CAN_PortNumberError Port number is not correct CAN_ActiveBoardError This board is not activated CAN_ConfigError CAN controller enter operating mode failure PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 40 4 2 Table of Return Code Return Code Table 4 3 Interpretation of the return code Error ID Comment CAN_NoError OK CAN_DriverError Driver error CAN_ActiveBoardError This board can t be activated CAN_BoardNumberError The board number exceeds the maximum board number 7 CAN_PortNumberError The port number exceed the maximum port number CAN_ResetError CAN chip hardware reset error CAN_SoftResetError CAN chip software reset error CAN InitError CAN chip initiation error CAN ConfigError CAN chip configure error CAN SetACR
26. n BYTE BoardNo BYTE Port LONGLONG CAN_GetSystemFreq void PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 16 4 1 1 CAN GetDllVersion Description Obtain the version information of PISOCAN dIl driver Syntax WORD CAN GetDliVersion viod Parameter None Return DLL version information For example If 101 hex is return it means driver version is 1 01 4 1 2 CAN_TotalBoard e Description Obtain the total board number of PISO CAN boards installed in the PCI bus Syntax int CAN_TotalBoard void Parameter None Return Return the total board number PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 17 4 1 3 CAN_TotalBoard Description Obtain the information of PISO CAN boards which include vender ID device ID and interrupt number Syntax WORD CAN GetCardinf BYTE BoardNo DWORD dwVID DWORD dwDID DWORD dwSVID DWORD dwSDID DWORD dwSAuxID DWORD dwirqNo Parameter BoardNo input PISO CAN board number dwVID output vendor ID of this board dwDID output device ID of this board dwSVID output sub vendor ID of this board dwSDID output sub device ID of this board dwSAuxID output sub auxiliary ID of this board dwirq output logical interrupt number of this board Return CAN_NoError OK CAN_DriverError Kernel driver can not be opened CAN_BoardNumberError BoardNo exceeds the current t
27. nd AMR2 are used for the first data byte of the CAN message The ACR3 and AMR3 are used for the second data byte of the CAN message Therefore no matter the CAN message is remote transmit request message or not the message ID with the format 01xx x010 xxx will be accepted x means don t care PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 55 Example 2 Assume that a message with an Extended Frame is considered The Acceptance Code Registers ACRn and Acceptance Mask Registers AMRn is set as follows n 0 1 3 upper 6 bits ACRn 1011 0100 1011 000x 1100 ooo 0011 Oxxx AMRn 0000 0000 0000 0001 0000 1111 0000 0111 Accepted messages ID 28 ID O RTR x don t care only the upper 6 bits of ACR3 and AMR3 are used 1011 0100 1011 000x 1100 xxxx 0011 Ox In this case the lower 2 bits of AMR3 and AMR3 are useless All the other bits of Acceptance Code and Acceptance Mask will be used for the 29 bit message ID and the RTR bit Therefore no matter the CAN message is RTR remote transmit request message or not the message ID follows the format 1011 0100 1011 000x 1100 xxxx 0011 Ox x means don t care will be accepted PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 56
28. ng figure shows the receive part of a selected CAN port There are five functions for reception list NO Mode ID RIR L Do pi D2 D3 PA D5 De Di Time Stars 29648 EE 29650 373853 29654 621885 29655 626519 Board No 0 Port Status Enable Band Rate 125K ACC Code 00 00 00 00 ACC Mask FF FF FF FF Rx Pause Click this button to stop the CAN message reception from specific CAN port Click it again to continue the message reception Data Format In this function user can set what kind of format such as hexadecimal decimal or ASCII the CAN message with specific ID will be displayed on the reception list The setting dialog is as follows For example set the data format of the byte2 byte6 of the CAN message with ID 0x1AA to the decimal format Then the reception list will display the byte2 byte 6 data of the message with ID 0x1AA by using decimal format and display the other bytes of this message by using hexadecimal format Any message without configuring data format will be shown by using hexadecimal format Users can configure maximum 10 different ID messages in this dialog PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 51 Data Converter ID Maal From Byte 2 D Add Format Decimal D To Byte 6 Delete ID Mask If users don t show some message with specific ID on the reception list the ID mask function is useful for that As following figure users can set maximum 10 different ID
29. nnectors ee 11 E GK EE e RENE eo ee OE De SE ee OE GE Da Di es 12 Software Installation sessie EE Ge Ee Ee Ge Ge De EG ee Ed ke DE 13 Installation DLL Driver RR ee EE EE RR RR RR ee GEE EER RR RR RR Rea ee EE EE EER 14 4 1 DLL Function Definition and Description eise ee Ee 15 4 1 1 CAN_GetDIIVersiOn 1 cccsssccesseccensscecnsseeeceenenssesenesesenseeses 17 4 1 2 CAN _TOtalBOard ccsscccessecccnseeensseeenseeeeseeseessesenesesenseeses 17 4 1 3 CAN _TOtalBOatrd ccssscceeseccenseeenceeeeneeeeenseeeneseeenseeseneeenes 18 4 1 4 CAN ActiveBoard sees ees ee ER Ee KERE Ek KERK EER EK aaa Ek ka 19 4 1 5 CAN_CloseBoard ie ee SEE Ee ED Si ee naaa 20 4 1 6 CAN_BoardlsActive sees ee EK Ee KERE EK KEER KEER EK KEER Ek ke 21 4 1 7 CAN Reset sit ena EE ER EE EK EER EE KEER EK EER EK ee ee 22 4 1 8 GAN WN RR cer a An 23 4 1 9 CAN SCORING EE 24 4 1 10 CAN EnableRixlra usus sesse ss eegen 26 4 1 11 CAN DisableRxlrd ee EE EE EE 27 41 12 CAN HulrgSlalue eegen 28 4 113 TE E iintindi tonada od EE ES 29 4 1 14 CAN Removelrd ssssss EER EE EE 30 4 1 15 CAN IG TT 31 41 16 e TE EN 32 4117 CAN Send MSG nn a SE aaa 34 4118 CAN _RxMsgCount ss ste sesse Ee Ee Ee Ee Ee EER Ee 36 4 1 19 CAN ReceiveMsg mee EE EE GEGEE 37 4 1 20 CAN _ClearSoftBuffer c11cccccsscccesssceessesecssesensseeensseseneees 39 4 1 21 CAN GetSystemFred eiers EER RR RE EE EER EE EER RE 40 PIS
30. nsmitBufferLocked Transmit buffer in CAN chip is locked CAN Transmitlncomplete Transmission is not yet completed CAN_ConfigError Port has not been configured successfully PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 35 4 1 18 CAN_RxMsgCount Description Obtain the number of messages available within the CAN controller s RXFIFO or the software buffer 4KBytes After calling the functions CAN EnableRxlra and CAN_Installlrg the number of messages is within the software buffer otherwise it is within the CAN controller s RXFIFO Syntax int CAN_RxMsgCount BYTE BoardNo BYTE Port Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 Return The number of messages Note If the parameter for BoardNo or Port isn t correct the return value will always be 0 PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 36 4 1 19 CAN_ReceiveMsg Description Obtain receive message from CAN controller s RXFIFO or software buffer After calling the functions CAN_EnableRxirq and CAN Installlrq the messages is within the software buffer otherwise it is within the CAN controller s RXFIFO Syntax int CAN_ReceiveMsg BYTE BoardNo BYTE Port PacketStruct CanPacket Parameter BoardNo input PISO CAN board number 0 7 Port input CAN port number 1 4 or 1 2 CanPacket output The point of structure for CanPacket is defined
31. otal board number PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 18 4 1 4 CAN_ActiveBoard Description Activate the device It must be called once before using the other functions of PISO CAN400 200 board Syntax int CAN_ActiveBoard BYTE BoardNo Parameter BoardNo input PISO CAN400 200 board number 0 7 Return CAN_NoError OK CAN_BoardNumberError BoardNo exceeds the current total board number CAN_ActiveBoardError This board can not be activated or kernel driver can not be found PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 19 4 1 5 CAN_CloseBoard Description Stop and close the kernel driver and release the device resource from computer device resource This method must be called once before exiting the user s application program Syntax int CAN CloseBoard BYTE BoardNo Parameter BoardNo input PISO CAN400 200 board number 0 7 Return CAN_NoError OK CAN_ActiveBoardError The board is not activated CAN_BoardNumberError BoardNo exceeds the current total board number PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 20 4 1 6 CAN_BoardlsActive Description Obtain the information about the specific board is active or not Syntax int CAN BoardlsActive BYTE BoardNo Parameter BoardNo input PISO CAN400 200 board number Return 0 means the board is inactive 1 means the board is active
32. sk list of each CAN port to a txt file The second function Save Receive List is used for saving the CAN messages that is received on the reception list The data in the reception list of each different CAN port will be saved into different txt file except that the reception list has no message For example if users want to save the data in the reception list to test txt file generally these data will be saved to four txt files text port01 td text_port02 txt text_port03 txt and text_port04 txt when users using PISO CAN400 If the reception list of the port 2 has no data the text port02 txt file will not be produced If the port 2 had the list information although this port is disabled later the text port02 txt is still produced Configure If users want to change the CAN port setting Users can click Configure to re configure the CAN board Please refer to 1 CAN Configure Dialog for more detail information About Show the information about the CAN Utility version and the ICP DAS home page PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 53 7 Appendix 7 1 Acceptance Filtering Four 8 bits Acceptance Code registers ACO AC1 AC2 and AC3 and Acceptance Mask registers AMO AM1 AM2 and AM3 are available for a various filtering of messages These registers can be used for controlling a 4 byte filter which can check the specific bits of a CAN message and decide if this message will be passed to the CAN
33. ssage and store it within the 4K bytes of buffer software When the user clicks the Receive button all the messages stored in the 4K bytes buffer will all be presented in the TEXT edit area as shown in the following figure w PIO CAN400 200 demo2 Port 1 ID thes RTR DLC 1 EXIT l Extened 29 bit ID Status E Send Port 2 01 Mode 0 ID 1h ATR 0 DLC 8 Datafhex 11 22 33 44 55 66 77 88 TimeStamp 3843 35030346036sec 02 Mode 0 ID 2h ATR 0 DLC 8 Datafhex 11 22 33 44 55 66 77 88 TimeStamp 3845 32033764068sec 03 Mode 0 ID 3h ATR 0 DLC 8 Datafhex 11 22 33 44 55 66 77 88 TimeStamp 3847 068891 71 668sec 04 Mode 0 ID 4h ATR 0 DLC 8 Datafhex 11 22 33 44 55 66 77 88 TimeStamp 3848 84192571 961 sec 05 Mode 0 ID 5h ATR 0 DLC 8 Datafhex 11 22 33 44 55 66 77 88 TimeStamp 3850 62713166059sec Status iS Figure 6 2 The form of demo2 program PISO CAN400 PISO CAN 200 User s Manual Ver 1 2 07 28 06 47 6 Utility Program for Windows For PISO_CAN200 CAN400 we provide a friendly CAN bus utility tool to allow users to send receive the CAN messages to from CAN network easily This utility tool can be thought as a useful tool for monitoring CAN messages or testing CAN devices on the CAN network It supplies several functions such as sending CAN messages receiving CAN messages storing CAN messages cyclic transmission and so forth The operation principle will be addressed in the following sub section 1 CAN Configur

Download Pdf Manuals

image

Related Search

Related Contents

  Topten Product Criteria Paper on Computers  here - TDL Tech  Jovy Systems User Manual - jovy  De Luxe Operator Manual  CHAKRAS : mode d`emploi  Severin SM 9494  CA 8120 Istruzioni per l`uso  L`actualité des services aux entreprises N°23  396 lb. Wall Mounted Tire Rack  

Copyright © All rights reserved.
Failed to retrieve file