02-10-2009 05:49 PM
Hi
I have a program that plays a tone for 250ms than plays nothing for about 3ms then plays the last tone and the duration of the last tone depands on which command i choose. As you can see, all the commands are in a case structure. I've been trying to get it to play for the time periods needed for like a month and still no luck. I really need to have this done really soon and any help is appreciated.
Thanks in advance
moe
02-11-2009 06:31 PM
I need help ASAP please.
02-12-2009 12:21 PM
Oli,
We would love to help you but we have very little info about your project and thus are not sure how we can help or what specific problems you are running into:
1) What are you expecting / wanting to happen?
2) What happens currently? (I would run the VI but I need HP drivers and hardware)
3) FM UP/DOWN seem to have no specfic timing related there. I don't know if this is a problem but merely a guess at what might be the problem.
02-12-2009 12:36 PM
Hi Jason
Thanks for replying. The first part of the program where it's simulating frequencies grabbed from a spreadsheet had to last for 250ms. Then there is no tone for about 3ms then depending which command you choose in the case structure, it should play for the right length.
Here are the right timing for each command;
1. CW short:0.1 sec
2. CW Medium: 0.5sec
3. CW Long: 1 Sec
4. FM Up: 1Sec
5. FM DOWN: 1 Sec
6. Intermediate Depth:1Sec
7. Deep:1Sec
8. Scuttle:1Sec
The program runs fine. The only issue I have is with the timing only. It has to play in that exact timing. Right now what's happening is it'll play but the tones are the wrong durations of length.
Thanks in advance
Moe
02-12-2009 01:00 PM
Oli,
There is a certain amount of determinism affecting the program just by running it on a windows machine. So it will never play in that "exact" timing unless you are running it on a real-time system.
When you say, "the tones are the wrong duration in length" are all of them off? Just some of them? Just one? There will be some time needed for overhead of the program and determinism. Please provide numbers with how "off" the current timing is?
02-12-2009 01:32 PM
First how would I run it on a real-time system
Also, the gap in between was off by a lot. I got using a oscilloscope 14ms and i wanted 3ms. Also, the the commands which are the last tone are usually off by 10 or more ms which is sometimes fine but if we can get it more accurate then that would be good. I'm trying to command a device by those tones so it has to be in that sequence with as close as possible timing for it to respond,
Thanks
Moe
02-13-2009 11:04 AM
Moe,
Several Pieces of advice:
1) Get rid of the unneeded for loop.
2) AVOID using express vi when worried about timing. You are using a timed loop around the outside which seems to have no purpose but the 2 inside loops where a timed loop would apply perfectly you use a while loop with elapsed time express vi.
3) Use wait(ms) instead of the while loop with elapsed time inside. This will have the added benefit (in addition to low overhead) that it will release the processor allowing it to do other things.