Hi, my friends, I hope you're fine
I use timer 1 Phase Correct Top ICR1 mode
How can i Diagnosis of Timer 1 Period ?
I need an interruption shown in the picture
Thanks
Hi, my friends, I hope you're fine
I use timer 1 Phase Correct Top ICR1 mode
How can i Diagnosis of Timer 1 Period ?
I need an interruption shown in the picture
Thanks
Wouldn't we need to know the AVR model?
I should make the checklist some kind of sticky...
https://www.avrfreaks.net/commen... and many others
Please post a complete test program. Tell your AVR model and clock speed. Tell your language, brand of toolchain and version. Tell compile options, and build results. Are there any warnings?Show your schematic and describe what is connected.
What do you expect to happen? What >>is<< happening? How are you testing?
OK, what does a representative datasheet imply about when the compare match interrupt is carried out?
So you are using Mode 10?
That chart doesn't help much. But the description of the mode...
So you will get an interrupt on both edges. Have code at the head of the ISR to ignore the falling edge.
excuse me
Atmega8A 8mhz
Yes Mode 10
How can I ignore the second interruption in compare match A?
How can I ignore the second interruption in compare match A?
I don't think you can "ignore" it, but you can detect it and then leave the ISR.
All of this is not important to measure the period, as you already know that -- it is the value of ICR1.
I did the following with the code below, do you think this method is reliable and logical?
i using if( !(PINB & (1<<2)) ) to detect it
I don't think you can "ignore" it, but you can detect it and then leave the ISR.
How can i detect this ?
yes i know the period but i want measure the rms voltage and need know status of output in moment
if i using ICR1 match interruption we have
two half cycle and one full cycle can i take samples from this wave and measure rms voltage ? or no i should take samples from beginning to end ?
thank
Not clear what you want.
Do you want to produce a signal using timer1 ?
And do you want to know the rms of this signal?
Then you can calculate it from timer settings.
E.g.
duty_cycle = OCR1A / ICR1
rms = Voltage * sqrt(duty_cycle)
But maybe I did not understand the question.