61
PCI-1680U/1682U User Manual
Chapter 4
S
oftware
R
equirements
Write code in empty source file.
#include <stdio.h>
#include <windows.h>
#include "C:\Program Files\Advantech\AdvCan\Include\AdvCan.h"
void main()
{
HANDLE hDevice = NULL;
CanStatusPar_t CanStatus;
BOOL flag;
ULONG dwReturned;
//Open Can Port "CAN1".
//You can also change "CAN1" to a port name which you have
installed.
hDevice = CreateFile("\\\\.\\can1",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,OPEN_EXISTING,
0,
NULL);
if ( hDevice == INVALID_HANDLE_VALUE )
{
printf( "Open Can Port Error!" );
return;
}
// Get Can port status.
flag = DeviceIoControl( hDevice,
CAN_IOCTL_STATUS,
NULL,
0,
&CanStatus,
sizeof(CanStatusPar_t),
&dwReturned,
0
);
if ( !flag )
{
printf( "GetStatus Error!");
return;
}
printf( "Acceptance code = 0x%x\n" , CanStatus.acceptancecode
);
printf( "Acceptance mask = 0x%x\n" , CanStatus.acceptancemask
);
printf( "Baud = %u\n", CanStatus.baud );
printf( "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
Страница 10: ...PCI 1680U 1682U User Manual 4 ...
Страница 16: ...PCI 1680U 1682U User Manual 10 5 Click Next as the following 6 Click Next as the following ...
Страница 22: ...PCI 1680U 1682U User Manual 16 ...
Страница 26: ...PCI 1680U 1682U User Manual 20 Figure 3 2 PCI 1682U Silk Screen ...
Страница 29: ...Chapter 4 4 Software Requirements This chapter has information on the software of PCI 1680U 1682U ...
Страница 85: ...79 PCI 1680U 1682U User Manual Chapter 4 Software Requirements WDM CE ...
Страница 89: ...83 PCI 1680U 1682U User Manual Chapter 4 Software Requirements CE 4 8 2 Flow Chart 4 8 2 1 Send flow chart ...
Страница 90: ...PCI 1680U 1682U User Manual 84 4 8 2 2 Receive flow chart ...
Страница 91: ...85 PCI 1680U 1682U User Manual Chapter 4 Software Requirements 4 8 2 3 Configure flow chart ...
Страница 92: ...PCI 1680U 1682U User Manual 86 4 8 2 4 Event flow chart Either flow chart of the two sub threads is as below ...
Страница 103: ...97 PCI 1680U 1682U User Manual Chapter 5 Pin Assignments and Wiring ...