aceav8or Posted April 16, 2012 Share Posted April 16, 2012 I've been at the screen a little to long so this may be a silly question. I've got a simple microswitch that I'm using to increment a count with this event if ((micro[0] >= 1) && (micro[1] < 1)) count.AddValue(count[0] + 1) endif count is a test channel a to d 0 timing. How can I have the end user set the initial number for the count? TIA Link to comment Share on other sites More sharing options...
AzeoTech Posted April 17, 2012 Share Posted April 17, 2012 Just create a button with the Set To action and specify count as the set channel. You'll need to change count to D to A for this to work. Link to comment Share on other sites More sharing options...
aceav8or Posted May 2, 2012 Author Share Posted May 2, 2012 That absolutely fixed my problem, thank you! Taking this further, I wanted to use the count as the y axis to a graph. So I set up a trace with test channel 1 as the x expression and count as the y. I then scaled the left axis from count[0] to count[0] - 10. I'm sure I made a mistake somewhere as the graph that results just shows a straight line similar to y=-x no matter how many times i increment the count. So two questions. 1. What did I do wrong? 2. Is there a way to have the left axis start with 0 on the top and increment down the graph instead of 0 at the bottom and incrementing up? Link to comment Share on other sites More sharing options...
AzeoTech Posted May 3, 2012 Share Posted May 3, 2012 You need to set the Align Threshold on the Bottom axis to -1 otherwise DAQFactory will try and align your x and y data arrays based on the time stamps of each data point. No, you can't reverse the axes. Link to comment Share on other sites More sharing options...
aceav8or Posted May 8, 2012 Author Share Posted May 8, 2012 I have count set as a logged channel, but the log only shows two "" with no values. Did I miss a setting? How can I log/export the count history with the time it incremented? Link to comment Share on other sites More sharing options...
aceav8or Posted May 8, 2012 Author Share Posted May 8, 2012 Since the timing on this channel (count) is 0, how do I set up a display to say what the value of this channel was X amount of time ago where X is a variable? Link to comment Share on other sites More sharing options...
AzeoTech Posted May 9, 2012 Share Posted May 9, 2012 You are on the right track. The issue is that count will always have the same timestamp because with every new value you are assigning it the previous value + 1, and since 1 doesn't have time associated with it, the time of the new data point ends up being the same as the previous one. This causes the logging set to ignore the new data because it doesn't line up with the other data (the time stamp is old). To fix this, just change the addValue() line to: count.AddValue(inserttime(count[0] + 1,systime(), 0)) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.