background image

Function Reference

 35

CanCloseDriver(handle);

CanGetLedStatus()

Purpose

Get the LED status of cPCI-7841 and PM-
7841

Prototype

C/C++
BYTE CanGetLedStatus (int card, int
index);

Parameters

card : card number 
Index : index of LED

Return Value

status of Led

Remarks

Get the status of Led 
This function supports the cPCI-7841 and
PM-7841.

See Also

CanSetLEDStatus()

Usage

C/C++

#include “pci7841.h
int handle = CanOpenDriver(0, 0);//open the port 

0 of card 0

….
BYTE flag = CanGetLedStatus(0, 0);;
CanCloseDriver(handle);

CanSetLedStatus()

Purpose

Set the Led Status of cPCI-7841

Prototype

C/C++
void  CanSetLedStatus(int card, int index,
int flashMode);

Parameters

card : card number
Index : index of Led

flashMode :

Value Function

0

Led Off

1

Led  On

Value Function

Содержание NuCOM cPCI-7841

Страница 1: ...Advance Technologies Automate the World Manual Rev 3 00 Revision Date June 28 2006 Part No 50 11109 1010 NuCOM PCI 7841 cPCI 7841 PM 7841 Dual Port Isolated CAN Interface Card User s Manual ...

Страница 2: ... or inability to use the product or documentation even if advised of the possibility of such damages This document contains proprietary information protected by copy right All rights are reserved No part of this manual may be repro duced by any mechanical electronic or other means in any form without prior written permission of the manufacturer Trademarks NuDAQ NuIPC DAQBench are registered tradem...

Страница 3: ...vice adlinktech com TEL 886 2 82265877 FAX 886 2 82265717 Address 9F No 166 Jian Yi Road Chungho City Taipei 235 Taiwan Please email or FAX this completed service form for prompt and satisfactory service Company Information Company Organization Contact Person E mail Address Address Country TEL FAX Web Site Product Information Product Model Environment OS M B CPU Chipset BIOS Please give a detailed...

Страница 4: ......

Страница 5: ...841 10 2 5 Jumper and DIP Switch Description 12 2 6 Base Address Setting 12 2 7 IRQ Level Setting 14 3 Function Reference 15 3 1 Functions Table 15 PORT_STRUCT structure define 16 CAN_PACKET structure define 18 Members 18 DEVICENET_PACKET structure define 19 Members 19 3 2 CAN LAYER Functions 20 CAN layer Card Initialization Functions 20 PM7841_Install base irq_chn 0xd000 20 GetDriverVersion 20 Ca...

Страница 6: ... CanGetErrorCode 29 CanSetErrorWarningLimit 31 CanGetErrorWarningLimit 32 CanGetRxErrorCount 32 CanGetTxErrorCount 33 CanSetTxErrorCount 33 CanGetPortStatus 34 CanGetLedStatus 35 CanSetLedStatus 35 CanGetRcvCnt 36 Error and Event Handling Functions 37 CanInstallCallBack 37 CanRemoveCallBack 38 CanCloseDriver handle 40 CanGetReceiveEvent 40 CanInstallEvent 41 Warranty Policy 43 ...

Страница 7: ...List of Tables iii List of Tables Table 1 1 PCI 7841 Specifications 4 Table 1 2 cPCI 7841 Specifications 4 Table 1 3 PM 7841 Specifications 5 ...

Страница 8: ...iv List of Figures List of Figures Figure 2 1 Default Base Address Configuration 13 Figure 2 2 IRQ Settings 14 ...

Страница 9: ...eal time capability error correction and high noise immunity make it especially suited for intelligent I O devices control network The PCI cPCI 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 X Two independ...

Страница 10: ...ug and play X compact PCI industry bus X DOS library and examples included The PM 7841 is a Dual Port Isolated CAN Interface Card with the following features X Two independent CAN network operation X Bridge function supports X Compatible with CAN specification 2 0 parts A and B X Optically isolated CAN interface up to 2500 Vrms isolation protection X Direct memory mapping to the CAN controllers X ...

Страница 11: ...Introduction 3 1 2 Applications X Industry automation X Industry process monitoring and control X Manufacture automation X Product testing ...

Страница 12: ... by Plug and Play BIOS Power Consumption without external devices 400mA 5VDC Typical 900mA 5VDC Maximum Size 132 L mm x 98 H mm Table 1 1 PCI 7841 Specifications Ports 2 CAN channels V2 0 A B CAN Controller SJA1000 CAN Transceiver 82c250 Signal Support CAN_H CAN_L Isolation Voltage 2500 Vrms Connectors Dual male connectors Operation Temperature 0 60 C Storage Temperature 20 C 80 C Humidity 5 95 no...

