Hi.. i need help.. i have the coding as shown below, but its not working as what i expected.. base on what i know, the coding below should provide me a 2MHz frecuency at output pin 9 and 1kHz at ouput pin 8.. but when i test it with oscilloscope i only obtain 2kHz at output pin 9.. what should i do to obtain 2MHz at output pin 9?? how can i change/modified the code?? many2 thankz..
#include <util/delay.h>
int rog = 8;
void setup() {
pinMode(9, OUTPUT);
pinMode(rog, OUTPUT);
TCCR1A = 0;
TCCR1B = 0;
TCCR1A |= _BV(WGM11) | _BV(COM1A1);
TCCR1B |= _BV(WGM12) | _BV(WGM13) | _BV(CS10) | _BV(ICNC1);
ICR1= 7;
OCR1A = 3;
}
void loop(){
delayrog();
}
void delayrog(){
while (1)
{
digitalWrite(rog, HIGH);
_delay_ms(0.52);
digitalWrite(rog, LOW);
_delay_ms(0.52);
}
}