Skip to content

Instantly share code, notes, and snippets.

@JoshTGreenwood
Created June 15, 2014 19:01
Show Gist options
  • Save JoshTGreenwood/52acc71b7646ec3b1aa2 to your computer and use it in GitHub Desktop.
Save JoshTGreenwood/52acc71b7646ec3b1aa2 to your computer and use it in GitHub Desktop.
.dseg
.org 0x2000
output: .byte 1 ; insert comment
.cseg
.org 0x0
jmp main ; partial vector table at address 0x0
.org 0x200 ; main entry point at address 0x200 (step though the code)
main: ldi ZL,low(2*table) ; insert comment
ldi ZH,high(2*table) ; insert comment
ldi r16,celsius ; insert comment
add ZL,r16 ; insert comment
ldi r16,0 ; insert comment
adc ZH,r16 ; insert comment
lpm ; lpm = 1pm r0,Z in reality, what does this mean?
sts output,r0 ; store look-up result to SRAM
ret ; consider MAIN as a subroutine to return from - but back to where?
; feahrenheit look-up table
table: .db 32,34,36,37,41,43,45,46,48,50,52,54,55,57,59,61,63,64,66
.equ celsius = 5 ; modify Celcius from 0 to 19 degrees for diferent results
.exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment