ilpaso Posted April 24, 2009 Share Posted April 24, 2009 Hi I work with a Labjack U3 and DAQFactory Express I need only a graph with a trace. X axis = time; Y axis = voltage. The trace is printed only when another digital input is high. On the edge of the digital input (low to high) the graph must reset (clearscreen) When the digital input is low the graph stops to draw the trace. Thanks for the help Davide Link to comment Share on other sites More sharing options...
AzeoTech Posted April 24, 2009 Share Posted April 24, 2009 So basically you want the graph to only draw since the last time the digital went high? If you aren't going to use the history of voltage for anything else, you can just do this: In the event of the digital channel (I'll call the channel "dig", and the voltage channel "volt") put: if ((dig[0] == 1) && (dig[1] == 0)) volt.clearhistory() endif Link to comment Share on other sites More sharing options...
ilpaso Posted April 24, 2009 Author Share Posted April 24, 2009 thanks for the answer. I'm trying your code. but I think there is an error. The right code maybe is: if ((dig[0] == 0) && (dig[1] == 1)) volt.clearhistory() endif I don't understand how stop the time, to freeze the graph, when (dig[0] == 1) && (dig[1] == 0) Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted April 24, 2009 Share Posted April 24, 2009 I believe you said you want the graph to clear when it goes from low to high, so you want: if ((dig[0] == 1) && (dig[1] == 0)) Anyhow, I didn't see the part about freezing the graph, so actually you need to create two global variables, starttime and endtime (in an auto-start sequence). Set your graph to display volt[starttime,endtime] instead of just volt. Then make the event say: if ((dig[0] == 1) && (dig[1] == 0)) starttime = systime() endif if (dig[0] == 1) endtime = systime() endif This will set the starttime of the range only when it goes from low to high, and update the endtime whenever its high. When it goes back low, endtime will stop updating and the graph will freeze until the next time it goes high. Link to comment Share on other sites More sharing options...
ilpaso Posted April 25, 2009 Author Share Posted April 25, 2009 Thanks, it works! But I've a last question. How can I autoscale the graph with a command in the event window? The graph shows the "old" window and not update automatically to the new time window. It needs an update or an autoscale. Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted April 27, 2009 Share Posted April 27, 2009 The scales may be frozen. You'll need to name the graph (right click after selecting and do Component Name...), then you can programatically access just about everything in the graph, including the scaling. You'll probably want to thaw the axis to ensure that the user didn't freeze it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.