C++ devccp

Hello,

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.

Thanks in advance,

Birrel.

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

Here is a link to the K8055 project written in Dev-C++:
box.net/shared/bno8pjqnms

Hello,

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.

Greetz,

Birrel.

Sorry,

It is late and i haven’t read your post well enough. I see now there is also a program for the K8055 included. Thank you very much.

Greetz,

Birrel.

No problem - you didn’t see the K8055 link - it wasn’t there.
I edited the post and added it there later.

I hope this example code is OK.

Hello,

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.

Thanks in advance.

Greetz,

Birrel.

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

Hello,

It works now, thank you. Do you maybe have any idea how to build a timer which sends the data to a file every xx seconds?

Greetz,

Birrel.

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

Hello,

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.

Thanks again,

Birrel. :laughing: :laughing: :laughing:

Simple way is to define a variable.

int n = 0;

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

Hello again,

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.

Greetz,

Birrel.

[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 :wink:

thanks in advance

No problem. You can freely modify and use this code in your project.
Please mention this Forum anyhow… :wink:

Thanks :smiley: of course