I have a simple PWM with low frequency(like 10Hz) coming out of uC. Now I want to have another pulse generated after a pulse from uC.
eg
I saw some dead time generator on google, but they all are inverting. Like their HIGH and LOW swaps. However what I need is, if there is no pulse, the other should stay LOW. It should only create pulse when there is pulse on input.
What is the maximum and minimum pulse width coming out of the micro?
Do you want the pulse width coming out of the micro to be duplicated after the 1 mS delay, or do you you just need another delayed pulse of a fixed duration?
This is a 2-stage sequencer. A single incoming pulse causes 2 subsequent pulses. You'll take the righthand output (or second echo). The middle pulse is the 'dead time'.
By playing with values you can change pulse lengths. Changing one thing affects other things, so it will require experimentation to get your desired results.
What is the maximum and minimum pulse width coming out of the micro?
Do you want the pulse width coming out of the micro to be duplicated after the 1 mS delay, or do you you just need another delayed pulse of a fixed duration?
I'd say it is the simples solution to do it inside the microcontroller.
* Falling edge of the first signal,
* Delay (dead time)
* set output 2
* delay (pulse width of second signal)
* clear output 2
I'd say it is the simples solution to do it inside the microcontroller.
* Falling edge of the first signal,
* Delay (dead time)
* set output 2
* delay (pulse width of second signal)
* clear output 2
Yes thats the last resort, I would like to avoid using delay inside interrupt call as uC is doing way too many things. A separate uC for this, is kind of an overkill, but if nothing works thats the way it has to go.
This is what I meant: You shouldn't do this with busy waits like "delay()", but with timer, waveform generation...
Even the SPI periferal could be "misued" for this:
Sending "0b00011110" with the correct SPI speed could be used.
Where the leading zeroes define the start delay and the count of "ones" give the pulswidth.
Then it's just sending out one byte. Less than one microsecond of processing time.
Even the SPI periferal could be "misued" for this:
Sending "0b00011110" with the correct SPI speed could be used.
Where the leading zeroes define the start delay and the count of "ones" give the pulswidth.
Then it's just sending out one byte. Less than one microsecond of processing time.