Страница 13: ...ms Connectors Dual 5 male connectors Operation Temperature 0 60 C Storage Temperature 20 C 80 C Humidity 5 95 non condensing IRQ Level Set by Jumper I O port address Set by DIP Switch Memory Mapped Space 128 Bytes by Software Power Consumption without external devices 400mA 5VDC Typical 900mA 5VDC Maximum Size 90 17 L mm x 95 89 H mm Table 1 3 PM 7841 Specifications Table 1 2 cPCI 7841 Specificati...

Страница 14: ...6 Introduction ...

Страница 15: ...age 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 2 2 Installing PCI ...

Страница 16: ...iguration A 120 Ohm terminal resistor is installed for each port while JP1 enables the terminal resistor for port0 and JP2 enables the termi nal resistor for port 1 Connector Pin Definition P3 and P4 are CAN connectors pin definition is as follows ...

Страница 17: ...CD ROM If any of these items is missing or damaged contact the dealer from whom you purchased the product Save the shipping materi als and carton in case you want to ship or store the product in the future cPCI 7841 Layout Terminator Configuration A 120 Ohm terminal resistor is installed for each port while JP1 enables the terminal resistor for port0 and JP2 enables the termi nal resistor for port...

Страница 18: ...ddition to this User s Manual the package includes the follow ing items X PM 7841 Dual Port PC 104 Isolated CAN Interface Card X ADLINK CD ROM If any of these items is missing or damaged contact the dealer from whom you purchased the product Save the shipping materi als and carton in case you want to ship or store the product in the future ...

Страница 19: ...allation 11 PM 7841 Layout Terminator Configuration A 120 Ohm terminal resistor is installed for each port while JP1 enables the terminal resistor for port0 and JP2 enables the terminal resistor for port 1 ...

Страница 20: ... of the jumper A jumper is open with the plastic cap inserted over one or no pin s of the jumper 2 6 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 3F0hex 2 The base address should not conflict with any PC reserved I O addr...

Страница 21: ...nstallation 13 Figure 2 1 Default Base Address Configuration default setting ON 0 X don t care OFF 1 Note A4 A9 correspond to PC 104 ISA bus address lines SW1 Base Address 0x200 1 2 3 4 5 ON A 8 7 6 5 4 ...

Страница 22: ...y the external Interrupt sig nal which is from JP3 ad JP4 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 Figure 2 2 IRQ Settings IRQ 9 7 6 5 3 X 15 12 11 10 Interrupt Default Setting IRQ15 ...

Страница 23: ...eviceNet layer functions X Send and Receive packet functions X Connection establish and release functions X DeviceNet object class functions The particular functions associated with each function are pre sented in next page 3 1 Functions Table CAN layer functions Function Type Function Name PM 7841 Initial PM7841_Install GetDriverVersion CanOpenDriver CanCloseDriver CanConfigPort CanDetectBaudrate...

Страница 24: ...T_STRUCT int mode 0 for 11 bit 1 for 29 bit DWORD accCode accMask int baudrate BYTE brp tseg1 tseg2 Reserved BYTE sjw sam Reserved PORT_STRUCT CanClearOverrun CanClearRxBuffer CanClearTxBuffer CanGetErrorCode CanGetErrorWarningLimit CanSetErrorWarningLimit CanGetRxErrorCount CanGetTxErrorCount CanSetTxErrorCount CanGetPortStatus CanGetLedStatus 1 CanSetLedStatus 1 Error and Event handling function...

Страница 25: ...e 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 PORT_STATUS Members port PORT_STRUCT data status status is the status register mapping of CAN controller typedef union _tagPORT_REG struct PORTREG_BIT bit unsigned short reg PORT_REG struct PORTREG_BIT unsig...

Страница 26: ...ucture define The CAN_PACKET structure defines the packet format of CAN packet It is used by the CanSendMsg and CanRcvMsg func tions typedef struct _tagCAN_PACKET DWORD CAN_ID BYTE rtr BYTE len BYTE data 8 DWORD time BYTE reserved CAN_PACKET Members CAN_ID CAN ID field 32 bit unsigned integer rtr CAN RTR bit len Length of data field data Data 8 bytes maximum time Reserved for future use reserved R...

