06-24-2010 02:52 PM
Hello,
I am using VabVIEW 9 with Windows Vista and my current hardware for this application is the 9219 (USB).
What I want to do is monitor temperature and pressure as well as an analog signal from a switch (which is N.C.). When the switch changes from NC to NO I want to record the temperature and pressure (Pa and Ta) at which this happens. Likewise, when the switch changes from NO to NC I want to record the temp. and pressure (Pb and Tb). Then I want to make a table of all values Ta, Tb, .. Tn and Pa, Pb, .. Pn as the switch will change states multiple times during a test run.
I started with the first change of state and triggered a Write to Measurement File which can be read in a data table. This works as I can see the first and last data points (points of pressure and temperature at the change of switching state) but is not a solution. How can I pull out the first and last lines (or rows) of data and then write them to another file. Also, the file does not reset after each state change, so if I repeatedly change the switch state I have an ever increasing data log. Or is there another approach I might look at?
Thanks for helping!
06-28-2010 07:28 PM
Hello,
Any suggestions??? I would at least like to see if it is possible to make a single recording at each switch point. As you can see by my code I am stuck.
Thanks,
Brian
06-28-2010 10:11 PM - edited 06-28-2010 10:13 PM
First, you know that comparing a Boolean to True is a Rube Goldberg. It is always the value of the boolean. Likewise =False is the same as Not the original Boolean Value.
What you want to do is remember the value of the boolean from the last iteration by using a shift register. When you find that the boolean is Not equal to its previous value coming from the shift register, then you have a change.
The other trick is that it looks like you have a hysteresis going on with converting an analog input to a boolean value for the switch where the range from 10 to 11 is kind of an unknown land. Look at the function Basic Trigger Level Detection. It works on waveforms however. Or you could do some comparisons, that if the analog value is greater than 11 then Pass on a True, else pass on the previous value. Then compare if the analog value is less than 10, then pass on False, otherwise pass on the previous boolean value.
06-29-2010 09:30 PM
Good point. I'll change the code accordingly. Thank you for the help and tips!