Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .set DDRB_o, 0x4
- .equ PORTB_o, 0x5
- PORTD_o = 0x0b
- DDRD_o = 0x0a
- PIND_o = 0x09
- PINB_o = 0x23
- TCCR2A_o = 0xb0
- TCCR2B_o = 0xb1
- PORTD_o = 0x0b
- OCR2A_o = 0xb3
- /*counter 2*/
- OCR0A_o = 0x27
- TCCR0B_o = 0x25
- TCCR0A_o = 0x24
- /*Counter 1*/
- OCR1AL_o = 0x88
- OCR1AH_o = 0x8b
- TCCR1A_o = 0x80
- TCCR1B_o = 0x81
- TCCR1C_o = 0x82
- TCNT1L_o = 0x84
- TCNT1H_o = 0x85
- TIFR1_o = 0x16
- TIMSK1_o = 0x6f
- /*Rx*/
- UDR0 = 0xc6
- UBRR0H = 0xc5
- UBRR0L = 0xc4
- UCSR0C = 0xc2
- UCSR0B = 0xc1
- UCSR0A = 0xc0
- .global main
- .section .text
- ledon:
- ldi r16, 0x20
- out PORTB_o, r16
- ret
- ledoff:
- ldi r16, 0x00
- out PORTB_o, r16
- ret
- main:
- rcall ledoff
- //Se utiliza el Pin 7 como input
- ldi r17, 0b10000000
- out DDRD_o, r17
- //Para usar led
- ldi r17, 0x20
- out DDRB_o, r17
- ldi r17, 0
- out PORTB_o, r17
- //Iniciar timer y cosas
- ldi r17, 0b11000000
- sts TCCR0A_o, r17
- ldi r17, 0b00001101
- sts TCCR0B_o, r17
- ldi r17, 0b10000000
- sts TCCR1C_o, r17
- //Comparador
- ldi r17, 0b10001001
- sts OCR1AL_o, r17 //Comparador
- ldi r17, 0b00111101
- sts OCR1AH_o, r17
- //Interrupciones
- //Contador maquina de estados
- ldi r18, 0b00000010
- sts TIMSK1_o, r18
- sei
- looop:
- rcall ledoff
- rjmp looop
- __vector_12:
- /*
- cpi r18, 1
- breq estatRatlla
- cpi r18, 2
- ---
- estatRatlla:
- ratlla
- */
- //rcall ledon
- reti
- inici:
- ldi r18, 0 //Primer Estado
- in r20, PIND_o
- sbrs r20, 7
- rjmp inici
- rcall punt
- punt:
- /*activar timer int. t(int)= punt + offset
- comparar A y reset timer
- */
- ldi r18, 1
- sei
- loopPunt:
- ldi r20, PIND_o
- sbrs r20, 7
- rjmp silenci
- rjmp loopPunt
- silenci:
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement