First AVR experiment

Z MAM wiki

Přejít na: navigace, hledání

We will use ATtiny2313:

Soubor:ATtiny2313.png

and connect LED in one of these ways:

and let it blink. Frst try it in simulator 2 in AVR Studio, using code similar to this:

	.EQU DDRB = $17		; DDRB address
	.EQU PORTB = $18	; PORTB address

	.EQU LED_X = 0		; LED_X is on PB0, pin 12 of ATtiny2313

; Pins connected to LED are outputs, DDRx=1 (set):

	SBI	DDRB, LED_X	; SBI - Set Bit in I/O Register
HOP:
	SBI	PORTB, LED_X
	CBI	PORTB, LED_X
	RJMP HOP
Osobní nástroje