Skip to content

Instantly share code, notes, and snippets.

@SammyOina
Created October 12, 2021 21:53
Show Gist options
  • Save SammyOina/d495285a9cde95710b7371bac10a4bc8 to your computer and use it in GitHub Desktop.
Save SammyOina/d495285a9cde95710b7371bac10a4bc8 to your computer and use it in GitHub Desktop.
Counts up to 249 and sends the number count to PORTC. Upon reaching 249, it should reset to 5 and again count up to 249. After 249 it should reset to 0 and repeat the whole process again. AVR assembly code (328p)
;
; CountsUp.asm
;
; Created: 10/11/2021 11:07:36 PM
; Author : sammy Kerata Oina
;
setup:
ldi r17, 0b11111111
out ddrc, r17
ldi r17, 0b11111001
ldi r28, 0b11110100
ldi r29, 0b00000101
start:
firstCount:
ldi r16, 0b11111001
DEC1:
mov r18, r16
eor r18, r17
out PORTC, r18
dec r16
brne DEC1
secondCount:
ldi r26, 0b11110100
DEC2:
mov r27, r26
eor r27, r28
add r27, r29
out PORTC, r27
dec r26
brne DEC2
rjmp start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment