06-22-2013 01:13 PM
Dear Sirs
I am a little stuck on building a oscilloscope in labview
and I hope you can give me some pointers
The problem is that when I try to trigger a signal its keeps running in the wave form
I think it has to do with building the array after the the trigger but I don't know how to solve it
it is a oscilloscope in combination with a Mydac --> where I use the Mydac Function generator as an input
I hope you can give me some advice
Kind Regards
06-25-2013 09:51 AM
Hello Maxofoon,
Can you tell me what the exact requirements of your scope are?
Is this VI part of a homework assignment?
In your code you are using many case structures and many constant arrays which are dependent of settings.
This is very sensitive to mistakes in the different cases or arrays and if you have to make changes to your requirements it will require a decent amount of rework in all of the cases.
It is generally worth the effort to rewrite the code to avoid the altter situations.
It is also a good advise to always test each part of your code on itself with simulated/known data before testing it with real measurements
Lets take a look at the "for loop part" in your code:
- First of all your shift register is uninitialized. This means you will retain previous true values from previous loop iterations, what you most likely don't want to happen.
If you want to start with a false/non-triggered value, then please wire a false boolean to it. This could cause your "fake-triggering"
- The second thing I noticed is that you try to read out X samples, then search for the edge, afterwards throw away the "before-trigger" samples and try to take X samples after the trigger.
Mathematically this is not something that seems logical.
Imagine having 21 samples and 3 before the trigger, then you can only take 18 samples "after" occurance of the rising edge and not 21.
- If you want to follow the current approach, then you should take more samples than you actually need to show. Otherwise you will have to buffer data.
- You should also only update the Waveform Graph if you receive new data that has the apprioriate edge.
If you don't see an edge, then any analog scope I remember would just keep the old values on-screen.
I will first start with these pointers.
If you have extra questions, then feel free to ask.