hello.
I am trying to make a 100Hz frequency with a pulse width of 1us using an Arduino Uno (Atmega328p / 16MHz).
void setup() {
pinMode(9,OUTPUT);
noInterrupts();
TCNT1=0x0000;
// WGM : 14(1110b), none-inverted mode
TCCR1A = bit(COM1A1)|bit(COM1B1);
TCCR1A |=bit(WGM11);
TCCR1B = bit(WGM13)|bit(WGM12);
//prescailing : clock/8
TCCR1B|=bit(CS11);
//TOP
ICR1 = 20000-1;
//duty cycle
OCR1A= 1;
interrupts();
}
After coding like this, when I measured it with an oscilloscope, it was an intermittent output, not a periodic signal. This is not a continuous 100Hz output.
I measured it by increasing the duty cycle and it worked fine.
I'm not sure which one is the problem. Please help me.