Hello Gerald,
Windows 8.1 does not support virtual serial ports without a Microsoft certificate (the last version of Windows that supported this was Windows 7). Therefore, the entry in Device Manager can be ignored.
This has no effect on the functionality. The hardware provides two interfaces: a "virtual serial port" and an interface that can be used, for example, with WinUSB or the driver DLL.
KCANMonitor or KOBD2Check both use the WinUSB interface via a
DLL. The virtual serial port is only intended for Linux and the Apple operating systems.
In the future, the virtual serial interface will be an optional feature that can be configured, and it will be disabled by default.
With the WinUSB driver, you can do anything you want, and even better than before.
For your own applications, it is generally recommended to use the provided DLL (see also the "Example" sample program) rather than trying to reinvent the wheel.
In the example program, you can directly read and send messages from the CAN bus without having to worry about any COM ports, which may vary on each computer: See the function `void CExampleDlg::OnBnClickedButtonCan()` in `ExampleDlg.cpp`.
Code: |
if(RKSInitialize())
{
RKSSetTimeouts(200, 1000);
if(RKSCANOpen(m_iBitRate))
{
int i, j;
CString strTmp, strData;
can_msg_t sRx;
can_msg_t sTx;
m_strOutput += "\r\nOpened CAN...\r\n";
UpdateData(FALSE);
for(i = 0; i < 20; i++)
{
if(RKSCANRx(&sRx))
{
// Build data byte string
strData.Empty();
for(j = 0; j < sRx.uFrm.sData.byDLC; j++)
{
strTmp.Format(" %02x", sRx.uFrm.sData.abyData[j]);
strData += strTmp;
}
// Build rest of can string
strTmp.Format("Reading ID: 0x%x, length: %d, data:%s\r\n", sRx.uFrm.sData.dwID, sRx.uFrm.sData.byDLC, strData);
m_strOutput += strTmp;
UpdateData(FALSE);
}
// else ... (Read queue was empty)
}
/* Example
DO NOT SEND NONSENSE TO CAN SYSTEMS OR YOU MAY GET UNEXPECTED RESULTS!
sTx.byType = FRAME_TYPE_NORMAL;
sTx.uFrm.sData.dwID = 0x333;
sTx.uFrm.sData.byDLC = 4;
memcpy(&sTx.uFrm.sData.abyData[0], "abcdefgh", 4);
if(RKSCANTx(&sTx)) */
if(1)
{
m_strOutput += "\r\nOne frame NOT sent (for safety reasons, check code)!\r\n";
UpdateData(FALSE);
}
RKSCANClose();
m_strOutput += "\r\nClosed CAN bus.\r\n";
UpdateData(FALSE);
}
}
RKSFree(); |
The key aspect is the following process:
Code: |
RKSInitialize();
RKSCANOpen(gewünschte Bitrate);
solange etwas gemacht werden soll...
{
RKSCANRx(Pointer auf CAN-Frame Variable); bzw. RKSCANTx(Pointer auf CAN-Frame Variable);
... was auch immer empfangen/gesendet oder mit dem Nachrichteninhalt gemacht werden soll...
}
RKSCANClose();
|
Best regards, Rainer.