Страница 27: ...ef struct _tagDEVICENET_PACKET BYTE Group BYTE MAC_ID BYTE HostMAC_ID BYTE MESSAGE_ID BYTE len BYTE data 8 DWORD time BYTE reserved DEVICENET_PACKET Members Group Group of DeviceNet packet MAC_ID Address of destination HostMAC_ID Address of source MESSAGE_ID Message ID of DeviceNet packet len Length of data field data Data 8 bytes maximum See Also SendDeviceNetPacket and RcvDeviceNetPacket ...

Страница 28: ...nnel Jumpper MemorySpace Memory Mapping Range Return Value A signed integer 0 Successful 1 Failed Remarks PM7841 is PC104 ISA CAN interface card It will need 32 bytes I O space and 1K memory space See Also none Usage C C include pm7841 h int ret ret PM7841_Install baseAddr irq_ch memorySpace GetDriverVersion Purpose Get the version of driver Prototype C C WORD GetDriverVersion void Parameters none...

Страница 29: ...ort Parameters card index of card port index of port Return Value Return a handle for open port 1 if error occurs Remarks 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 Can CloseDriver to close the port after using See...

Страница 30: ...f PORT_STRUCT type Return Value Return 0 is successful 1 if error occurs Remarks 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 See Also PORT_STRUCT structure define Usage C C include pci7841 h PORT_STRUCT port_struct int handle CanOpenDriver 0 0...

Страница 31: ...e 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 See Also none Usage C C include pci7841 h PORT_STRUCT port_struct int handle CanOpenDriver port_struct mode 0 CAN2 0A 11 bit CAN id port_struct accCode 0 This setting of acceptance code and po...

Страница 32: ...ead 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 Parameters handle handle retrieve from CanOpen Driver Offset offset of register data data write to the port Return Value none Remarks Call this function to directly write a register of PCI 7841 See...

Страница 33: ...nDisableReceive to disable receive and CanEnableReceive to enable receives See Also CanDisableReceive Usage none CanDisableReceive Purpose Disable receive of a CAN port Prototype C C void CanEnableReceive int handle Parameters handle handle retrieve from CanOpen Driver Return Value none Remarks Please refer the CanEnableReceive See Also CanEnableReceive Usage none CanSendMsg Purpose Send can packe...

Страница 34: ...le CanOpenDriver 0 0 open the port 0 of card 0 CanConfigPort handle port_struct CanSendMsg handle sndPacket if CanRcvMsg handle rcvPacket 0 CanCloseDriver handle CanRcvMsg Purpose Receive a can packet from a port Prototype C C int CanSendMsg int handle CAN_PACKET packet Parameters handle handle retrieve from CanOpen Driver Packet CAN_PACKET data Return Value Return 0 is successful 1 if error occur...

Страница 35: ... buffer is empty You can use the Status handling functions to handle the exceptions See Also CanSendMsg Usage See the CanSendMsg CAN layer Status Functions CanClearOverrun Purpose Clear data overrun status Prototype C C void CanClearOverrun int handle Parameters handle handle retrieve from CanOpen Driver Return Value none Remarks Clear the data overrun status Sometimes if your system has heavy loa...

Страница 36: ... space inside the driver Both of them would be cleared after using this function See Also CanRcvMsg Usage C C include pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 CanClearRxBuffer handle CanCloseDriver handle CanClearTxBuffer Purpose Clear Transmit Buffer Prototype C C void CanClearTxBuffer int handle Parameters handle handle retrieve from CanOpen Driver Return Value none Remar...

Страница 37: ...Driver 0 0 open the port 0 of card 0 CanClearTxBuffer handle CanCloseDriver handle CanGetErrorCode Purpose Get the Error Code Prototype C C BYTE CanGetErrorCode int handle Parameters handle handle retrieve from CanOpen Driver Return Value error code Return error code is an 8 bit data Bit Symbol Name Value Function 7 ERRC1 Error Code 1 6 ERRC0 Error Code 0 5 DIR Direction 1 Rx error occurred during...

Страница 38: ... to ID 18 0 0 1 0 0 bit SRTR 0 0 1 0 1 bit IDE 0 0 1 1 1 ID 17 to ID 13 0 1 1 1 1 ID 12 to ID 5 0 1 1 1 0 ID 4 to ID 0 0 1 1 0 0 RTR bit 0 1 1 0 1 reserved bit 1 0 1 0 0 1 reserved bit 0 0 1 0 1 1 Data length code 0 1 0 1 0 Data field 0 1 0 0 0 CRC sequence 1 1 0 0 0 CRC delimiter 1 1 0 0 1 acknowledge slot 1 1 0 1 0 end of frame 1 0 0 1 0 intermission 1 0 0 0 1 active error flag 1 0 1 1 0 passive...

