LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

measure time lapsed from reaching threshold to execution

Thank you again..  (my apologies for too many edits.. I've bee spotting little things here and there) 

 

hi thereeeee.png

 

0 Kudos
Message 51 of 60
(1,411 Views)

This does not look right, because an "over threshold" would get ignored while any of the other booleans are true. There needs to be a priority. In fact, if any two are true (one button and the overvoltage at the same time), you'll execute the empty default case.

 

 

0 Kudos
Message 52 of 60
(1,405 Views)

I pushed the voltage reading and comparison to threshold to the top (case 1).  Is this what you mean by prioritizing the threshold comparison?  

 

The mechanical action is set such that it latches when pressed.  I don't think I can have more than one being true simultaneously. 

 

I see your point.  I turned on the "highlight execution" and held two of the buttons. (so two of the inputs are True).  I noticed that the output of "Boolean Array To Number" was 192 and that led to triggering "default."  

 

Although this wont ever happen in my experiment, I would like to know how you would prioritize the voltage reading compared to the threshold.  

 

 please.png

 

0 Kudos
Message 53 of 60
(1,400 Views)

If the overthreshold is the highest bit, you could make its case 128 ...... which will give that case no matter which other buttons are pressed.

 

You might also consider using search 1-D array for the first true, and the index will be what drives the case structure.

0 Kudos
Message 54 of 60
(1,388 Views)

You also still have 8 instances of the same string diagram constant ("GPIB0::11::INSTR"). Exactly one is sufficient, right?

 

Also, if stop is pressed, shouldn't you e.g. send a VISA command (e.g. "off" or similar)?

0 Kudos
Message 55 of 60
(1,382 Views)

OK, here's a quick draft how I would probably do it, reusing most code as much as possible. It even sends an off command when the stop button is pressed.

Note how I align the string array diagram constant with the button terminals to easily see what each one is sending.

 

TimeLapse.png

 

(As noted earlier, I don't have DAQmx here, so I cannot test. It probably needs a few tweaks here or there. 😉

I also cannot wire errors, because I don't have the functions. You should wire all errors. Modify as needed)

 

Comparison with your code:

  • One VISA Write function instead of eight!
  • One instrument string instead of eight!
  • Graceful shutdown if stop is pressed.
  • A Case structure with two cases instead of nine!
  • All VISA send strings arranged in one diagram constant array instead of scattered across 8 different cases.
  • Two sequence frames overall instead of four!
  • On over-voltage or stop, all other buttons are ignored instead of handled and an OFF is send.
  • Terminals arranged logically and not scattered randomly on the diagram
  • ...

 

0 Kudos
Message 56 of 60
(1,378 Views)

Thank you for your comment and vi file.

 

I made a few tweaks, most notably moving the 2nd "high resolution relative" inside the case structure.

(this was the only way I could think of to have the program trigger the time difference calculation when the threshold voltage was exceeded) 

plesae2.png

0 Kudos
Message 57 of 60
(1,359 Views)
  • Never ever attach an edited file with the same name as an already existing file.
  • One problem with your solution is the fact that the time display will show stale data because it only gets updated if an over-voltage occurs.
  • You created a new race condition because the time difference is calculated while the VISA session is still occurring, i.e. not finished yet. You need to take the second tick after the VISA session (notice e.g. the annotated error wire in my code)
0 Kudos
Message 58 of 60
(1,349 Views)

(I apologize. I was able to fix this issue by following the instructions here.)

 

Hello, it's been a long time and I noticed one issue with the program that I cannot wrap my head around.

 

The voltage reading cannot exceed 5.26V I noticed even if the actual voltage is well above it. The voltage reading gets stuck at 5.26V. 

 

Is this a limitation of sorts by LabVIEW? 

 

I know it's not the settings of my NIDAQ because when I use igor to measure the analog input voltage, it can go above 5.26V 

 

0 Kudos
Message 59 of 60
(1,337 Views)

Well,   Igor is probably used to therapeutic voltages:D for his EST.  Or, could you clarify that?

 

Your channel is likely scaled to 5V max.  Or, you damaged the DAQ front end 

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 60 of 60
(1,329 Views)