ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

What does the Duration control do in the Tone example?

I am taking a look at the Tone Example.vi example that ships with LIFA.  The pulse is generated on pin 3 of the Arduino Uno, and this pin is connected to a scope. I set the frequency at 200 Hz, 500 Hz etc... and the square wave on the scope shows up as expected.

However, I do not see any changes on the signal when the "duration" control is changed... what is this control supposed to do ?

Thx.

Laurent

PS: I also altered the vi by only calling the Tone.vi only when a change on either Frequency, or Duration is detected. This drastically reduce the RX .TX operations between the PC and the Arduino

0 Kudos
Message 1 of 10
(5,721 Views)

Laurent,

The frequency and duration are passed to the Tone function:

http://arduino.cc/en/Reference/Tone

-Sam K

LIFA Developer

0 Kudos
Message 2 of 10
(4,489 Views)

Yes I can see it is passed to the tone input of the Tone function. But using the

VI example: Tone Example.vi, and looking at the signal on a scope, the duration input

seems to have no effect at all.

L.

0 Kudos
Message 3 of 10
(4,489 Views)

Hey Laurent,

The duration input doesn't have an affect in the example because the VI calls the function over and over again in a loop.  If you want the Tone VI to only execute for a certain amount of time you will need to take it outside of the loop. The duration input probably shouldn't be user-settable for this example since it is not going to have an affect.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 4 of 10
(4,489 Views)

Hi Kevin,

As I mentioned earlier Ialtered the vi by only calling the Tone.vi only when a change on either Frequency, or Duration is detected. So in effect the call to done is done once before a parameter change is done by the user, still the duration has no effect. The tone (square signal on my scope) does not end.  I will double-check this, but I am pretty sure of the behavior now.

L.

0 Kudos
Message 5 of 10
(4,489 Views)

Hey Laurent,

You are correct there is something goofy going on with the LIFA Tone call.  Ill take a look at it more and see if I can figure out whats going on.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 6 of 10
(4,489 Views)

Ha ! .

By the way, my application actually does not need the pulse to stop. The tone.vi , with its quirk, is a nice easy way to generate an on-going pulse at variable frequencies.

However, fixing it may be useful in general.

L.

0 Kudos
Message 7 of 10
(4,489 Views)

Allright I found our error. You can look forward to that fix coming up in the next firmware release.

Thanks for pointing this out.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 8 of 10
(4,489 Views)

By the sound of it, the error in the firmware? not the VI ?

L

0 Kudos
Message 9 of 10
(4,489 Views)

The error was in the firmware (order of operations problem with the binary math)

Kevin Fort
Principal Software Engineer
NI
Message 10 of 10
(4,489 Views)