Capturing rising and falling edge of analog signals using PSIM and DSP
Hi !
I am using PSIM software simcoder to run a TI28335 DSP.
My current goal is to calculate the phase difference between two input analog signals.
The signals are high frequency signals (300-500 kHz) such that I cannot just randomly sample them. In addition, their frequency might very and is not also known during operation.
In order for my logic circuit to work and provide the right phase within one switching cycle, I need to force the hardware to sample the signals on their rising and falling edges.
I read that there is a capture block in PSIM, but I find it hard to understand how to use it to my needs, didn't find any examples of such simulations as well.
Any help would be much appreciated.
A picture for clarity is added.
Answers
-
Hi,
There are some examples by using capture block. Though the examples are with some other targets, these will give idea to implement. Please refer to them once.
Open PSIM »»» File »»» Open Examples »»» Code Generation »»» F2803x Target »»» Capture »»» Cap Test.psimsch.
Here in this example, you may replace with F28335 block and modify according to the requirements.
Thank you,
Vishwanatha Siddhartha
0 -
Hi,
Three questions:
1.
The capture block in the example you referred to captures the time difference between the rising edge and the falling edge of a certain signal.
I need to capture the rising edge and falling edge of a signal, the time difference between a rising edge and a falling edge of a signal will not help.
In other words, I must know if the edge I have just detected is a rising edge or whether it is a falling edge
With the right code, I might be able to know when a rising/falling signal occurred but will I be able to tell which one was it ? (rising or falling edge)
I am not sure I understand how a capture block will meet my need.
2.
Does using a capture block in the simulation ensures the the DSP will "catch" the input signal right on its rising/falling edge?
3.
I've noticed that there is an "interrupt" block.
Will it suit my needs?
(3 pictures are added for clarity))
0 -
Hi,
Based on your requirement, I feel only capture block not sufficient. "INT" and "Capture" blocks together may be better option. The following example will give you some better clarity.
PSIM\File\Open examples\Code Generation\F2837x Target\Capture\Test capture with Interrupt.psimschIn this example, you may try to change Timer mode in capture block to absolute time and keep edge detection type to rising/falling or both. These settings will give basic idea to implement your requirement.
Thank you,
Vishwanatha Siddhartha
0 -
I want to make sure I got it right.
By using capture and interrupt I can be sure that the DSP will sample the input analog signal
(from the sensor) exactly on the rising edge and falling edge of the signal , right?
This is my main concern due to the fact that I want to detect zero crossing of a signal with frequency larger than 250kHz and therefore, missing the zero crossing by more than 12ns is bad.
(which means I cannot sample the signal randomly)0