Advertisement
Sumss

lab3v0.1

Dec 1st, 2018
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    .org 0000
  2.     jmp START
  3.    .org INT0addr
  4.     jmp INT0_our
  5.    .org INT1addr
  6.     jmp INT1_OUR
  7.  
  8.     .equ TIME_MEM = $100
  9.     .def multi = r20
  10.  
  11. START:
  12.     ldi r16,HIGH(RAMEND)
  13.     out SPH,r16
  14.     ldi r16,LOW(RAMEND)
  15.     out SPL,r16
  16.     call INIT
  17.     call RESET
  18.     call KLAR
  19.  
  20.  
  21. RESET:
  22.     ldi r16, $00
  23.     ldi XH, high(SEC_EN)
  24.     ldi XL, LOW(SEC_EN)
  25.     st X+, r16
  26.     st X+, r16
  27.     st X+, r16
  28.     st X+, r16
  29.     ldi multi, $3
  30.     ret
  31.  
  32. ;----------------------------------INTERRUPTS----------------------------------;
  33. INT0_OUR: ;klocka
  34.    
  35.     reti
  36.  
  37. INT1_OUR: ;lcd timer
  38.     out PORTB, multi
  39.     dec multi
  40.     sbrc multi, 2
  41.     ldi multi, $3
  42.     reti
  43.  
  44.  
  45. ;----------------------------------HELP----------------------------------;
  46. INIT:
  47.     ldi r16,$7F ; 0111 1111
  48.     out DDRA,r16
  49.     ldi r16,$03
  50.     out DDRB,r16
  51.  
  52. ENABLE_INTERUPTION:
  53.     ldi r16,(1<<INT0)|(1<<INT1)
  54.     out GICR,r16
  55.     ldi r16, (1<<ISC01)|(1<<ISC00)|(1<<ISC11)|(1<<ISC10)
  56.     out MCUCR,r16
  57.     sei
  58.     ret
  59.  
  60. KLAR:
  61.     call INT1_OUR
  62.     rjmp KLAR
  63.  
  64. ;----------------------------------DATA----------------------------------;
  65. .org 180
  66. TABELL: .db $60,$5B,$73,$65,$37,$3F,$62,$7F,$77, $00
  67.  
  68.  
  69. .dseg
  70.  
  71. TIME:   .byte   4
  72.  
  73.     SEC_EN: .byte 1
  74.     SEC_TIO: .byte 1
  75.     MIN_EN: .byte 1
  76.     MIN_TIO: .byte 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement