Full Version : PortB Toggling (ASM)
avr >>ASSMBLER ROUTINES >>PortB Toggling (ASM)


AVR_Admin- 04-16-2006
PORTB toggling

This small assembler code changes PIN state on PORTB.

Just for practice to use interrupt from TCNT0.

The time for PORTB toggling is set for 0,999sek. This can be changed using PRESCALER and OVF_NR values.

Timer/Counter is increased each 32us <1/(CLK/256)>, that causes timer overflow each 8,192ms (32us*256). Each overflow is counted.
Having exactly 1sec for LEDs state changing, the overflow must happened 122times (0x7A). It gives exactly 0,999424sec.

=================
uC: AT90S2313
CLK: 8MHz
=================
e-mail: jdebs@tlen.pl



Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.