Strokes and Counts


Recommended Posts

Hey again, need some assistance on a Counter issue I have encountered.

My Strokes and Counts channels on my Labjack U3-HV are working correctly and counting correctly with Counts.AddValue(Strokes[0] - Strokes[1]) in the Event tab on Strokes.

I am attempting to make a Radio Button on/off switchable to start/stop my counts.

I have made the Radio Button already with the channel I am switching and the values 1 and 0.

I think I am not able to start incrementing from zero because my Strokes channel already has many values.

All I am attempting is to get a count of how many strokes happened from when they click start to when they click stop.

Do I need to make a new Channel similar to Strokes?

I tried making a new channel, StrokesNew, with this in the Event Tab, and it didn't seem to work -

if(RadioButton == 1)
   Counts.AddValue(Strokes[0] - Strokes[1])

I get the same value that is in my Strokes when I tried that.

Any help would be great, my mind is in a tangle!! <_<

Link to comment
Share on other sites

  • 1 month later...

Ugh! This still has my brain tied... :wacko:

If you can possibly help out again, that would be awesome!

I have attached a .ctl file of what I'm working with.

Trying to get the counted strokes from when the user clicks start run, to when the

user clicks stop run.

Anything helps!

Thanks :)

Link to comment
Share on other sites

I don't know what you are doing in the document. All you need to do is create a global variable that stores the current stroke count when the user clicks run. From then on, instead of displaying the raw count, display the raw count minus your global variable. When the user clicks stop, store this difference in another global variable.

Its the same concept for timing how long something occurs. I've attached a sample that shows it. You just need to switch out the systime()'s for your raw counts.


Link to comment
Share on other sites

I don't know what you are doing in the document.

I just had made all the variables, and laid them out to be easily seen, following an equation from here at the office...

Thanks for the reply though, I have adjusted my document and will be trying it out tomorrow morn...

Thanks! :wacko:

Link to comment
Share on other sites

  • 5 months later...

If I want to keep my "Total Strokes" channels (Counter 0 + Counter 1 on my U3-HV) history, do I need to remove the following code from my auto-start seq and make it into a button to reset the counters?? -

AddRequest(ID, LJ_ioPUT_COUNTER_RESET,0,0,0,0)

I don't want my total to reset every time I restart my .ctl file.

Should I just make another variable and pass off the total to store it?

Possibly beat me over the head until I read about file. read/write functions?

Thanks! :)

Link to comment
Share on other sites

Removing that and putting it in a button would keep DF from resetting the hardware counter to 0 until you pressed a button. The thing is, the counter can be reset in other ways, including a disconnect or power off (I believe), so you really should design your system to handle these situations as well, and typically if you design for that, you will solve the daqfactory restart part too.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.