11-01-2015 12:51 PM
Hi,
Thank you for your help. Here is my actual code.
Initial mass is recorded just for once and then kept as a global variable. It is not read always. I am new to Labview so I do not know much about it. I will check "feedback note" and see if that works for me.
255/80 is a good idea. I will change it.
The screenshot was a previous edition, it is not broken now and works fine. But, I've never thought of CPU usage since this is a relatively simple task.
I used that shift register to store the filepath for the array. I think I should link the file path out of the while loop to the shift register and then link it to "write to spreadsheet file.vi" Right?
11-01-2015 02:48 PM
OK, you code is still a jungle with way too much duplicate code. Here's a quick draft how it could be organized better, eliminating duplicate code and using arrays wherever possible.
(This was modified blidly, so there are probably quite a few errors. I cannot test. Modify as needed).
Some points:
11-02-2015 10:59 AM
Thank you for the revision. It seems a little complicated for me but I will try to understand it. Looks very nice 🙂
11-02-2015 11:43 AM
11-02-2015 12:06 PM
Hello altenbach,
What do you mean when you said,
"Writing the tick count to a file is pointless. It is random."
I don't understand the random part?
Thanks
11-02-2015 12:44 PM - last edited on 12-16-2024 03:58 PM by Content Cleaner
The tick count outputs a U32 value that represents the number of milliseconds elapsed since the sytem has started. once it runs out of numbers it starts again from zero. Unless you start your program exactly after a defined time after the computer has started, the value will be random.
In order to get elapsed time, you need to take the difference of two tick values.
11-02-2015 02:17 PM
I am trying to understand your revision and learning a lot from it. I would be very happy if you could answer the following questions:
1 - You put a delay for the main loop, but this also reduces the data frequency of the balance. I just want to put a delay to adjust the on/off interval of the valves. In this case, shouldn't it be in the case structure (i.e., Case#2)?
2 - The "for loops" are used to write data to Arduino pins. How many times are they executed ? I see that "N" is not defined.
3 - 255/80 is valid for 2 pins of Arduino but one of them should be 255/130. How would you change this?
4 - In Case#2, you created a 1D boolean array and it looks nice but I cannot do it that way? How did you do that? (see the picture)
11-02-2015 02:33 PM - edited 11-02-2015 02:37 PM
11-02-2015 02:48 PM
Thanks for the help! If you look at my replies, I have just 11. I think this shows that I had no idea about Labview, meaning I even don't have Labview 101 knowledge. Sorry for taking your time but I learned a lot from you. Thank you so much again!
11-06-2015 05:47 PM
Hi altenbach,
I have another problem. I thoguht about it for a few days and tried hard but couldn't do it. I need to add another valve (V3) to release the pressure instantly before Valve 2 is opened (regarding case #2). So it should be like the following:
V1 = open, V2 = closed, V3 = closed (duration = 100 ms)
V1 = closed, V2 = closed, V3 = open and closed (duration = 1-10 ms "like a latch action")
V1= closed, V2 = open , V3 = closed (duration = 100 ms)
V1 = open, V2 = closed, V3 = closed (duration = 100 ms)
V1 = closed, V2 = closed, V3 = open and closed (duration = 1-10 ms "like a latch action")
V1= closed, V2 = open , V3 = closed (duration = 100 ms)
....
I may even need to change the duration of various stages but I am not sure about that. How would you do that?
Thank you!