Home
PCI-7841/cPCI-7841/PM-7841 Dual-Port Isolated CAN
Contents
1. 39 CanGetLedStatUS u nanna nanan nnn nA uu u uu Au uu WW WWW AWAR 39 40 DOS 0 1 ERRORES EEPIDDUN 42 CaninstallCallBack eese esee eaae eren sees nane naar nana nn nnn 42 CanRemoveCallBack esses eese eene nennen nnn nnn 43 Windows 95 98 Environment 2 ee rree essen eiie nnns 44 CaninstallEvent Lecce rrr Leer iriserai anaana 45 Window NT environment g Op ONES C 3 3 DEVICENET LAYER 47 48 lt lt lt lt lt 49 50 52 MR E E A rz 54 55 hung co RD 56 Inii5 1 2 1 anria aaaeaii 56 1 119 1 0 0
2. 57 DM RL Cl GE 0 j RR DEP EID DR 57 huele nd MERE PR 58 PR SIL LSU YJ PETENTE 60 ul Gi DTE 60 MM 61 62 DNBSLASDTN ERE EE 63 uult T E PA A E A E 63 BAE A OOR 64 naaraan naana 65 nsus m 65 WD OC EET 66 DNetSetWDO PME 67 68 69 ny irs ud N E 69 5 100 20 uu Wa kK KER 70 20 71 DNetSetAIP csekusakekakaaaka nanan akaaaknkakaae ka kana ia yanan 72 17 5190 E E 73 DII Li m X 74 Introduction The PCl cPCI PM 7841 is a Controller Area Network CAN interface card used for industrial PC with PCI and PC104 bus It supports dual ports CAN s interface that can run independently or bridged at the same time The built in CAN controller provides bus arbitration and error detection with auto correction and re transmission function The PCI cards are plug and play therefore it is not necessary to set any jumper for matching the PC environment The CAN Controller Area Network is a ser
3. Parameters handle handle retrieve from CanOpenDriver value byte value Return Value value Remarks This function set the current of the transmit error counter Please see the remark of CanGetTxErrorCount See Also CanRcvMsg Usage C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 CanSetRxErrorCount handle 0 CanCloseDriver handle Visual Basic Windows 95 98 CanGetPortStatus Purpose Clear data overrun status Prototype C C void CanClearOverrun int handle Visual Basic Windows 95 98 Parameters hande handle retrieve from CanOpenDriver Return Value none Remarks Clear the data overrun status and clean the buffer See Also CanRcvMsg Usage C C include pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 CanClearOverrun CanCloseDriver handle Visual Basic Windows 95 98 CanGetLedStatus Purpose Get the LED status of cPCI 7841 and PM 7841 Prototype C C BYTE CanGetLedStatus int card int index Visual Basic Windows 95 98 Parameters card card number index index of LED Return Value Remarks See Also Usage status of Led Value Function 0 Led Off 1 Led On Get the status of Led This function supports the cPCI 7841 and PM 7841 CanSetLEDStatus C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 BYTE flag CanGetLedStatus 0 0 CanCloseDr
4. Parameters Return Value Remarks See Also Usage DNetAIP Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned Return 0 is successful 1 if error occurs Get Identity Object Information The Table is a part of DeviceNet Information C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID DestMAC ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 Purpose Prototype Parameters Get the Information of DeviceNet Identity object C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC ID BYTE DestMAC_ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 handle 4 handle retrieve from CanOpenDriver HostMAC ID the MAC ID of your port Return Value ID Destination ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned data Return 0 is successful 1 if error Remarks Get Identity Object Information The Table is a part of DeviceNet Information See Also Usage C C DOS and Win
5. handle handle retrieve from CanOpenDriver len the length in the argument argu E a 8 length storage Return 0 is successful 1 if error occurs Send a Poll IO packet to a opened port Poll IO command in DeviceNet is different from module to module This function will pack your request to DeviceNet Poll IO master request and send it to network Note you should open an IO connection first RcvDeviceNetPacket C C DOS and Windows 95 98 Zinclude pci7841 h int handle CanOpenDriver 0 0 BYTE data 8 data 0 0x00 SendIO handle 0 data 0 Visual Basic Windows 95 98 DNetRcvIO Purpose Prototype Parameters Return Value Remarks See Also Usage Receive a DeviceNet packet from a CAN port C C DOS and Windows 95 98 int DNetRcvIO int handle BYTE DestMAC ID BYTE argu Visual Basic Windows 95 98 handle 4 handle retrieve from CanOpenDriver ID Destination ID argu 8 byte array Return 1 if error occurs others is the returned data length Receive a Poll IO from a opened port The Slave I O response message is Group 1 message id 15 DnetRcvIO will drop other group id until timeout or receive right packet RcvDeviceNetPacket C C 005 and Windows 95 98 Zinclude pci784 1 h int handle 2 CanOpenDriver 0 0 int len BYTE data 6 len DNetRcvIO handle data Visual Basic Windows 95 98 DeviceNet layer Connection establishing relea
6. DOS and Windows 95 98 Change ID to address 63 if DNetSetID handle HostMAC_ID DestMAC_ID 63 0 Set failed Visual Basic Windows 95 98 DNetSetBaud Purpose Prototype Parameters Return Value Remarks See Also Usage Set the baud rate of device C C DOS and Windows 95 98 int DNetSetBaud int handle BYTE HostMAC ID BYTE DestMAC_ID BYTE NewBaudrate Visual Basic Windows 95 98 handle f handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID NewBaudrate new baudrate Return 0 is successful 1 if error occurs Set the new baud rate The newer configuration of baud rate would be activated after a software Reset command or re power on C C DOS and Windows 95 98 Set baud rate as 500 Kbps if DNetSetBaud handle HostMAC_ID DestMAC_ID 2 0 DNetAsmIn Set failed Visual Basic Windows 95 98 Purpose Prototype Parameters Return Value Get the Assembly Input object of DeviceNet object C C DOS and Windows 95 98 int DNetAsmIn int handle BYTE ID BYTE DestMAC ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver ID the ID of your port ID Destination ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array retu
7. If the watchdog function be enable the watchdog event would be signaled after the timeout time with receiving anything from the master The activity is configured by DNetSetWD See Also Usage C C DOS and Windows 95 98 Visual Basic Windows 95 98 DNetSetWD Purpose Get the Information of DeviceNet Identity object Prototype C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC ID BYTE DestMAC_ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver ID the D of your port ID Destination ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned data Return Value Return 0 is successful 1 if error occurs Remarks Get Identity Object Information The Table is a part of DeviceNet Information See Also Usage C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 DNetConnIO Purpose Prototype Parameters Return Value Remarks See Also Usage Get the Information of DeviceNet Identity object C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC_ID BY
8. you should not need to change the jumper settings A jumper switch is closed sometimes referred to as shorted with the plastic cap in serted over two pins of the jumper A jumper is open with the plastic cap inserted over one or no pin s of the jumper 2 5 Base Address Setting The PM 7841 requires 16 consecutive address locations in I O address space The base address of the PM 7841 is restricted by the following conditions 1 The base address must be within the range 200hex to 3FOhex 2 The base address should not conflict with any PC reserved I O address The PM 7841 s 1 0 port base address is selectable by an 5 position DIP switch SW1 refer to Table 2 1 The address settings for I O port from Hex 200 to Hex is described in Table 2 2 below The default base address of your PM 7841 is set to hex 200 in the factory see Figure below SW1 Base Address 0x200 ON 1 2 3 4 5 A 8 7 6 5 4 Figure Default Base Address Configuration port fixed 1 2 3 4 5 address hex 9 A8 A7 A6 A5 A4 default m ON 0 X don t care OFF 1 Note A4 A9 correspond to PC 104 ISA bus address lines 2 6 IRQ Level Setting A hardware interrupt can be triggered by the external Interrupt signal which is from JP3 ad The jumper setting is specified as below Note Be aware that there is no other add on cards sharing the same interrupt level in the system Interrupt Default Setting IRQ15 IRQ X
9. 95 98 Parameters handle handle retrieve from CanOpenDriver Return Value value Remarks See Also Usage This function reflects the current of the receive error counter After hardware reset happened the value returned would be initialized to 0 If a bus off event occurs the returned value would be 0 CanRcvMsg C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 BYTE error count CanGetTxErrorCount CanCloseDriver handle Visual Basic Windows 95 98 CanGetTxErrorCount Purpose Get the current value of the transmit error counter Prototype C C BYTE CanGetTxErrorCount int handle Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver Return Value value Remarks This function reflects the current of the transmit error counter After hardware reset happened the value would set to 127 A bus off event occurs when the value reaches 255 You can call the CanSetTxErrorCount to set the value from 0 to 254 to clear the bus off event See Also CanRcvMsg Usage C C include pci7841 h int handle CanOpenDriver 0 0 open port 0 of card 0 BYTE error count CanGetRxErrorCount handle CanCloseDriver handle Visual Basic Windows 95 98 CanSetTxErrorCount Purpose Set the current value of the transmit error counter Prototype C C void CanSetTxErrorCount int handle BYTE value Visual Basic Windows 95 98
10. Functions CanEnableReceive Purpose Enable receive of a CAN port Prototype C C void CanEnableReceive int handle Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver Return Value none Remarks Call this function to enable receive Any packet on the network that can induce a interrupt on your computer If that packet can pass your acceptance code and acceptance mask setting So if your program doesn t want to be disturbed You can call CanDisableReceive to disable receive and CanEnableReceive to enable receives See Also CanDisableReceive Usage none CanDisableReceive Purpose Enable receive of a CAN port Prototype C C void CanEnableReceive int handle Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver Return Value none Remarks See Also Usage Please refer the CanEnableReceive CanEnableReceive none CanSendMsg Purpose Prototype Parameters Return Value Remarks See Also Usage Send can packet to a port C C int CanSendMsg int handle PACKET packet Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver packet data Return 0 is successful 1 if error occurs Send a message to an opened CAN port Actually this function copies the data to the sending queue Error occurs when the port has not been opened yet or the packet is a NULL pointer You can use the E
11. Remarks See Also Usage Receive a Group 2 DeviceNet packet from a CAN port C C DOS and Windows 95 98 int RcvGroup2Message int handle BYTE data Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver data 11 byte BYTE array After the function returns the data field stores argu O receiver MAC_ID argu 1 Message ID argu the returned data length argu 3 10 the returned data field 0 if successful 1 if timeout 50 ms 2 if received message was not Group 2 message 1 if null array Receive a DeviceNet Packet from a opened port Unlike the SendGroup2Message this function could be used to receive all kinds of packets you want if it is the Group 2 messages And the argument data is a 11 bytes array it is different RcvDeviceNetPacket C C DOS and Windows 95 98 Zinclude pci7841 h int handle 2 CanOpenDriver 0 0 BYTE data 11 int ret ret RcvGroup2Message handle data switch ret case 0 success case 1 timeout and received nothing case 2 received message is not Group 2 data is useless try to read again case error default unknown it should not happened Visual Basic Windows 95 98 DNetSendlO Purpose Prototype Parameters Return Value Remarks See Also Usage Send an IO command to a CAN port C C DOS and Windows 95 98 int SendIO int handle int len BYTE argu Visual Basic Windows 95 98
12. handle the exceptions CanSendMsg See the CanSendMsg CAN layer Status Functions CanClearOverrun Purpose Clear data overrun status Prototype C C void CanClearOverrun int handle Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver Return Value none Remarks See Also Usage Clear the data overrun status Sometimes if your system has heavy load and the bus is busy The data overrun would be signalled A Data Overrun signals that data are lost possibly causing inconsistencies in the system CanRcvMsg C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 CanClearOverrun handle CanCloseDriver handle Visual Basic Windows 95 98 CanClearRxBuffer Purpose Prototype Parameters Return Value Remarks See Also Usage Clear data in the receive buffer C C void CanClearRxBuffer int handle Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver none Clear the data in the receive buffer There are 2 type of buffer defined in the driver First one is the FIFO in the card the second one is the memory space inside the driver Both of them would be cleared after using this function CanRcvMsg C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open port 0 of card 0 CanClearRxBuffer handle CanCloseDriver handle Visual Basic Windows 95 98 CanClearTxBujfer Purpose
13. hardware and returns immediately It won t wait any response This function can send from group 1 to group 4 packet RcvDeviceNetPacket C C DOS and Windows 95 98 Zinclude pci7841 h int handle CanOpenDriver 0 0 DEVICENET_PACKET msg msg MAC_ID 63 msg MESSAGE_ID 7 msg Group 2 msg len 8 msg data 0 0x00 SendDeviceNetPacket handle amp msg Visual Basic Windows 95 98 RevDeviceNetPacket Purpose Prototype Parameters Return Value Remarks See Also Usage Receive a DeviceNet packet from a CAN port C C DOS and Windows 95 98 int RcvDeviceNetPacket int handle DEVICENET_PACKET packet Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver packet DEVICENET_PACKET format pointer Return 0 is successful 1 if error occurs Receive a DeviceNet Packet from a opened port This is the basic function of DeviceNet It receives a packet from a CAN port This function will wait 50 ms if there is nothing to read It can recognize group 1 to group 4 messages For an unknown packet the group field in the message would be 255 RcvDeviceNetPacket C C DOS and Windows 95 98 Zinclude pci7841 h int handle CanOpenDriver 0 0 DEVICENET_PACKET msg RcvDeviceNetPacket handle amp msg Visual Basic Windows 95 98 SendGroup2Message Purpose Send a DeviceNet group 2 packet to a CAN port Prototype C C DOS and Windows 95 98 int SendGroup2Message int
14. this function to detect the baud rate of a port The function performs an algorithm to detect your baud rate It needs that there are activities on the network And it will return a 1 when detecting no activity on the network or time was exceeded none C C Zinclude pci7841 h PORT STRUCT port_struct int handle CanOpenDriver port struct mode 0 4 CAN2 0A 11 bit CAN id port_struct accCode 0 This setting of acceptance code and port_struct accMask 0x7FF 7 4 mask enable all MAC IDs input port struct baudrate CanDetectBaudrate handle 1000 CanConfigPort handle amp port struct CanCloseDriver handle Visual Basic Windows 95 98 CanRead Purpose Prototype Parameters Return Value Direct read the register of PCI 7841 C C BYTE CanRead int handle int offset Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver offset offset of register Return data read from port Remarks Direct read the register of PCI 7841 See Also CanWrite Usage none CanWrite Purpose Direct write the register of PCI 7841 Prototype C C void CanWrite int handle int offset BYTE data Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver offset offset register data data write the port Return Value none Remarks See Also Usage Call this function to directly write a register PCI 7841 CanRead none CAN layer I O
15. 15 12 11 10 9 7 6 5 3 IRQ Setting 3 Function Reference The cPCI PCI 7841 functions are organize into the following sections layer functions Card Initialization and configuration functions W CAN layer I O functions W CAN layer status functions 4 CAN layer Error and Event Handling functions DeviceNet layer functions W Send and Receive packet functions Connection establish and release functions DeviceNet object class functions The particular functions associated with each function are presented in next page 3 1 Functions 7841 Initial CAN layer functions CanEnableReceive CanGetRcvOCnt CanSetErrorWarningLimit CanGetLedStatus CanSetLedStatus Error and Event handling functions Operation System DOS CanlnstallCallBack CanRemoveCallBack Windows 95 98 NT CaninstallEvent DeviceNet layer functions Function Type Send and Receive packet functions SendDeviceNetPacket RevDeviceNetPacket SendGroup2Message RevGroup2Message DNetSendlO DNetRcvIO Connection establish and release DNetOpenExp functions DNetCloseExp DNetOpenlO DNetCloselO DNetScan DeviceNet Object class functions DNetldentity DNetDNet DNetSetlID DNetSetBaud DNetAsmin 63 DNetAsmOut 63 DNetGetSafeOut 64 DNetSetSafeOut 65 DNetConnExp 65 DNetSetWDTi
16. 2 8 8 1 3 SPECHICETIONS 9 INSTALLATION ic RESET Aba ve Mar k R ka 10 2 1 BEFORE INSTALLATION PCI cPCI PM 7841 10 2 2 INSTALLING 7841 eese 10 2 3 INSTALLING CPCI 7841 11 24 1 kaka kusa daka lika sen adek krn anes 13 2 5 BASE ADDRESS SETTING g Op OPE 2 5 TERMINATION JUMPER g Op OPE FUNCTION REFERENCE menm ken nns 16 SU TEHHETIONE TABLE as isan adan ce ve kad dan bak n za ons nad aen cunc canes 17 3 1 1 PORT STRUCT structure define 18 3 1 2 PORT STATUS structure define 19 3 1 3 CAN PACKET structure define 20 3 1 4 DEVICENET PACKET structure define 20 3 2 LAYER FUNCTIONS reriiioci 22 PM7841_Install base irq chn 0xd000 22 GetDriverVersiorn uc ijj sisiku usni kkkk ks anna natnm rara nana Wu ku im mra Uu 23 24 1195 2 1 19 1 1 10 25 Can
17. Consumption 400mA 5VDC Typical without external 900 5VDC Maximum devices Size j g2 L mm x 98 PM 7841 Specification Table Ports 2 channels V2 0 _____ port address Set by DIP Switch Memory Mapped Space Power Consumption 400mA 5VDC Typical without external 900mA 5VDC Maximum 90 17 L mm x 95 89 devices 2 1 2 2 2 Installation This chapter describes how to install the PCI CPCI PM 7841 At first the contents in the package and unpacking information that you should be careful are described Before Installation PCI CPCI PM 7841 Your 7841 card contains sensitive electronic components that can be easily damaged by static electricity The card should be done a grounded anti static mat The operator should be wearing an anti static wristband grounded at the same point as the anti static mat Inspect the card module carton for obvious damage Shipping and handling may cause damage to your module Be sure there are no shipping and handing damages on the module before processing After opening the card module carton exact the system module and place it only on a grounded anti static surface component side up Note DO NOT APPLY POWER TO THE CARD IF IT HAS BEEN DAMAGED You are now ready to install your PCI CPCI PM 7841 Installing PCI 7841 What do you have In addition to this User s M
18. InstallCallBack 0 2 ErrorWarning CanRemoveCallBack 0 2 NULL Remove the call back function CanCloseDriver handle Windows 95 98 Environment CanGetReceiveEvent Purpose Install the event under Windows 95 98 NT system Prototype C C Windows 95 98 NT void CanGetReceiveEvent int handle HANDLE hevent Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver hevent HANDLE point for receive event Return Value none Remarks See Also Usage Retrieve receive notify event Under Windows 95 98 NT environment your program can wait the input message by waiting an event You can refer to following program to use this function But the CAN system is a heavy load system Under the full speed of course it depends on your system the hardware receives the message faster than the event occurs Under this condition the event could be combined by OS So the total count of event may be less than actually receive You can call the CanGetRcvCnt to retrieve the unread message in the driver s FIFO CanGetRcvCnt C C Windows 95 98 include pci7841 h HANDLE recvEvent0 int handle CanOpenDriver 0 0 open the port 0 of card 0 int countl if WaitForSingle Object rcvEvent0 INFINITE WAIT OBJECT 0 You need not to call ResetEvent err CanRcvMsg handle amp rcvMsg 0 rcvPatterns 0 rcvPatterns 0 cout CanGetRcvCnt handle 0 To retrieve n
19. NuCOM 7841 7841 7841 Dual Port Isolated CAN Interface Card User s Guide Copyright 1998 ADLink Technology Inc All Rights Reserved Manual first edition June 1 1998 Manual Rev 2 00 July 15 1998 Manual Rev 2 11 Oct 8 1999 Manual Rev 3 00 May 28 2000 The information in this document is subject to change without prior notice in order to improve reliability design and function and does not represent a commitment on the part of the manufacturer In no event will the manufacturer be liable for direct indirect special incidental or consequential damages arising out of the use or inability to use the product or documentation even if advised of the possibility of such damages This document contains proprietary information protected by copyright All rights are reserved No part of this manual may be reproduced by any mechanical electronic or other means in any form without prior written permission of the manufacturer Trademarks PCI 7841 cPCI 7841 and PM 7841 are registered trademarks of ADLink Technology Inc Other product names mentioned herein are used for identification purposes only and may be trademarks and or registered trademarks of their respective companies CONTENTS CONTENT a tlie eit netus 3 INTRODUCTION 2 test Bear ere Rea e E Re hr Ere had a WA ba n n ka 6 L5 NEN EE ADIR ES DELI 7 1
20. Prototype Parameters Return Value Remarks See Also Usage Clear Transmit Buffer C C void CanClearTxBuffer int handle Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver none Clear the data in the transmit buffer Under a busy DeviceNet Network your transmit request may not be done due to the busy in the network The hardware will send it automatically when bus is free The un send message would be stored in the memory of the driver The sequence of outgoing message is the FIRST IN FIRST OUT According this algorithm if your program need to send an emergency data you can clear the transmit buffer and send it again CanRcvMsg C C include pci7841 h int handle CanOpenDriver 0 0 open port 0 of card 0 CanClearTxBuffer handle CanCloseDriver handle Visual Basic Windows 95 98 CanGetErrorCode Purpose Prototype Parameters Return Value Get the Error Code C C BYTE CanGetErrorCode int handle Visual Basic Windows 95 98 handle error code Return error code is an 8 bit data handle retrieve from CanOpenDriver Bit Symbol Name Value Function 7 ERRC Error Code 1 6 ERRCO Error Code 0 5 DIR Direction 1 Rx error occurred during reception 0 Tx error occurred during transmission 4 SEG4 Segment 4 3 SEG3 Segment 3 2 SEG2 Segment 2 1 SEG1 Segment 1 0 SEGO Segment 0 Bit interpretati
21. TE DestMAC_ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver HostMAC ID the MAC D of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned data Return 0 is successful 1 if error occurs Get Identity Object Information The Table is a part of DeviceNet Information C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 DNetDIP Purpose Prototype Parameters Return Value Remarks See Also Usage DNetDOP Get the Information of DeviceNet Identity object C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC ID BYTE DestMAC_ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned data Return 0 is successful 1 if error occurs Get Identity Object Information The Table is a part of DeviceNet Information C C DOS and Windo
22. age DNetSetID Get the Information of DeviceNet DeviceNet object C C DOS and Windows 95 98 int DNetDNet int handle BYTE ID BYTE ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned data Return 0 is successful 1 if error occurs Get DeviceNet Object Information The Table is a part of DeviceNet Information C C DOS and Windows 95 98 BYTE argu 6 int baudrate Get the baudrate of the device DNetDNet handle HostMAC_ID DestMAC ID 1 2 argu baudrate argu 0 Visual Basic Windows 95 98 Purpose Prototype Parameters Change the MAC ID of the device C C DOS and Windows 95 98 int DNetSetID int handle BYTE HostMAC ID BYTE ID BYTE newMAC_ID Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Return Value Remarks See Also Usage newMAC ID revised ID Return 0 is successful 1 if error occurs Set new MAC ID of one device After success calling the device would send a duplicate check message immediately And previous connection will be lost You need to make a connection again C C
23. anGetErrorCode CanCloseDriver handle Visual Basic Windows 95 98 CanSetErrorWarningLimit Purpose Prototype Parameters Return Value Remarks See Also Usage Set the Error Warning Limit C C void CanSetErrorWarningLimit int handle BYTE value Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver value Error Warning Limit none Set the error warning limit If your program has installed the error warning event or call back function The error warning will be signaled after the value of error counter passing the limit you set CanGetErrorWarningLimit C C include pci7841 h int handle CanOpenDriver 0 0 open port 0 of card 0 CanSetErrorWarning handle 96 CanCloseDriver handle Visual Basic Windows 95 98 CanGetError Warning Limit Purpose Prototype Parameters Return Value Get the Error Warning Limit C C BYTE CanGetErrorWarningLimit int handle Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver none Remarks Get the error warning limit See Also CanSetErrorWarningLimit Usage C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 BYTE limit CanClearOverrun handle CanCloseDriver handle Visual Basic Windows 95 98 CanGetRxErrorCount Purpose Get the current value of the receive error counter Prototype C C BYTE CanGetRxErrorCount int handle Visual Basic Windows
24. anual the package includes the following items e PCI 7841 Dual Port PCI Isolated CAN Interface Card ADLink All xxxxx CD ROM If any of these items is missing damaged contact the dealer from whom you pur chased the product Save the shipping materials and carton in case you want to ship or store the product in the future PCI 7841 Layout us 7c r na 183 LT EIE c 1 n LR P L Ms 07 H lg Terminator Configuration eua En 120 Q terminal resistor is installed for each port while JP1 enables the terminal resistor for portO and JP2 enables the terminal resistor for port 1 Connector Pin Define The P3 and P4 are CAN connector the below picture is their pin define 2 3 Installing cPCI 7841 What do you have In addition to this User s Manual the package includes the following items e cPCI 7841 Dual Port Isolated CAN Interface Card e ADLink All xxxxx CD ROM If any of these items is missing or damaged contact the dealer from whom you pur chased the product Save the shipping materials and carton in case you want to ship or store the product in the future cPCI 7841 Layout J 0510 ecce oe LE POC z mm Terminator Configuration 120 Q terminal resistor is installed for each port while JP1 enables the terminal resistor for porto and JP2 enables the termi
25. ce if DNetIdentity handle HostMAC_ID DestMAC_ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98
26. config Port uos co an ku ku biku a un ku ku bunu u u uu n u nu uu 26 27 6 iTi CE Co 28 HET a a dar ra NANA NN E A A N DD A A NAN 28 29 29 bate Ia n ue ana ranan a kana 30 Det es eae 31 O E 32 CanClearRxBuffer u uunnunn nun u uu nnn n annuus 33 TX BURGH ET 34 EI car aa eza Code PEP 35 CanSetErrorWarninQLimit cccccssesseeeeccsscccssnssssseecsssssssssesssseesseees 36 CanGetErrorWarninGLitit c csccsssssseeeeccsscccsssssseeeecensssssssessseeesnees 37 CanGetRxErrorCouni 37 CanGetTXErrorCOunt 11 0ccccccccsssssseseecesssesssnsesseessssssussnaasneeessness 38 38 lt
27. dows 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID DestMAC_ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 DNetSetAIP Purpose Get the Information of DeviceNet Identity object Prototype C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC ID BYTE 1 int Instance int Attribute BYTE array Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute S Attribute of DeviceNet Identity Object array 5 returned data Return Value Return 0 is successful 1 if error occurs Remarks Get Identity Object Information The Table is a part of DeviceNet Information See Also Usage C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID DestMAC_ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 DNetAOP Purpose Get the Information of DeviceNet Identity object Prototype C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC ID BYTE DestMAC_ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 Parame
28. em DOS Environment CanInstallCallBack Purpose Install callback function of event under DOS environment Prototype C C void far CanInstallCallBack int handle int index void far Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver index event type Index Type 2 Error Warning 3 Data Overrun 4 Wake Up 5 Error Passive 6 Arbitration Lost 7 Bus Error void far proc Call back function Return Value Remarks See Also Usage The suggest prototype of the call back function is like void far ErrorWarning Previous call back function NULL when there is no Call back installed Install the call back function for event handling In normal state all hardware interrupt of cPCI PCI 7841 wouldn t be set except receive and transmit interrupt After calling the CanInstallCallBack the corresponding interrupt would be activated The interrupt occurs when the event happened It will not be disabled until using CanRemoveCallBack or a hardware reset Actually the call back function is a part of ISR You need to care about the DOS reentrance problem and returns as soon as possible to preventing the lost of data CanRemoveCallBack C C Zinclude pci7841 h void far ErrorWarning int handle CanOpenDriver 0 0 open the port 0 of card 0 Istalls the ErrorWarning handling event and stores the previous one void far backup CanI
29. er mapping coniroller typedef union _tagPORT_REG struct PORTREG BIT bit unsigned short reg JPORT REG struct PORTREG BIT unsigned short RxBuffer id unsigned short DataOverrun 1 unsigned short TxBuffer 541 unsigned short ED unsigned short RxStatus 1 unsigned short TxStatus id unsigned short ErrorStatus 1 unsigned short BusStatus 21 unsigned short reserved 8 See Also CanGetPortStatus and PORT_STATUS structure 3 1 3 structure define The structure defines the packet format CAN packet It is used by the CanSendMsg and CanRcvMsg functions typedef struct PACKET DWORD CAN ID BYTE rtr BYTE len BYTE data 8 DWORD time BYTE reserved JCAN PACKET Members CAN ID CAN ID field 32 bit unsigned integer rtr CAN RTR bit len Length data field data f Data 8 bytes maximum time Reserved for future use reserved Reserved byte See Also CanSendMsg and CanRcvMsg 3 1 4 DEVICENET PACKET structure define The DEVICENET PACKET structure defines the packet format of DeviceNet packet It is widely used by the DeviceNet layer functions typedef struct tagDEVICENET PACKET BYTE Group BYTE MAC ID BYTE HostMAC ID BYTE MESSAGE ID BYTE len BYTE data 8 DWORD time BYTE reserved JDEVICENET PACKET Members Group Group of DeviceNet packet MAC ID Address of de
30. handle BYTE argu Visual Basic Windows 95 98 Parameters hande handle retrieve from CanOpenDriver argu f a 7 bytes BYTE array argu 0 Host MAC_ID argu 1 Destination MAC_ID argu 2 Message ID argu 3 Service Code argu 4 Class ID argu 5 Instance ID argu 6 Attribute Return Value Return 0 is successful 1 if error occurs Remarks Send a Group 2 DeviceNet Packet to a opened port Most operation under DeviceNet is passed by Group 2 message You can use this function to demand most explicit request But under some special case the Group 2 message needs more argument You should call the SendDeviceNetPacket directly By reference the document of the module if you find that there are more argument after Attribute field You need to call the SendDeviceNetPacket rather than SendGroup2Message See Also RcvDeviceNetPacket Usage C C DOS and Windows 95 98 Zinclude pci784 I h int handle CanOpenDriver 0 0 BYTE argu 8 argu 0 0 argu 1 263 argu 2 6 argu 3 4 4 3 argu 5 1 argu 6 1 1 is 0 Destination is 63 Message ID is 6 Service Code is 0x4C Close Class ID 3 Instance 1 Release choice 0x01 Close Explicit connection SendGroup2DeviceNetPacket handle argu Visual Basic Windows 95 98 RcvGroup2Message Purpose Prototype Parameters Return Value
31. ial bus system originally developed by Bosch for use in automobiles is increasing being used in industry automation It multi master protocol real time capability error correction and high noise immunity make it especially suited for intelligent I O devices control network The PCl cPCl PM 7841 is programmed by using the ADLink s software library The programming of this PCI card is as easy as AT bus add on cards 1 1 PCI cPCI PM 7841 Features The PCI 7841 is a Dual Port Isolated CAN Interface Card with the following features Two independent CAN network operation Bridge function supports Compatible with CAN specification 2 0 parts A and B Optically isolated CAN interface up to 2500 Vrms isolation protection Direct memory mapping to the CAN controllers Powerful master interface for CANopen DeviceNet and SDS application layer protocol Up to 1Mbps programmable transfer rate Supports standard DeviceNet data rates 125 250 and 500 Kbps PCI bus plug and play DOS library and examples included The cPCI 7841 is a Dual Port Isolated CAN Interface Card with the following features Two independent CAN network operation Bridge function supports Compatible with CAN specification 2 0 parts A and B Optically isolated CAN interface up to 2500 Vrms isolation protection Direct memory mapping to the CAN controllers Powerful master interface for CANopen DeviceNet and 505 application layer protocol Up to 1Mbps programmable transfer ra
32. igPort Purpose Prototype Parameters Return Value Remarks See Also Usage Configure properties of a port C C int CanConfigPort int handle PORT STRUCT ptrStruct Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver ptrStruct a pointer of PORT_STRUCT type Return 0 is successful 1 if error occurs Configure a port that had been opened The properties of a CAN port such as baud rate acceptance code acceptance mask operate mode After configuration is over the port is ready to send and receive data Can ConfigPort C C Zinclude pci7841 h PORT_STRUCT port_struct int handle CanOpenDriver 0 0 Open port 0 of card 0 port_struct mode 0 V4 CAN2 0A 11 bit CAN id port_struct accCode 0 This setting of acceptance code and port_struct accMask 0x7FF 7 4 mask enable all MAC IDs input port struct baudrate 0 7 4 125K bps CanConfigPort handle amp port struct CanCloseDriver handle Visual Basic Windows 95 98 CanDetectBaudrate Purpose Prototype Parameters Return Value Remarks See Also Usage Perform auto detect baud rate algorithm C C int CanDetectBaudrate int handle int miliSecs Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver miliSecs timeout time ms Return 1 if error occurs Others is the baudrate Value Baudrate 0 125 Kbps 1 250 Kbps 2 500 Kbps 3 1M Kbps Call
33. iver handle Visual Basic Windows 95 98 CanSetLedStatus Purpose Prototype Parameters Return Value Remarks See Also Usage Set the Led Status of cPCI 7841 C C void CanSetLedStatus int card int index int flashMode Visual Basic Windows 95 98 card index of Led flashMode Value Function 0 Led Off 1 Led On none Set Led status of cPCI 7841 and PM 7841 This function supports the cPCI 7841 and PM 7841 CanRcvMsg C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 CanSetLedStatus 0 0 2 SetLed to flash CanCloseDriver handle Visual Basic Windows 95 98 CanGetRcvCnt Purpose Prototype Parameters Return Value Remarks See Also Usage Get the how many message in the FIFO C C int _stdcall CanGetRcvCnt int handle Visual Basic Windows 95 98 card How many messages Get the unread message count the FIFO CanGetReceiveEvent C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open port 0 of card 0 int count CanGetRcvCnt handle Visual Basic Windows 95 98 Error and Event Handling Functions When the exception occurs your program may need to take some algorithm to recover the problem The following functions are operation system depended functions You should care about the restriction in the operation syst
34. me 66 DNetSetWD 67 DNetConnlO 68 DNetDIP 69 DNetDOP 69 DNetSetDOP 70 DNetAIP 71 DNetSetAIP 72 73 DNetSetAOP 74 Note 1 only for compact PCI and PC 104 version 3 1 1 PORT_STRUCT structure define The PORT STRUCT structure defines the mode of id mode acceptance code acceptance mask and baud rate of a physical CAN port It is used by the CanPortConfig and CanGetPortStatus functions typedef struct tagPORT STRUCT int mode 0 forll bit 1 for 29 bit DWORD accCode accMask int baudrate BYTE brp tsegl tseg2 Used only if baudrate 4 BYTE sjw sam Usedonly if baudrate 4 JPORT STRUCT Members mode 0 means using 11 bit CAN ID field 1 means using 29 bit in CAN ID field accCode Acceptance Code for CAN controller accMask Acceptance Mask for CAN controller baudrate Baud rate setting for the CAN controller Value Baudrate 0 125 Kbps 1 250 Kbps 2 500 Kbps 3 1M Kbps 4 User Defined brp tseg1 tseg2 sjw sam Use for User Defined Baudrate See Also CanPortConfig CanGetPortStatus and PORT_STATUS structure 3 1 2 PORT_STATUS structure define The PORT STATUS structure defines the status register and PORT STRUCT of CAN port It is used by the CanGetPortStatus functions typedef struct tagPORT STATUS PORT STRUCT port PORT REG status JPORT STATUS Members port PORT STRUCT data status status is the status regist
35. meters handle handle retrieve from CanOpenDriver ID the ID of your port DestMAC ID Destination MAC ID Return Value Return 0 is successful 1 if error occurs Remarks Open an Poll IO connection with a device See Also Usage C C DOS and Windows 95 98 Zinclude pci7841 h int handle CanOpenDriver 0 0 int len BYTE data 8 DNetOpenlO handle 0 ID Visual Basic Windows 95 98 DNetCloselO Purpose Close an Poll IO connection Prototype C C DOS and Windows 95 98 int DNetCloselO int handle BYTE ID BYTE DestMAC 1 Parameters Return Value Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Return 0 is successful 1 if error occurs Remarks Close a Poll IO connection with a device See Also Usage C C DOS and Windows 95 98 Zinclude pci7841 h int handle CanOpenDriver 0 0 int len BYTE data 8 DNetCloselO handle 0 DestMAC ID Visual Basic Windows 95 98 DNetScan Purpose Scan the DeviceNet network Prototype DOS and Windows 95 98 int DNetScan int handle BYTE BYTE list Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port list a 64 byte array Return Value Remarks See Also Usage Return 1 if error occurs others is the
36. nal resistor for port 1 Connector Pin Define The J1 and J2 are CAN Connector the below picture is their pin define Combicon Style Connector 2 4 Installing PM 7841 What do you have In addition to this User s Manual the package includes the following items e PM 7841 Dual Port PC 104 Isolated CAN Interface Card e ADLink All xxxxx CD ROM If any of these items is missing or damaged contact the dealer from whom you pur chased the product Save the shipping materials and carton in case you want to ship or store the product in the future PM 7841 Layout Au e VE 1111 Waaa t DE mmm ZEE MNT numi in HA 18 THH La 0 ST HHRHH a l Tl frag Jan ga ee M k nip m pag rm E mu sli n Hm n E oa ee a Bee TT ID I Terminator Configuration A 120 Q terminal resistor is installed for each port while JP1 enables the terminal resistor for portO and JP2 enables the terminal resistor for port 1 Connector Pin Define The J1 and J2 are CAN Connector the below picture is their pin define C papers ac Eee J Combicon Style Connector 2 4 Jumper and DIP Switch Description You can configure the output of each channel and base address by setting jumpers and DIP switches on the PM 7841 The card s jumpers and switches are preset at the factory Under normal circumstances
37. nstallCallBack 0 2 ErrorWarning CanRemoveCallBack 0 2 NULL Remove the call back function CanCloseDriver handle CanRemoveCallBack Purpose Remove the callback function of event under DOS environment Prototype C C int CanRemoveCallBack int handle int index void proc Visual Basic Windows 95 98 Parameters hande handle retrieve from CanOpenDriver index event type Index Type 2 Error Warning 3 Data Overrun 4 Wake Up 5 Error Passive 6 Arbitration Lost 7 Bus Error void far proc Previous call back function Return Value Remarks See Also Usage Return 0 is successful 1 if error occurs Install the call back function for event handling In normal state all hardware interrupt of cPCI PCI 7841 wouldn t be set except receive and transmit interrupt After calling the CanInstallCallBack the corresponding interrupt would be activated The interrupt occurs when the event happened It will not be disabled until using CanRemoveCallBack or a hardware reset Actually the call back function is a part of ISR You need to care about the DOS reentrance problem and returns as soon as possible to preventing the lost of data CanRemoveCallBack C C DOS Zinclude pci7841 h void far ErrorWarning int handle CanOpenDriver 0 0 open the port 0 of card 0 Installs the ErrorWarning handling event and stores the previous one void far backup Can
38. number of found Scan a DeviceNet network It will perform an algorithm to search the entire network except the MAC 10 of your port C C DOS and Windows 95 98 Zinclude pci784 I h int handle 2 CanOpenDriver 0 0 int modules BYTE list 64 modules DNetScan handle 0 list It will search the entire network Visual Basic Windows 95 98 DeviceNet layer DeviceNet Object Class Functions DNetldentity Purpose Get the Information of DeviceNet Identity object Prototype C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC ID BYTE DestMAC int Instance int Attribute BYTE array Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned data Return Value Return 0 is successful 1 if error occurs Remarks Get Identity Object Information The Table is a part of DeviceNet Information See Also Usage C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID DestMAC_ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 DNetDNet Purpose Prototype Parameters Return Value Remarks See Also Us
39. on of ERRC1 ERRC2 Bit ERRC1 Bit ERRC2 Function 0 0 bit error form error stuff error 0 1 1 1 0 1 other type of error Bit interpretation of SEG4 to SEG 0 SEG4 SEG3 o 2 SEGO Function start of frame 10 28 to 10 21 10 20 0 18 bit SRTR bit IDE ID 17 to 0 13 10 12 to ID 5 ID 4 to 0 0 RTR bit reserved bit 1 reserved bit 0 Data length code Data field CRC sequence CRC delimiter O O O OC OC O 10 0 0 01010 0 _ 0 0 10 01 1 acknowledge 5101 Remarks See Also Usage end of frame intermission active error flag passive error flag tolerate dominant bits error delimiter overload flag mak mere Oj Get the information about the type and location of errors on the bus When bus error occurs if your program installed the call back function or error handling event The error bit position would be captured into the card The value would be fixed in the card until your program read it back CanGetError Warning Limit CanSetErrorWarningLimit C C Zinclude pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 BYTE data C
40. rned data Return 0 is successful 1 if error Remarks Get Assembly Object Information Get the Assembly Input data The format of returned data is different from device to device You need to take care of format The returned data is only the data field other fields such as service code instance and attribute are cleared See Also Usage C C DOS and Windows 95 98 none Visual Basic Windows 95 98 none DNetAsmOut Purpose Set the Assembly Output object of DeviceNet object Prototype C C DOS and Windows 95 98 int DNetAsmOut int handle BYTE HostMAC ID BYTE DestMAC_ID int Instance int Attribute int len BYTE array Parameters Return Value Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object len len of data from 0 to 3 array data to send 4 bytes data Return 0 is successful 1 if error Remarks Set DeviceNet Assembly Output Set the Assembly Output data The format of returned data is different from device to device You need to take care of format The maximum data length is 3 bytes See Also Usage C C DOS and Windows 95 98 none Visual Basic Windows 95 98 none DNetGetSafeOut Purpose Get the safety output of the device Prototype C C DOS and Windo
41. rror and Event handling functions to handle the exceptions CanRcvMsgo C C include pci7841 h PORT_STRUCT port_struct CAN PACKET sndPacket rcvPacket int handle CanOpenDriver 0 0 open the port 0 of card 0 CanConfigPort handle amp port struct CanSendMsg handle amp sndPacket if CanRcvMsg handle amp rcvPacket 0 CanCloseDriver handle Visual Basic Windows 95 98 CanRcvMsg Purpose Prototype Parameters Return Value Remarks See Also Usage Receive a can packet from a port C C int CanSendMsg int handle PACKET packet Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver packet data Return 0 is successful 1 if error occurs Receive a message from an opened CAN port There are only 64 bytes FIFO under hardware It can store from 3 to 21 packets So there are memory buffer under driver When data comes the driver would move it from card to memory It starts after your port configuration is done This function copies the buffer to your application So if your program has the critical section to process the data on the network We suggest that you can call the CanClearBuffer to clear the buffer first Error would be happened most under the following conditions 1 You want to access a port that has not be opened 2 Your packet is a NULL pointer 3 The receive buffer is empty You can use the Status handling functions to
42. se functions DNetOpenExp Purpose Open an explicit connection Prototype C C DOS and Windows 95 98 int DNetOpenExp int handle BYTE HostMAC ID BYTE DestMAC ID Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Return Value Return 0 is successful 1 if error occurs Remarks Open an explicit connection with a device See Also Usage C C DOS and Windows 95 98 Zinclude pci7841 h int handle 2 CanOpenDriver 0 0 int len BYTE data 8 DNetOpenExp handle 0 DestMAC ID Visual Basic Windows 95 98 DNetCloseExp Purpose Close an explicit connection Prototype C C DOS and Windows 95 98 int DNetCloseExp int handle BYTE HostMAC ID BYTE DestMAC ID Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Return Value Return 0 is successful 1 if error occurs Remarks Close an explicit connection with a device See Also Usage C C DOS and Windows 95 98 Zinclude pci7841 h int handle CanOpenDriver 0 0 int len BYTE data 8 DNetCloseExp handle 0 DestMAC_ID Visual Basic Windows 95 98 DNetOpenIO Purpose Open an Poll IO connection Prototype C C DOS and Windows 95 98 int DNetOpenlO int handle BYTE HostMAC ID BYTE ID Visual Basic Windows 95 98 Para
43. stination HostMAC ID Address of source MESSAGE ID Message ID of DeviceNet packet len f Length of data field data Data 8 bytes maximum See Also SendDeviceNetPacket and RcvDeviceNetPacket 3 2 CAN LAYER Functions CAN layer Card Initialization Functions PM7841_Install base irg_chn 0xd000 Purpose Prototype Parameters Return Value Remarks See Also Usage Get the version of driver C C int PM7841_Install int baseAddr int irq_chn int memorySpace Visual Basic Windows 95 98 baseAddr Base Address 7841 DIP Switch IRQ channel Jumpper MemorySpace Memory Mapping Range A 16 bit unsigned integer High byte is the major version Low byte is the major version Call this function to retrieve the version of current using driver This function is for your program to get the version of library and dynamic linked library none C C include pm7841 h WORD version GetDriverVersion majorVersion version gt gt 8 minorVersion version amp OxOOFF Visual Basic Windows 95 98 GetDriverVersion Purpose Prototype Parameters Return Value Remarks See Also Usage Get the version of driver C C WORD GetDriverVersion void Visual Basic Windows 95 98 none A 16 bit unsigned integer High byte is the major version Low byte is the major version Call this function to retrieve the version of current using driver This function is for
44. t DNetConnExp int handle BYTE 1 BYTE DestMAC_ID int Attribute BYTE array Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC ID of your port DestMAC ID Destination MAC ID Attribute Attribute of DeviceNet Explicit Connection Object Return Value array returned data Return 0 is successful 1 if error Remarks Get the information of the DeviceNet Connection Object Explicit part There are several connection defined in the DeviceNet This version version 0 3 supports only explicit connection and Poll IO connections Use DNetConnExp to access explicit connection object and use DNetConnIO to access Poll IO one See Also Usage C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the explicit connection state if DNetConnExp handle HostMAC ID ID 1 argu 0 Get failed Visual Basic Windows 95 98 DNetSetWDTime Purpose Set watchdog timeout time Prototype C C DOS and Windows 95 98 int DNetSetWDTime int handle BYTE HostMAC_ID BYTE DestMAC ID WORD time Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC D of your port DestMAC ID Destination MAC ID time active time really time is 10 ms Return Value Remarks Return 0 is successful 1 if error occurs Set the timeout time for the Watchdog function enable
45. te Supports standard DeviceNet data rates 125 250 and 500 Kbps PCI bus plug and play industry bus DOS library and examples included The PM 7841 is a Dual Port Isolated CAN Interface Card with the following features Two independent CAN network operation Bridge function supports Compatible with CAN specification 2 0 parts A and B Optically isolated CAN interface up to 2500 Vrms isolation protection Direct memory mapping to the CAN controllers Powerful master interface for CANopen DeviceNet and 505 application layer protocol Up to 1Mbps programmable transfer rate Supports standard DeviceNet data rates 125 250 and 500 Kbps e DIP Switch for base address configuration Software Programmable Memory Mapped Address PC 104 industry form factor DOS library and examples included 1 2 Applications e Industry automation Industry process monitoring and control e Manufacture automation e Product testing 1 3 Specifications 7841 Specification Table Ports 2 channels V2 0 AB CAN Controller SJA1000 Isolation Voltage 2500 Vrms 0 60 C Set by Plug and Play BIOS Power Consumption 400mA 5VDC Typical without external 900mA 5VDC Maximum devices 132 L mm x 98 H mm CPCI 7841 Specification Table Ports 2 CAN channels V2 0 AB 0 60 Storage Temperature 20 80 5 95 non condensing Power
46. teEvent NULL FALSE TRUE ErrorWarning CanlInstallEvent 0 2 hEvent create a thread Thread function WaitForSingleObject hEvent INFINITE ResetEvent hEvent Event handling 3 3 DeviceNet Layer Functions DeviceNet Layer functions are a set building under CAN layer functions DeviceNet is a protocol constructed under physical CAN bus Most the following functions work with the follow No No Yes No The set of DeviceNet functions are divided into the following groups chart 1 DeviceNet send and receive packet functions Provide general functions to send and receive and DeviceNet packet from a CAN port 2 DeviceNet connection establish and release functions Functions under this group are used for connection establishing It supports explicit and Poll IO connections 3 DeviceNet object class functions The object access functions are provided here DeviceNet Send and Receive packet functions SendDeviceNetPacket Purpose Prototype Parameters Return Value Remarks See Also Usage Send a DeviceNet packet to a CAN port C C DOS and Windows 95 98 int SendDeviceNetPacket int handle DEVICENET_PACKET packet Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver packet DEVICENET_PACKET format pointer Return 0 is successful 1 if error occurs Send a DeviceNet Packet to a opened port This is the basic function of DeviceNet It sends packed data to the
47. ters handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned data Return Value Remarks Return 0 is successful 1 if error occurs Get Identity Object Information The Table is a part of DeviceNet Information See Also Usage C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID DestMAC ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 DNetSetAOP Purpose Get the Information of DeviceNet Identity object Prototype C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC ID BYTE DestMAC_ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver ID the D of your port ID Destination ID Instance Instance of DeviceNet Identity Object Attribute Attribute of DeviceNet Identity Object array returned data Return Value Remarks See Also Usage Return 0 is successful 1 if error occurs Get Identity Object Information The Table is a part of DeviceNet Information C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the vendor of the devi
48. umber of unread inthe FIFO CanInstallEvent Purpose Install the event under Windows 95 98 NT system Prototype C C Windows 95 98 NT int CanInstallEvent int handle int index HANDLE hEvent Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver index event type Index Type 2 Error Warning 3 Data Overrun 4 Wake Up 5 Error Passive 6 Arbitration Lost 7 Bus Error hEvent HANDLE created from CreateEvent Win32 SDK Return Value Remarks See Also Usage Return 0 is successful 1 if error occurs Install the notify event Unlike the Dos environment there is only one error handling function under Windows 95 98 NT environment First you need to create an event object and send it to the DLL The DLL would make a registry in the kernel and pass it to the VxD SYS NT system You can t release the event object you created because it was attached to the VxD The VxD would release the event object when you installed another event One way to disable the event handling is that you install another event which handle is NULL ex CanInstallEvent handle index NULL And you can create a thread to handle the error event CanRemoveCallBack CanInstallCallBack C C Windows 95 98 Zinclude pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 Installs the ErrorWarning handling event and stores the previous one HANDLE hEvent Crea
49. ws 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID DestMAC ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 Purpose Prototype Parameters Return Value Remarks See Also Usage Get the Information of DeviceNet Identity object C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC_ID BYTE DestMAC_ID int Instance int Attribute BYTE array Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Instance Instance of DeviceNet Identity Object Attribute Attribute DeviceNet Identity Object array returned data Return 0 is successful 1 if error occurs Get Identity Object Information The Table is a part of DeviceNet Information C C DOS and Windows 95 98 WORD vendor BYTE argu 6 Get the vendor of the device if DNetIdentity handle HostMAC_ID DestMAC_ID 1 argu 0 Get failed vendor argu 1 vendor lt lt 8 vendor argu 0 return vendor Visual Basic Windows 95 98 DNetSetDOP Purpose Prototype Get the Information of DeviceNet Identity object C C DOS and Windows 95 98 int DNetldentity int handle BYTE HostMAC_ID BYTE DestMAC_ID int Instance int Attribute BYTE array
50. ws 95 98 int DNetGetSafeOut int handle BYTE 1 BYTE DestMAC ID Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Return Value Remarks Return 0 255 is the safety output 1 if error occurs Get safety output of a device Most output device has its safety output and the value is stored inside the hardware You can use this function to set the safety output value of device This function supports only one byte safety returns For other format you can call the DNetAsmOut to get See Also Usage C C DOS and Windows 95 98 none Visual Basic Windows 95 98 DNetSetSafeOut Purpose Set the safety output of a device Prototype C C DOS and Windows 95 98 int DNetSetSafeOut int handle BYTE ID BYTE ID BYTE safeValue Visual Basic Windows 95 98 Parameters handle handle retrieve from CanOpenDriver HostMAC ID the MAC 10 of your port DestMAC ID Destination MAC ID Return Value Return 0 is successful 1 if error occurs Remarks Set the safety output value of a device It supports only a BYTE configuration For other type of assembly out more bytes you can use the DNetAsmOut See Also Usage C C DOS and Windows 95 98 none DNetConnExp Purpose Get the Information of DeviceNet Explicit Connection Object Prototype C C DOS and Windows 95 98 in
51. your program to get the version of library and dynamic linked library none C C include pci7841 h WORD version GetDriverVersion majorVersion version gt gt 8 minorVersion version amp OxOOFF Visual Basic Windows 95 98 CanOpenDriver Purpose Prototype Parameters Return Value Remarks See Also Usage Open a specific port and initialize driver C C int CanOpenDriver int card int port Visual Basic Windows 95 98 card index of port Return a handle for open port 1 if error occurs Call this function to open a port Under DOS operation system you will receive 1 if there is not enough memory If writing program for the Windows system It will return 1 if you want to open a port had been opened And you must use CanCloseDriver to close the port after using CanCloseDriver C C Zinclude pci7841 h int handle CanOpenDriver CanSendMsg handle amp msg CanCloseDriver handle Visual Basic Windows 95 98 CanCloseDriver Purpose Prototype Parameters Return Value Remarks See Also Usage Close an opened port and release driver C C int CanCloseDriver int handle Visual Basic Windows 95 98 handle handle retrieve from CanOpenDriver port index of port Return 0 if successful 1 if error occurs Call this function to close a port CanOpenDriver See usage of CanOpenDriver CanConf
Download Pdf Manuals
Related Search
Related Contents
Global Door Controls TH1100EDTBARFAL Installation Guide Manual - Boeco MCF5329 - Reference Manual Descargar Ficha del Producto ABARTH TROPHIES 2013 TECHNICAL REGULATION Vogel's PPS 500 project mount Untitled Connect Tech Blue Heat/PCI PCI Serial Communications Network Card User Manual Bauanleitung Tamiya TT01D - Planet-RC Copyright © All rights reserved.
Failed to retrieve file