New Project Questions
Cenlasoft
Posts: 265
Hello everyone,
I working on the first phase of an ultrasonic non-destructive testing unit. I needed to measure the phase shift of two squarewaves. Attached is FFXOR.spin which includes a schematic in the comments. I am still not an expert at spin, therefore this program could use some work. I am having a prolem with some spin math and optimization. Here is my ultimate goal in this phase:
1. produced two squarewave to input to S1 and S2. Hopefully they should be out of phase.
2. run the squarewaves through a flip-flop and then X-OR.
3. use two prop pins to measure time of waveform.
4. use the formula: Phase_Shift = (t/T)*360, 't' is output of X-OR (pin 3) and 'T' is S2
I used a scope with two channels attached and measured the phase shift with the cursors and was getting results within 1% error from the code.
Any help would be appreciated,
Curtis
I working on the first phase of an ultrasonic non-destructive testing unit. I needed to measure the phase shift of two squarewaves. Attached is FFXOR.spin which includes a schematic in the comments. I am still not an expert at spin, therefore this program could use some work. I am having a prolem with some spin math and optimization. Here is my ultimate goal in this phase:
1. produced two squarewave to input to S1 and S2. Hopefully they should be out of phase.
2. run the squarewaves through a flip-flop and then X-OR.
3. use two prop pins to measure time of waveform.
4. use the formula: Phase_Shift = (t/T)*360, 't' is output of X-OR (pin 3) and 'T' is S2
I used a scope with two channels attached and measured the phase shift with the cursors and was getting results within 1% error from the code.
Any help would be appreciated,
Curtis
spin
13K
Comments
Why the FlipFlops?
Anyway here is a measuring methode that may work more exact because:
- the full clock tick resolution is used (not microseconds)
- it hits always the pos-edge by waiting first for the pin to be low
- calculation of t(T is done in the right order (first mult than div)
The precision of puls measuring can be improved with the help of a counter, but then you need to generate the 2 square waves in another cog to free the counters.
Andy
Thank you very much for your help. I'll try it this morning. As for the Flip-Flops, If I were to input directly into the X-OR, I would could only measure phase shift between 0 and 180 degrees. This way I can go from 0 to 360 degrees. At least that is what I read in an article from India for a simple phase meter. I used some of their ideas. Thanks, I'll post the entire project when I finish. It will be a sensitive ultrasonic instrument used for non-destructive testing on cultural materials.
Curtis
1. I need to replace the two squarewaves produced from the counters with a signal (squarewave) (S2) from a prop pin exciting a ultrasonic transmitter (transducer) and the other signal (sinewave) (S1) coming from the ultrasonic receiver (transducer). The task at hand will be to convert the received echo from the ultrasonic receiver to a squarewave in order to input into the flip-flop (S1) and keep its phase at the same time.
I will try an opamp (lm358(1)) to amplify the echo and an (lm358(2)) as a schmitt trigger to covert the signal. If there are any better solutions, please let me know. Any help will be appreciated.
Thanks,
Curtis