Page 1
User Manual PCI-1680U 2-Port CAN Interface Universal PCI Communication Card w/ Isolation PCI-1682U 2-port CAN Interface Universal PCI Communication Card w/ CANopen...
Page 2
No part of this manual may be reproduced, copied, translated or transmitted in any form or by any means without the prior written permission of Advantech Co., Ltd. Information provided in this manual is intended to be accurate and reliable. How- ever, Advantech Co., Ltd.
This product has passed the CE test for environmental specifications when shielded cables are used for external wiring. We recommend the use of shielded cables. This kind of cable is available from Advantech. Please contact your local supplier for ordering information.
Page 4
Don't touch any components on the CPU card or other cards while the PC is on. Disconnect power before making any configuration changes. The sudden rush of power as you connect a jumper or install a card may damage sensitive elec- tronic components. PCI-1680U/1682U User Manual...
Description ....................2 Features ....................2 Specifications .................... 3 Ordering Information ................. 3 Chapter Install WDM driver .......5 Begin to use Advantech CAN device driver ..........6 2.1.1 PCI device setup................7 2.1.2 ISA device setup ................8 2.1.3 Port setup..................14 2.1.4...
Page 6
4.10.2 Introduction to Main Items in Menu Screen ........ 90 4.11 COTI.DLL for CANopen Conformance Test ........... 94 Chapter Pin Assignments and Wiring ... 95 Pin Assignments ..................96 Figure 5.1 PCI-1680U/1682U DB-9 pin assignment....96 Wiring...................... 96 Table 5.1: PCI-1680U/1682U Pin Wiring and Description..96 PCI-1680U/1682U User Manual...
Chapter Introduction This chapter provides a general description of the PCI-1680U and PCI-1682U. Sections include: Description Features Specifications Ordering Information...
This drastically reduces the chance of data loss and ensures system reliability. You can run both CAN controllers independently at the same time. The PCI-1680U/1682U operates at baud rates up to 1 Mbps and can be installed in a PC expansion slot.
Chapter Install WDM driver This chapter shows how to install WDM driver. Sections include: PCI device setup ISA device setup Port setup Device setup...
Begin to use Advantech CAN device driver The following chart shows procedures of developing applications with Advantech CAN Driver. There are different installation procedures for PCI device driver and ISA device driver, please respectively refer to: PCI device installation procedures...
The following installation procedures are for PCI devices. Take PCI-1680 as example: First make sure hardware can be installed normally, then turn on the computer and enter operating system. You will see the following screen. Click "Next" as the following. PCI-1680U/1682U User Manual...
The following installation procedures are for ISA devices. Take PCM-3680 as an example. Follow the instructions in the manual to install the device, then turn on the com- puter to enter operating system. Enter Control Panel, then select "Add Hardware". PCI-1680U/1682U User Manual...
Page 15
Click "Next" as the following. Click "Next" as the following. PCI-1680U/1682U User Manual...
Page 16
Click "Next" as the following. Click "Next" as the following. PCI-1680U/1682U User Manual...
Page 17
Click "Have Disk...". Suppose inf file is installed under C:\Program Files\Advantech\AdvCAN\inf, click "Next" as the following. PCI-1680U/1682U User Manual...
Page 18
Click "Next" as the following. When the installation is complete, click "View or change resources for this hard ware (Advanced)" to configure resources of the device. Users can also directly click "Finish" and configure it in Device Manager. PCI-1680U/1682U User Manual...
Page 19
Select "Set Configuration Manually". Configure according to your hardware. Restart the computer to finish the installation. PCI-1680U/1682U User Manual...
When bus driver is installed, users can install port driver AdvCanPort.sys according to the instructions. The installation file is AdvCanPort.inf. When the installation is finished, users can find the device in Device Manager and set ports in properties page. PCI-1680U/1682U User Manual...
Right click icon of "My Computer" and click "Manage", then select "Device Manager". Click the eAutomation CAN port that you want to configure, and select "Proper- ties" to open properties page of the port. Users can set the device in PORT_INFO. PCI-1680U/1682U User Manual...
It should be free of marks and scratches and in perfect working order when received. As you unpack the PCI-1680U/1682U, check for signs of shipping damage (damaged box, scratches, dents, etc.). If it is damaged or it fails to meet specifications, notify our service department or your local sales representative immediately.
Figure 3.3 How to Set Jumpers 3.2.2 Terminator Resistor Setup You can set the terminator resistor if necessary to match impedance. Each port has a separate resistor. Table 3.1: PCI-1680U/1682U Terminator Resistor Reference Status Value of Terminator Resistor Open mode Close mode...
Page 28
Replace the screw in the expansion slot's retaining bracket. Replace anti-vibration cardholder. Replace the PC's cover. Connect the cables you removed in step 3. Turn the computer power on. The board is now installed in the computer. See Chapter 5 for information on cabling. PCI-1680U/1682U User Manual...
PeliCAN mode, are used to drive SJA1000 chip on Advantech CAN device.Bus drivers and ports drivers are compliant with PCI and ISA bus, and provide the users with coherent operation interfaces.
Page 31
CAN 2.0B are compatible with CAN 2.0A. SJA1000 SJA1000 supports BasicCAN mode and PeliCAN mode. BasicCAN mode supports CAN 2.0A, while PeliCAN mode supports 2.0B. Advantech CAN Windows WDM&CE Driver runs in PeliCAN mode, thus it can support both Standard frame and Extended frame.
CANopen. pen) ADVANTECH GENERAL CAN 4 port Isolated PCI CAN bus Card and PORT (4 PORT, support CANo- support CANopen. pen) Users of Windows CE can refer to Guide for developing applications References "SJA1000 Standard-alone CAN controller" PCI-1680U/1682U User Manual...
Close the port by calling CloseHandle when operation is completed. Note! This driver does not support share open function, so the third parameter must be set to 0. Syntax HANDLE CreateFile( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile PCI-1680U/1682U User Manual...
Users can use this interface to read data from CAN port which was opened. One or more frames can be selected each time. Note! The third and fourth parameters of ReadFile are defined as byte length in MSDN, but stand for the number of frames in Advantech CAN Win- dows WDM&CE Driver. Syntax BOOL ReadFile(...
If busoff of device is discovered before drivers send any frames, GetLastError will be called to return ERROR_GEN_FAILURE. If drivers cannot allocate resources according to the number defined by the third parameter frame, GetLastError will called return ERROR_INVALID_PARAMETER. PCI-1680U/1682U User Manual...
Handle of the device which was opened. dwEvtMask Input Event type. Return Value Successful: return non-zero values. Unsuccessful: return zero value. Please call Get- LastError function. Example BOOL bSuccess = SetCommMask(hDevice, EV_ERR | EV_RXCHAR); See Also WaitCommEvent GetCommMask PCI-1680U/1682U User Manual...
Handle of the device which was opened. lpEvtMask Output Event type. If CreateFile uses asynchronous open, asynchronous oper- ation must be supported here. Please refer to MSDN for lpOvelapped Output detailed instruction to asynchronous open. *Note In WINDOWS CE,set to NULL. PCI-1680U/1682U User Manual...
Page 49
BOOL bSuccess = SetCommMask(hDevice, EV_ERR | EV_RXCHAR); if(!bSuccess) //error DWORD dwMask = 0; bSuccess = WaitCommEvent(hDevice, &dwMask, NULL); if(bSuccess) if(dwMask & EV_ERR) //to do DWORD dwError; ClearCommError(hDevice, &dwError, NULL); if(dwMask & EV_RXCHAR) //to do See Also SetCommMask ClearCommError PCI-1680U/1682U User Manual...
Empty. If users want to know specific information about error lpStat Output register, please call DeviceIoControl to get status of the device. Return Value Successful: return non-zero values. Unsuccessful: return zero value. Please call Get- LastError function. PCI-1680U/1682U User Manual...
Page 51
& EV_ERR) //to do DWORD dwError; bSuccess = ClearCommError(hDevice, &dwError, NULL); if(bSuccess) //to do if(dwError& CE_FRAME || dwError& CE_BREAK) CanStatusPar_t status; DWORD dwReturned; DeviceIoControl (hDevice, CAN_IOCTL_STATUS, NULL, &status, sizeof(CanStatusPar_t), &dwReturned, NULL See Also WaitCommEvent DeviceIoControl PCI-1680U/1682U User Manual...
Page 53
// Intialize the rest of the OVERLAPPED structure to zero. ov.Internal = 0; ov.InternalHigh = 0; ov.Offset = 0; ov.OffsetHigh = 0; if (WaitCommEvent(hDevice, &dwEvtMask, &ov)) if (dwEvtMask & EV_ERR) // To do. if (dwEvtMask & EV_RXCHAR) // To do. PCI-1680U/1682U User Manual...
%d.\n", GetLastEr- ror()); See Also ReadFile WriteFile WaitCommEvent Structure List The table below is a list of structures needed by Advantech CAN WDM Driver. Methods: canmsg_t Received/Sent message structure. CanStatusPar_t Port status structure. Command_par Command/Configure operation structure.
Users can get the specific type from flags. If ID does not equal 0xFFFFFFFF, flags may be Remote frame, Extended frame, Standard frame, Self Reception or software overrun. PCI-1680U/1682U User Manual...
The CAN port's baud rate is determine by CAN clock, BTR0 and BTR1 . The Advantech CAN devices use 8MHZ clock and oscillator frequency is 16M, The internal clock is divided by two from the oscillator frequency.
Page 59
Start chip and enter work CMD_START Reserved Reserved mode. Stop chip and enter reset CMD_STOP Reserved Reserved mode. Stop chip by canceling current CMD_RESET send/receive operation and Reserved Reserved enter reset mode. CMD_CLEARBUFF Clear receive buffer. Reserved Reserved PCI-1680U/1682U User Manual...
CAN 2.0B are compatible with CAN 2.0A. SJA1000 supports BasicCAN mode and PeliCAN mode. BasicCAN mode supports CAN 2.0A, while PeliCAN mode supports 2.0B. Advantech CAN Windows WDM&CE Driver runs in PeliCAN mode, thus it can support both Standard frame and Extended frame.
0x7D7(11111010111), 0x610(11000010000), etc. Example of Extended frame: 10010100 1011000X 1100XXXX 00110XXX 00000000 00000001 00001111 00000111 accepted 10010100 1011000X 1100XXXX 00110XXX ID(ID.28``ID.0) In this example, RTR is not considered and the accepted IDs include: 0x12961806(10010100101100001100000000110), 0x129639E6(10010100101100011100111100110), etc. PCI-1680U/1682U User Manual...
Page 64
00000000 00000001 00000000 00000000 accepted ID(ID.28``ID.13) 00000000 00000001 In this example, the accepted IDs include: 0x2000(10000000000000), 0x3FFF(11111111111111), etc. Filter2: 00000000 00000001 00000000 00000000 accepted ID(ID.28``ID.13) 00000000 00000001 In this example, the accepted IDs include: 0x2000(10000000000000), 0x3FFF(11111111111111), etc. PCI-1680U/1682U User Manual...
Visual C++ environment. 4.7.1.1 Create a new VC project Related header files must be used before using Advantech CAN Windows WDM&CE Driver interface function. Make sure the driver had been installed correctly. (Please refer to relevant books and documentations regarding detailed information about VC development.)
Page 66
4.7.1.2 Add necessary files Add Include header files (AdvCan.h) in Advantech CAN Windows WDM&CE Driver. In VC++ work area, right click "Header Files", then select "Add Files to Folder" to add header files to the project. 4.7.1.3 Write code “Select "Add to Project->New" from "Project"£¨ then select "C++ Source File".
Page 67
"Self reception = %u\n" , CanStatus.selfreception ); printf( "Read time out = %u\n" , CanStatus.readtimeout ); printf( "Write time out = %u\n" , CanStatus.writetimeout ); //Close port handle flag =CloseHandle(hDevice); if ( !flag ) printf( "Close Error!"); return; PCI-1680U/1682U User Manual...
Visual Basic environment. 4.7.2.1 Create a new VB project Related header files must be used before using Advantech CAN Windows WDM&CE Driver interface function. Make sure the driver had been installed correctly. (Please refer to relevant books and documentations regarding detailed information about VB development.)
Page 69
4.7.2.2 Add files and design graphical interfaces Add Include header files (AdvCan.bas) in AdvCAN Windows WDM&CE Driver. Right click the project and select Add->Module Item,then select Existing Item to add AdvCan.bas.(Installation path\AdvCan\Include\AdvCan.bas) PCI-1680U/1682U User Manual...
Page 70
If hDevice = &HFFFFFFFF Then MsgBox ("Open Error!") Exit Sub End If 'Get Can port status. result = DeviceIoControl(hDevice, CAN_IOCTL_STATUS, Noth- ing, 0&, Status, Len(Status), dwOutLen, 0&) If Not result Then MsgBox ("GetStauts Error!") Exit Sub PCI-1680U/1682U User Manual...
Page 71
" CStr(Sta- tus.WriteTimeOut) result = CloseHandle(hDevice) 'Close the CAN port If Not result Then MsgBox ("Failed to close the CAN port!") End If End Sub 4.7.2.4 Test application Run the application, the following result will be displayed. PCI-1680U/1682U User Manual...
VC.NET environment. 4.7.3.1 Create a new VC.NET project Related header files must be used before using Advantech CAN Windows WDM&CE Driver interface function. Make sure the driver had been installed correctly. (Please refer to relevant books and documentations regarding detailed information about VC.NET development.)
Page 73
Design graphical interfaces. Add one Button and six Text controls to Form1. PCI-1680U/1682U User Manual...
Page 74
.ToString(); this->textBox5->Text = "Read TimeOut = " + CanStatus.readtime- out .ToString(); this->textBox6->Text = "Write TimeOut= " + CanStatus.writetim- eout .ToString(); result = CloseHandle( hDevice ); //Close the CAN port if (! result ) MessageBox::Show ("GetStauts Error!"); return; PCI-1680U/1682U User Manual...
VB.NET environment. 4.7.4.1 Create a new VB.NET project Related header files must be used before using Advantech CAN Windows WDM&CE Driver interface function. Make sure the driver had been installed correctly. (Please refer to relevant books and documentations regarding detailed information about VB.NET development.)
Page 76
A new VB.NET project is created. 4.7.4.2 Add files and design graphical interfaces Add Include header files (AdvCan.vb) in AdvCAN Windows WDM&CE Driver. Right click the project, then select Add->Add Existing Item to add AdvCan.vb. (Installation path\AdvCan\Include\AdvCan.vb) PCI-1680U/1682U User Manual...
Page 77
MsgBox("Open Error!") Exit Sub End If 'Get Can port status. result = DeviceIoControl(hDevice, CAN_IOCTL_STATUS, Noth- ing, 0, status, Len(status), dwOutLen, ov) If Not result Then MsgBox("GetStauts Error!") Exit Sub End If TextBox1.Text = "Baud rate= " & status.baud PCI-1680U/1682U User Manual...
Page 78
TextBox6.Text = "Write TimeOut: = " & status.writetimeout result = CloseHandle(hDevice) 'Close the CAN port If Not result Then MsgBox("Failed to close the CAN port!") End If End Sub 4.7.4.4 Test application Run the application, the following result will be displayed. PCI-1680U/1682U User Manual...
C# environment. 4.7.5.1 Create a new C# project Related header files must be used before using Advantech CAN Windows WDM&CE Driver interface function. Make sure the driver had been installed correctly. (Please refer to relevant books and documentations regarding detailed information about C# development.)
Page 80
4.7.5.2 Add files and design graphical interfaces Add Include header files (AdvCan.cs) in Advantech CAN Windows WDM&CE Driver. Right click the project, then select Add->Add Existing Item to add AdvCan.cs. (Installation path\AdvCan\Include\AdvCan.cs) PCI-1680U/1682U User Manual...
Page 81
Design graphical interfaces. Add one Button and six TextBox controls to Form1. PCI-1680U/1682U User Manual...
Page 82
= "Self recevie = " + CanStatus.selfreception .ToString(); textBox5.Text = "Read TimeOut = " + CanStatus.readtimeout .ToString(); textBox6.Text = "Write TimeOut= " + CanStatus.writetimeout .ToString(); result = AdvCan.CloseHandle( hDevice ); //Close the CAN port if (! result ) MessageBox.Show ("GetStauts Error!"); return; PCI-1680U/1682U User Manual...
4.7.5.4 Test application Run the application, the following result will be displayed. Examples Advantech CAN Windows WDM&CE Driver package contains examples of VC, VB, VB.NET, C#.NET, VC.NET, eVC. Users can refer to these examples to develop appli- cations. WDM: Example Name Description VB.NET C#.NET VC.NET...
Users can click "Stop" button to stop sending frames during the process, then the name of the button will return to "Start" for the next send operation. PCI-1680U/1682U User Manual...
Page 86
Users can click "Stop" button to stop receiving frames during the process, then the name of the button will return to "Start" for the next receive operation. PCI-1680U/1682U User Manual...
Page 87
If the configuration fail, prompting message will be dispalyed. Note! This is only used to change configuration of the application which is cur- rently running. Once "Configure" item is closed, all changes made in it will not be retained. PCI-1680U/1682U User Manual...
Page 88
The two ports are using duplex communication. Users can click "Stop" button to stop sending/ receiving frames during the process, then the name of the button will return to "Start" for the next send/receive operation. PCI-1680U/1682U User Manual...
Use Utility to test hardware An Utility is provided for users to test whether hardware is working normally. It's installed under C:\Program Files\Advantech\AdvCAN\Utility directory by default. This Utility can be divided into four parts: In Part 1, users can select which port to open in the choice box at top.Set "Baud Rate", "acceptance filter mode", "acceptance code", "acceptance Mask", and choose...
CANMonitor can show messages in the formats of CAN and CANopen. System Requirements Windows 2000, 32-bit Windows XP, 32-bit Windows Vista, 32-bit Windows 7, 64-bit Windows XP, 64-bit Windows Vista, 64-bit Windows 7. PCI-1680U/1682U User Manual...
Detects all the possible CANopen nodes, from 1 to 127. CANopen CAN Message Filter Configures CAN message filter modes. CANopen Message Fil- Configures CANopen message filter modes. CAN Message View Shows CAN format message. CANopen Message Shows CANopen format message. View PCI-1680U/1682U User Manual...
View has the following functions: Name Function Toolbar Whether to show the toolbar Status Bar Whether to show the status bar Auto Scroll Whether to scroll automatically Clear Clear all the messages Goto Go to the specified line PCI-1680U/1682U User Manual...
Page 97
Function has the following functions: Name Function Start communication Stop Stop communication Show Show the message Hide Hide the message Listen Only Whether to open Listen Only mode CAN has a submenu: Name Function Send CAN Message Send CAN Message PCI-1680U/1682U User Manual...
Page 98
List all CANopen nodes Change Node State Change CANopen node state Read Object Read CANopen node data Write Object Write CANopen node data Node Guard All Get all CANopen nodes Filter Filter has CAN Filter setting and CANopen Filter setting. PCI-1680U/1682U User Manual...
Page 99
Show the number of the messages sent Show the number of the messages received Show the number of Overrun Show the number of lines of the data; the maximum number will not exceed the number configured when the device is open PCI-1680U/1682U User Manual...
COTI.DLL for CANopen Conformance Test The COTI DLL allows users to use the CANopen Conformance Test Tool of CiA(CAN in Automation) with Advantech CAN WDM Driver.This file has to be copied into the directory of the CANopen Conformance Test.More detailed presentation about CAN- open Conformance Test Tool, please refer to: http://www.can-cia.org/index.php?id=141.
Chapter Pin Assignments and Wiring This chapter covers the pin assignment for the CAN connec- tor, and the wiring of the two transmission wires. Sections include: Pin Assignments Wiring...
Figure 5.1 PCI-1680U/1682U DB-9 pin assignment Wiring The CAN standard supports half-duplex communication. This means that just two wires are used to transmit and receive data. Table 5.1: PCI-1680U/1682U Pin Wiring and Description PCI-1680U/1682U DTE (male DB-9) Terminal DTE Signal...