BeeHay Posted February 12, 2009 Share Posted February 12, 2009 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]) endif 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 More sharing options...
AzeoTech Posted February 12, 2009 Share Posted February 12, 2009 Actually, the easiest way it to create a variable that stores the strokes when they click start and then subtract that value from the strokes readings. Link to comment Share on other sites More sharing options...
BeeHay Posted March 20, 2009 Author Share Posted March 20, 2009 Ugh! This still has my brain tied... 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 More sharing options...
AzeoTech Posted March 21, 2009 Share Posted March 21, 2009 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. elapsed.ctl Link to comment Share on other sites More sharing options...
BeeHay Posted March 21, 2009 Author Share Posted March 21, 2009 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! Link to comment Share on other sites More sharing options...
BeeHay Posted September 3, 2009 Author Share Posted September 3, 2009 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 More sharing options...
AzeoTech Posted September 3, 2009 Share Posted September 3, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.