AVR-GCC appnotes by Leitner H.

By Leitner H.

Show description

Read or Download AVR-GCC appnotes PDF

Similar electronics: radio books


2-Methoxyestradiol (2ME2) is a byproduct of estrogen metabolism that was once proven to suppress the expansion of speedily dividing endothelial and tumor cells in vitro and in vivo.

Properties of semiconductor alloys: group-IV, III-V and II-VI semiconductors

The most goal of this ebook is to supply a finished remedy of the fabrics features of group-IV, III−V and II−VI semiconductor alloys utilized in quite a few digital and optoelectronic units. the themes lined during this publication contain the structural, thermal, mechanical, lattice vibronic, digital, optical and service shipping houses of such semiconductor alloys.

Additional info for AVR-GCC appnotes

Sample text

In this loop a do-while loop is inserted, that constantly checks, if the bit on the place 6 of the TIFR register is set or not. This bit has the name TOV2 (timer overflow 2) and is set when the 8 bit register TCNT2 is of the value $FF and tries to increase it -> overflow. In this case the do-while loop is left and the bontent of the variable led is written on PORTB. Afterwards the variable led is increased by one and checks if led is of the value $FF. In this case led is fixed to 0. Otherwise you have to write a one into register TIFR on position 6 , what has as a consequence that the TOV2 is deleted and the timer starts counting from the beginning.

6) is detected, the current value of Timer/Counter 1 is transfered to the 16bit input capture register ICR1 (ICR1L, ICR1H). This sets the input capture flag ICF1 and is possible to call up a interrupt routine (SIG_INPUT_CAPTURE) if the bit TICIE1 (bit5 of TIMSK) is set. The most important thing is that you have to read the low byte (ICR1L), for a full 16bit register read, first. 6 the actual value of timer 1 (high byte) is written at PORTB. h> SIGNAL (SIG_OVERFLOW1) { outp(0,TCNT1H); outp(0,TCNT1L); /* reset timer after overflow */ } SIGNAL (SIG_INPUT_CAPTURE1) { outp(~inp(ICR1L),PORTB); /* reading timer value of capture register */ outp(~inp(ICR1H),PORTB); } /* and write to PORTB */ int main( void ) { outp(0xFF, DDRB); outp(0x00, DDRD); /* define PORTB as Output (Leds) and */ /* PORTD as Input (Switches) */ outp(0xFF, PORTB); /* Enable interrupt for capture and overflow */ outp((1<

One should pay attention that pin T1 is situated at PORTB. Because of that one has to define Pin1 of PORTB as an entry and all the others as an outlet. The next step is the determination of the suitable mode of operation. For that the value $6 is written into register TCCR1B. Now the timer/counter is configurated to pin T1 as a counter of falling edges. Compare mode: The Timer/Counter 1 supports two output compare functions using the registers OCR1A (low and high byte) and OCR1B (low and high byte) as the data sources to be compared to the content of the Timer/Counter register TCNT1 (low and high byte).

Download PDF sample

Rated 4.17 of 5 – based on 43 votes