eehero
Full Member level 3
Hi all, last day i had work on this eqaution (with AVR asm.):
T=-4000+(Th:Tl)
Th,Tl:are 8bit registers,hence (Th:Tl) is 16bit
Ok,what i done to process this eqaution and make the result proper to display
on 2x16 LCD:
Firstly i had load the value of +4000 in binary (111110100000) and then use the
following routine to make a subtraction:{T=(Th:Tl)-4000}
ldi oph,0b00001111
ldi opl,0b10100000
;Th,Tl any binary value say,
ldi Th,0b00010101
ldi Tl,0b11000000
sub16: sub Tl,opl ;Subtract low bytes
sbc Th,oph ;Add high byte with carry
ret
now the binary result stored in "T" must converted into ASCII to be displayed on LCD, any one can help me with this.
T=-4000+(Th:Tl)
Th,Tl:are 8bit registers,hence (Th:Tl) is 16bit
Ok,what i done to process this eqaution and make the result proper to display
on 2x16 LCD:
Firstly i had load the value of +4000 in binary (111110100000) and then use the
following routine to make a subtraction:{T=(Th:Tl)-4000}
ldi oph,0b00001111
ldi opl,0b10100000
;Th,Tl any binary value say,
ldi Th,0b00010101
ldi Tl,0b11000000
sub16: sub Tl,opl ;Subtract low bytes
sbc Th,oph ;Add high byte with carry
ret
now the binary result stored in "T" must converted into ASCII to be displayed on LCD, any one can help me with this.