Advanced Programming For Arduino Geeks by Yury Magda

Advanced Programming For Arduino Geeks by Yury Magda

Author:Yury Magda [Magda, Yury]
Language: eng
Format: epub
Published: 2018-07-11T23:00:00+00:00


// Timer/Counter 1 initialization

TCCR1A=(0<<COM1A1) | (0<<COM1A0) | (0<<COM1B1)

| (0<<COM1B0) | (0<<WGM11) | (0<<WGM10);

TCCR1B=(0<<ICNC1) | (0<<ICES1) | (0<<WGM13) | (0<<WGM12)

| (0<<CS12) | (0<<CS11) | (0<<CS10); // initially, Timer 1 is stopped

ICR1H=0x00;

ICR1L=0x00;

OCR1AH=0x00;

OCR1AL=0x00;

OCR1BH=0x00;

OCR1BL=0x00;

// Timer/Counter 1 Interrupt(s) initialization

TIMSK1=(0<<ICIE1) | (0<<OCIE1B) | (0<<OCIE1A) | (0<<TOIE1);

interrupts();

}

void loop() {

numTicks = 0;

TCNT1 = 0;

while ((PIND & 0x80) != 0x0);

while ((PIND & 0x80) == 0x0);

TCCR1B |= (1<<CS10);

while ((PIND & 0x80) != 0x0);

TCCR1B &= ~(1<<CS10);



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.