Content originally posted in LPCWare by MarcVonWindscooting on Sat May 21 10:41:39 MST 2016
Hi Ian,
in my system the current sensing is so noisy that I have to use dead-times between 100ns and 800ns. I ignore the comparator output until the programmed dead-time is over.
Quote: IanB
I made event 0 the comparator input, and event 1 a MATCH event - event 0 LIMITs (resets) the counter, and CLEARs the output. Event 1 just SETs the output. Both happen in state 0.
What I get is output pulses that match the input pulses.
How did you implement it?
In my implementation state==1 means: comparator engaged; state==0 means: comparator ignored
start with: state=0, FET OFF.
match0 of event0 -> off-time expired; switch FET ON
match1 of event1 -> blanking time expired, state=1
Comparator output==1 of event2 -> switch FET OFF, LIMIT (reset counter), capture time to CAP2, state=0
optional: (yes, I use these!)
match3 of event3 -> 'comparator timeout', switch FET OFF, HALT, trigger ISR because something has gone seriously wrong.
match4 of event4 -> keep counter at zero (with matchRel4=0) or 'normal operation' (with matchRel4=-1) for easy, asynchronous on/off switching with a low frequency PWM. I found it quite tricky to on/off modulate my circuit and this is my best solution so far.
Marc