Documente Academic
Documente Profesional
Documente Cultură
see approximately 2 periods. Because the two periods do not fit exactly in this 101 points, we see the signal moving. 13. Now we will extract the array information from the Dynamic Data line (use From DDT, 1D array of scalars) 14. Connect a graph to this signal 15. Test and try your program and see the difference between the two graphs This array will be used now to do some experiments or exercises 16. Check the function of Array Size 17. Check the function of Index Array (connect the original array, connect a control to Index, connect an indicator to Element) 18. Because the program is running so fast, it will be difficult to see this, but you can stop the program to freeze the information 19. Check the function of Array Subset (connect the original array, connect a control to Index, use a Graph to see the result, dont connect Length: default the rest of the array will be taken then). This is a general rule: if you do not connect an input of a block, the default value (given between brackets) will be taken. Note: all bold variables in the Context Help must be connected. 20. Now do connect a constant to Length (e.g. 41). 21. Check the function of Array subset again 22. Check the function of Array Max & Min (perhaps you used it already) 23. Check the function of Search 1D Array (connect a control to Element and an indicator to Index) 24. Search for 0 and for 0,5: you will get -1, which means: not found, why? Alas, the Search function will not be able to find a trigger point for our (future) oscilloscope, but we will use this function later. 25. Check the function of Threshold 1D Array (connect a control to Threshold y and an indicator to Fractional Index or x) 26. Search for 0 and for 0,5: you will get a number, but many times you will get 0 If the fractional index is 21,4287 for example, this means that the value at index 21 is below the threshold and the value at index 22 is above the threshold. Only crossings from below to above the threshold are detected this way. But if the first value (at index 0) is above the threshold the result will be 0. So, this function will also not be able to find a stable trigger point. 27. Check this At this point we have investigated the most important functions in the Array Palette.
MMSp Assignment 5 One channel oscilloscope -2-
4 Hz
250 ms
500 ms
MMSp Assignment 5
-3-
Of course we can go on like this, making an oscilloscope for very low frequencies. But doing so we will meet a problem: the array length, the number of samples which is stored in a register on the myDAQ is limited. On the other hand, it is not useful or necessary to show a signal on a graph made out of so many points: the resolution of the screen is too low to see it anyway. So, as a rule of thumb, we choose the array length to be maximum 1001 points. In order to get the desired total time on the screen, we now have to lower the sampling rate. For example, to get a total time of 500 ms in 1000 time steps (1001 samples), we need a sampling rate of 2 kHz (check!). Now, fill in the table below, taking into account the considerations above. Signal frequency 20 kHz 10 kHz 4 kHz Period time 50 s 100 s 250 s Total time on graph 100 s 200 s 500 s Time/div 10 s 20 s 50 s 100 s 200 s 500 s 1 ms 2 ms 5 ms 10 ms 20 ms 50 ms Length 21 41 Rate 200 kHz 200 kHz
4 Hz
250 ms
500 ms
1001
2 kHz
Check the procedure above using a Simulate Signal as signal source, adjust the Frequency, the Number of samples and the Sampling rate following the table above. Remove the DDT information from the data, using From DDT, to get a plain array and show the array on a Graph. In all cases you should see 2 periods of the signal. You should check all or some of the situations from the table (randomly chosen).
MMSp Assignment 5
-4-
12. Click Ja (Yes) 13. Connect a Graph to the data line of the DAQ Assistant (use From DDT!) When you enlarge the DAQ Assistant a number of inputs and outputs become visible. We will do some experiments with them. 14. Connect a control to number of samples and rate 15. Apply a signal to analog input 0 16. Test your program, check if the two controls change the number of samples and the rate while the program is running
MMSp Assignment 5
-5-
You will notice that number of samples works fine, but rate doesnt 17. Press the stop button 18. Start the program again You will notice that rate now can be changed too. Of course this is not what we want: stopping and starting the program when we want to change the rate. You can see in the diagram that if we press the stop button, not only the DAQ Assistant will stop, but also the While Loop. 19. Remove the (green) line between stopped and the condition terminal of the While Loop 20. Add an extra stop button to control the While Loop 21. Test your program, check if the two controls change the number of samples and the rate while the program is running, by stopping and starting the DAQ Assistant
MMSp Assignment 5
-6-
This way of changing the rate is not convenient. We want to make this automatically. We want to stop the DAQ Assistant when the rate has to be changed and after that start the DAQ Assistant again. To do this we want to check if the rate has to be changed. We use a Shift Register for this purpose. A Shift Register will pass values of variables from one loop to the next. 22. Place a Shift Register on the While Loop (Right click on the right border of the While Loop: Add Shift Register
Two little black block appear on the While Loop. You can send a value of a signal to the right block. The next time the loop executes, this value appears in the left block. So, it will be possible to check if there is a change in that variable. Is the new value different from the last one? If so, we will have to stop the DAQ Assistant. If not, we dont. 23. Remove the stop button of the DAQ Assistant 24. Connect rate to the right block of the Shift Register 25. Place a comparator to check if there is a change and connect the new and the old (last) value of rate 26. Connect the output of this comparator to the stop input of the DAQ Assistant Doing this, the DAQ Assistant will be stopped as soon as there is a change in rate. In the next loop, the new and value will be equal again, so the DAQ Assistant will be started again.
MMSp Assignment 5
-7-
MMSp Assignment 5
-8-
Assignment 5
Make an one channel oscilloscope Specifications: 1. One channel 2. No Express VIs allowed, except one DAQ Assistant 3. Use plains arrays (use From DDT immediately after the DAQ Assistant) 4. Use a Graph to show the result (let the X axis visible) 5. Free running (no triggering function yet) 6. Time/div functionality ranging from 10 s to 50 ms, following the procedures in exercises 3.1, 5.2 & 5.3 7. Volt/div functionality (2, 1, 0.5, 0.2, 0.1, 50m, 20m, 10m, 5m, 2m, 1m), following the procedure in exercises 3.1 and assignment 3 8. Position functionality (vertical shift), following assignment 3. Test your design, by applying a signal to the myDAQ, use: 1. a desktop function generator or 2. the function generator from the instrument launcher or 3. the function generator you made yourself in exercise 4. When finished, show the result to the teacher: demonstration required!
MMSp Assignment 5
-9-