CANhack.de CAN-Interface RKS+CAN
CAN Hardware, CAN Software, CAN Protocols - CAN Bus Forum for Your CAN Bus Project.

Working example on Visual Studio

 
New Topic Reply 🔗 🖨 CANhack.de - Index » CANhack.de CAN-USB System: RKS+CAN
Author Message
evgidijas
Guest




 


Free account, no CAN development support

Post09-07-2015, 10:14    Subject: Working example on Visual Studio Quote

Hi, I received the RKS+CAN cable and found that KCANMonitor isn't very convenient for my situation. Is it possible to get a working example for Visual Studio 2010 or 2012? The existing project is not compatible, and after attempting to port it, I am encountering project errors.
'Is it possible to use the RKS-USB.DLL file in Visual C#?' Perhaps it is possible to obtain an example?

'Please provide the text you would like me to translate from German to English.'


Translated on 03-07-2026, 19:56.
Back to top
evgidijas
Guest




 


Free account, no CAN development support

Post09-07-2015, 12:42    Subject: Working example on Visual Studio Quote

And what version of software should I use to be able to build that example?
1>c:\users\hp\desktop\example\example\stdafx.h(23) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory

I'm currently encountering this error.


Translated on 03-07-2026, 19:57.
Back to top
CAN-Diagnose
Administrator
Administrator
Avatar-CAN-Diagnose

Joined: 06/07/2011
Posts: 573
Karma: +29 / -0   Thank you, like it!
Location: Ländle



Post09-07-2015, 19:12    Subject: Working example on Visual Studio Quote

Hi,

What exactly is your problem? The project is intentionally in an "old" format (Visual Studio 2008)) because every newer Microsoft Visual Studio version could easily migrate it to its version. This allows the use of Visual Studio 2008, 2010, 2012, or 2015.

Simply install Visual Studio 2015 RC Community Edition along with the Multibyte MFC Library for Visual Studio 2015 RC, and you can begin. For free!

Quote:
1>c:\users\hp\desktop\example\example\stdafx.h(23) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory

Please don't do anything silly. Just open the project solution, Visual Studio will prompt you to convert it, so say "yes, do it" and then compile.

Best, Rainer.



Example-with-Visual-Studio-2015.png
 Description:
 Example project with Visual Studio 2015
 File size:  82.79 KB
 Viewed:  2431 times

Example-with-Visual-Studio-2015.png


Project-converted-to-Visual-Studio-2015.png
 Description:
 Example project conversion.
 File size:  62.85 KB
 Viewed:  1805 times

Project-converted-to-Visual-Studio-2015.png


Example-Visual-Studio-2015.rar
 Description:
 Converted example demo for Visual Studio 2015. Please use (and convert) the original example project (for VS2008) if you use an older Visual Studio version!
Converted example demo for Visual Studio 2015. Please use (and convert) the original example project (for VS2008) if you use an older Visual Studio version!
Download
 File name:  Example-Visual-Studio-2015.rar
 File size:  3.07 MB
 Downloaded:  1264 times
Dipl.-Ing. (FH) Rainer Kaufmann - Embedded Software Freelancer
System RKS+CAN: CANHack.de CAN-Bus Interface


Last edited on 10-07-2015, 6:52, edited 7 times in total.
Back to top Profile PM WWW
evgidijas
Guest




 


Free account, no CAN development support

Post09-07-2015, 23:50    Subject: Working example on Visual Studio Quote

'Thanks, this is the information I was looking for. I was trying to compile it using VS Express, but it's missing some components.' Jetzt funktioniert es.


Translated on 03-07-2026, 20:00.
Back to top
evgidijas
Guest




 


Free account, no CAN development support

Post10-07-2015, 14:26    Subject: Working example on Visual Studio Quote

I have some more questions:

//Set the timeouts for reading / writing data to the RKS+CAN interface.
BOOL RKSSetTimeouts(DWORD dwMsTimeoutRead, DWORD dwMsTimeoutWrite);

1. Am I understanding this correctly? If I set this value to RKSSetTimeouts(200, 200) and the FIFO is empty, will every call to the RKSCANRx() function take 200ms? And if I want to read it without any delay, should the read timeout be set to 0?

2. What are the minimum and maximum values for `dwMsTimeoutRead` and `dwMsTimeoutWrite`? DWORD?

3. What is the size of the transmit (TX) and receive (RX) queues? If I read this function periodically, at a rate faster than the FIFO buffer fills up, will I be able to handle all the received CAN data without any issues?

// Get one CAN message from the receive queue, RKSCANOpen(...) must have.
// called before. Returns TRUE on success.
extern 'C' __declspec(dllexport) BOOL RKSCANRx(can_msg_t* pMsg);


Translated on 03-07-2026, 20:01.
Back to top
CAN-Diagnose
Administrator
Administrator
Avatar-CAN-Diagnose

Joined: 06/07/2011
Posts: 573
Karma: +29 / -0   Thank you, like it!
Location: Ländle



Post10-07-2015, 16:59    Subject: Working example on Visual Studio Quote

1.) No. If a function is able to deliver data, it returns immediately. If not, it waits for the specified timeout period and then gives up (returns).
"I don't know the maximum values, and it's not really important. These values specify timeouts for read or write access during operations between the Winusb device driver and the device hardware. The minimum value (read + write) is 0ms, which doesn't make sense. It doesn't make sense to wait more than a few seconds for a response from the device. Just keep the default values." Why should anyone give the driver, e.g., 10 minutes to get a reply from the USB hardware? icon_eek.gif
3.) The CAN hardware utilizes 32 CAN frame FIFO buffers. Writing to the hardware is NOT buffered by the device driver itself. Reading is buffered as a list, and no data will be lost as long as there is enough memory to store it and you do not close the connection.
"In practice, you don't need to worry about that." Nothing gets lost. icon_smile.gif
Dipl.-Ing. (FH) Rainer Kaufmann - Embedded Software Freelancer
System RKS+CAN: CANHack.de CAN-Bus Interface


Last edited on 15-07-2015, 17:26, edited 3 times in total.
Back to top Profile PM WWW
CAN-Diagnose
Administrator
Administrator
Avatar-CAN-Diagnose

Joined: 06/07/2011
Posts: 573
Karma: +29 / -0   Thank you, like it!
Location: Ländle



Post15-07-2015, 17:27    Subject: Working example on Visual Studio Quote

A C# interface/example for the RKS+CAN hardware is under development and available upon request.
Dipl.-Ing. (FH) Rainer Kaufmann - Embedded Software Freelancer
System RKS+CAN: CANHack.de CAN-Bus Interface


Last edited on 15-07-2015, 17:27, edited 1 time in total.
Back to top Profile PM WWW

Ratings - Working example on Visual Studio

Average rating: 0.00 - worst rating: 0 - best rating: 0 - number of ratings: 0 - View ratings

You are not authorized to rate this topic. Danke sagen
New Topic Reply 🔗 🖨 CANhack.de - Index » CANhack.de CAN-USB System: RKS+CAN
Jump to:  
You cannot post new topics in this forum.