Advantech PCI-1682U Manual de usuario Pagina 70

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 104
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 69
PCI-1680U/1682U User Manual 64
2. Design graphical interfaces. Add one Button and six Text controls to Form1.
4.7.2.3 Write code
1. Write corresponding code for Button1.
Private Sub Button1_Click()
Dim hDevice As Long
Dim Status As CanStatusPar_t
Dim result As Boolean
Dim dwOutLen As Long
Dim ov As OVERLAPPED
'Open Can Port "CAN1".
'You can also change "CAN1" to a port's name which you
have installed.
hDevice = CreateFile("\\.\can1", GENERIC_READ +
GENERIC_WRITE, 0&, 0&, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL
+ FILE_FLAG_OVERLAPPED, 0&) 'Open the CAN port in synchronous
mode
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
Vista de pagina 69
1 2 ... 65 66 67 68 69 70 71 72 73 74 75 ... 103 104

Comentarios a estos manuales

Sin comentarios