LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Program Help

Hello,

 

I've been chugging along with this program for about 4 or 5 months and have been a regular on this forum since the start of the year getting advice. The program is almost at completion (hopefully) The last problem I have it that the responce is fast enough. Or at least that what I think it is.

  

Ok so this is the operation for the code.

 

How it is supposed to work

 

  1. Press "OK" to start the counter which is counting rising edges of a 100kHz square wave
  2. Press "BEEP" - the current value on the counter is stored in "Counts Start" and a 1500kHz beep is sent out through the computer speaker
  3. A sound beacon 1 meter away from the speaker will send a signal to say that it has heared the 1500kHz beep
  4. The current value on the counter is stored in "Counts End"
  5. Counts Start and Counts End are subtracted and the Distance is calculated
  6. Press "RESET" to repeat process

I am using a SCB 96 and PCI-6229. All the sub VIs are available here http://forums.ni.com/ni/board/message?board.id=170&thread.id=357708&view=by_date_ascending&page=2

 

When "BEEP" is pressed the console button is switched to TRUE. When "signal present" is TRUE, I setup a case statement that will make the "BEEP" button FALSE which also stops the 1500kHz beep.

 

Whats happen at the moment

 

However when "signal present" is TRUE the case statement for "Counts End" won't work properly. The case statement continues to read the counter giving an inaccurate reading. There is almost some sort of lag or delay between the time when "signal present" is TRUE and the time when "BEEP" is set to false and the counter is read for "Counts End"

 

Any suggestions?

 

Is there a away to trigger some sort of boolean or varible so that when "signal present" is TRUE one can make a loop or case statement run once, and only once regardless of how long "signal present" is TRUE for? 

 

Cheers

0 Kudos
Message 1 of 15
(3,732 Views)
SCB-68 sorry
0 Kudos
Message 2 of 15
(3,729 Views)

Hello,

 

I've narrowed the problem down to the fact that the sound beacon sends a square pulse of varying length depending on the distance way from the speaker. The problem is that I want the code to trigger the second the pulse is high, not the duration that the pulse is high for.

 

Because it runs for the duration that the pulse is high for, it continuously reads the counter giving the wrong answer. Can someone help?

 

Cheers

 

K

0 Kudos
Message 3 of 15
(3,713 Views)
Will inducing a delay(Immediately after you get your trigger) and forcefully closing at the end of delay work.I am going through your subvi.Will get back.
0 Kudos
Message 4 of 15
(3,701 Views)

Hi Kamilan,

 

Labview has a first call button that will only run once.  Although if you need this to work for a second beep you might create a boolean and setting it back when you have determined that the sound has stopped.

Message Edited by Jason_D on 10-15-2008 02:16 PM
Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 5 of 15
(3,662 Views)

Hi Jason,

 

Thank you for the suggestions, but the adding a delay still gives the same result. I did try and use the First call fuction, but it locks the boolean to high.

 

I'll keep chugging away 🙂

 

Cheers

0 Kudos
Message 6 of 15
(3,645 Views)

Hello,

 

I've solved the counter stopping problem. Now the problem is that the values jsut aren't accurate. Can someone see some flaws in my code

 

Cheers

 

K

0 Kudos
Message 7 of 15
(3,628 Views)

This is an updated version of my code. The added DAQ was to see the time delay between receiving a HI from the sound beacon, and using that HI in the code. The delay ended up being 2ms.

 

 

0 Kudos
Message 8 of 15
(3,627 Views)

Hi Kamilan,

Can you attach the code for lv 8.0?

0 Kudos
Message 9 of 15
(3,615 Views)
Here is the file in 8.  I will post back more suggestions when I get done taking a look at the code
Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 10 of 15
(3,590 Views)