Hi all,
I'm trying to have a fast bidirectional control between the ISR and main
loop without much success. Everything goes ok if in the main loop I use the
IE registers flags to stop or start things in the ISR. It seems to not work
ok if I try to control things in the main loop by reading registers which
are changed in the ISR.

In the ISR I'm toggling one bit on and off each time the tmr1 is rollowing.
This is generating a 50% duty cycle signal which I need to control two
power solid state switches A and B. The max toggling frequency is around
8KHz.  There is a delay of 2us between switching, both switches have less
than 1us latency between ON-OFF and OFF-ON states on the hardware side, the
hardware is running ok.

In the main loop I'm reading a voltage and a current controlled by the A
and B switches by reading first the ISR toggled bit and then initiating an
ADC measurement. Even the Tcy speed is enough (48MHz clock), sometimes the
ADC current and voltage values correspond to a wrong switch A and B
position...and this is annoying. I did not read the ADC in the ISR because
I need a perfect 50% duty cycle and a lot of other things are happening in
the ISR adding a jitter....but perhaps this is the only way?

Any good ideas?

BTW, ( this is another story) during USB serial communication ( interrupt
or no interrupt driven)  the other fast processes have to be stopped...and
the GIE flag can not be turned off for a short time in the main loop
because connection is lost...
thx,

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAM%2Bj4qu-brwAtngxuDb4euqLzH3aAbzCS%2BpunwaxYPN%2BjApkVA%40mail.gmail.com.

Reply via email to