Страница 39: ...ver 0 0 open the port 0 of card 0 BYTE data CanGetErrorCode CanCloseDriver handle CanSetErrorWarningLimit Purpose Set the Error Warning Limit Prototype C C void CanSetErrorWarningLimit int handle BYTE value Parameters handle handle retrieve from CanOpen Driver Value Error Warning Limit Return Value none Remarks Set the error warning limit If your program has installed the error warning event or ca...

Страница 40: ...ngLimit Usage C C include pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 BYTE limit CanClearOverrun handle CanCloseDriver handle CanGetRxErrorCount Purpose Get the current value of the receive error counter Prototype C C BYTE CanGetRxErrorCount int handle Parameters handle handle retrieve from CanOpen Driver Return Value value Remarks This function reflects the current of the rec...

Страница 41: ... 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 CanSetTxEr rorCount 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 the port 0 of card 0 BYTE error_count CanGetTxErrorCount...

Страница 42: ... 0 CanSetTxErrorCount handle 0 CanCloseDriver handle CanGetPortStatus Purpose Get Port Status Prototype C C int CanGetPortStatus int handle PORT_STATUS PortStatus Parameters handle handle retrieve from CanOpen Driver PortStatus Pointer of PORT_STATUS structure Return Value No Error 0 Error 1 Remarks Get Port Status See the structure define for detailed description See Also Usage C C include pci784...

Страница 43: ...he status of Led This function supports the cPCI 7841 and PM 7841 See Also CanSetLEDStatus Usage C C include pci7841 h int handle CanOpenDriver 0 0 open the port 0 of card 0 BYTE flag CanGetLedStatus 0 0 CanCloseDriver handle CanSetLedStatus Purpose Set the Led Status of cPCI 7841 Prototype C C void CanSetLedStatus int card int index int flashMode Parameters card card number Index index of Led fla...

Страница 44: ...rameters handle handle retrieve from CanOpen Driver Return Value value indicates the left unread messages in the FIFO Remarks Get the unread message count in the FIFO Because the interrupt would be very busy while CAN bus is busy There is possibility to lost the event in Windows system A way to solve to this problem is to call this func tion at free time while program running You also can call thi...

Страница 45: ...void far proc Parameters handle handle retrieve from CanOpen Driver Index event type void far proc Call back function The suggested prototype of the call back function is like void far ErrorWarning Return Value Previous call back function NULL when there is no Call back installed Remarks Install the call back function for event han dling In normal state all hardware interrupt of cPCI PCI 7841 woul...

Страница 46: ...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 CanInstallCallBack 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 DOS int CanRemoveCallBack int handle int inde...

Страница 47: ...urs when the event happened It will not be disabled until using CanRemoveCall Back or a hardware reset Actually the call back function is a part of ISR You need to care about the DOS reen trance problem and returns as soon as possible to preventing the lost of data See Also CanRemoveCallBack Usage C C DOS include pci7841 h void far ErrorWarning int handle CanOpenDriver 0 0 open the port 0 of card ...

Страница 48: ...ent You can refer to follow ing 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 mes sage 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 messag...

Страница 49: ...eters handle handle retrieve from CanOpen Driver Index event type HEvent HANDLE created from Cre ateEvent Win32 SDK Return Value Return 0 is successful 1 if error occurs Remarks 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...

Страница 50: ...InstallEvent handle index NULL And you can create a thread to handle the error event See Also CanRemoveCallBack CanInstallCall Back Usage C C Windows 95 98 NT include 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 CreateEvent NULL FALSE TRUE ErrorWarning CanInstallEvent 0 2 hEvent create a thread T...

Страница 51: ...d party products not manufactured by ADLINK will be covered by the original manufactur ers warranty X For products containing storage devices hard drives flash cards etc please back up your data before send ing them for repair ADLINK is not responsible for any loss of data X Please ensure the use of properly licensed software with our systems ADLINK does not condone the use of pirated software and...

Страница 52: ...of battery fluid during or after change of batteries by customer user X Damage from improper repair by unauthorized ADLINK technicians X Products with altered and or damaged serial numbers are not entitled to our service X This warranty is not transferable or extendible X Other categories not protected under our warranty 4 Customers are responsible for shipping costs to transport damaged products ...

Отзывы: