Can somebody supply me a C++ code compiled with DEVCCP to read the analog values and write the digital outputs. I am looking everywhere but I can only find some visual C programs. I am not a star in C++ but i have to do a project using this. All the help is welcome.
I think you mean Dev-C++ ?
If yes, then here’s a link to download a demo project: box.net/shared/7k5s8bp392
This project is for the K8061 USB interface board using the Vistapack driver.
Here is the link to download the Vistapack: velleman.eu/downloads/files/ … 2007v1.zip
Thank you for the quick response, and yes I mean Dev-C++. Can you tell me if there is a way to convert the program to the K8055 card or are can I use the K8055 DLL.
I downloaded the zip file, but it is password protected. Do you have the password? Maybe you can help me with the following:
I have to take voltage samples from one analog port, scale them and then use the digital outpus as limit switches. Further on i must write the sample value every xx seconds to a file. Do you have some hints for me how to start with the program. I have not much experience in C++ but with some help and much reading i wil work me through this project.
The ZIP shouldn’t be password protected.
Maybe there was some problem with the file name containing the “++”.
Now renamed.
Here the link again: box.net/shared/bno8pjqnms
I added to the K8055 example a couple of lines.
Now it reads the analog inputs every two seconds, writes the data a file and outputs the analog channel 1 value to the digital output.
Here a link to the project files: box.net/shared/al9gnyxhr0
Thank you a lot for the sample program. It helps me a lot to understand the way of programming the K8055. I have still one problem that i am struggeling with. I take the samples every second now, but i want to write to file every 60 seconds. Is there an need to use an other timer, or can i use the timer which takes the samples something like:
while(seconds < seconds0+60);
write to file
I have tried this, but then the timer only uses the 60 seconds.
Increment it every second.
When 60, save the data to file and reset the variable.
n++;
if(n == 60)
{
file << "dataIn1, dataIn2 = " << dataIn1 << " " << dataIn2 << endl;
n = 0;
}
BTW: The timer in the K8055 Dev-C++ example is a blocking one, while() loop. It takes all the CPU resources when used. It can be used in test purposes only.
In final solution you have to use a non-blocking “real” timer.
Sorry - I’m not a Dev-C++ specialist - don’t know how to implement such a timer in Dev-C++…
The Sleep() function seems to solve the problem. It seems to be a non-blocking function.
Here a link to updated project files: box.net/shared/al9gnyxhr0
Thanks again for helping me with my project. I now see the problem with the timer and your solution works. The only thing now to do is to send the data to an array, and then calculate the mean value. After that i have to program some limits to send to the digital out.
By the way, I am an absoluut beginner in C++, but i am starting to like programming the Vellemanboard.
[quote=“VEL255”]The Sleep() function seems to solve the problem. It seems to be a non-blocking function.
Here a link to updated project files: box.net/shared/al9gnyxhr0[/quote]
Hi, I’m making a project in school and I was just wondering if I may modify and use your code example in my project. I think it’s OK for the teachers but I need to have your approval first of course