71
PCI-1680U/1682U User Manual
Chapter 4
S
oftware
R
equirements
2.
Design graphical interfaces. Add one Button and six Text controls to Form1.
4.7.4.3
Write code
1.
Write corresponding code for Button1.
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim hDevice As IntPtr
Dim status As CanStatusPar_t
Dim result As Boolean
Dim dwOutLen As Integer
Dim ov As New OVERLAPPED
'Open Can Port "CAN1".
'You can also change "CAN1" to a port's name which you
have installed.
hDevice = CreateFile("\\.\can1", GENERI
GENERIC_WRITE, 0, Nothing, OPEN_EXISTING,
FILE_ATTRIBUTE_ FILE_FLAG_OVERLAPPED, 0)
If hDevice.ToInt32 = &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, ov)
If Not result Then
MsgBox("GetStauts Error!")
Exit Sub
End If
TextBox1.Text = "Baud rate= " & status.baud
Summary of Contents for PCI-1680U
Page 10: ...PCI 1680U 1682U User Manual 4 ...
Page 16: ...PCI 1680U 1682U User Manual 10 5 Click Next as the following 6 Click Next as the following ...
Page 22: ...PCI 1680U 1682U User Manual 16 ...
Page 26: ...PCI 1680U 1682U User Manual 20 Figure 3 2 PCI 1682U Silk Screen ...
Page 85: ...79 PCI 1680U 1682U User Manual Chapter 4 Software Requirements WDM CE ...
Page 90: ...PCI 1680U 1682U User Manual 84 4 8 2 2 Receive flow chart ...
Page 91: ...85 PCI 1680U 1682U User Manual Chapter 4 Software Requirements 4 8 2 3 Configure flow chart ...
Page 103: ...97 PCI 1680U 1682U User Manual Chapter 5 Pin Assignments and Wiring ...