Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Atmel AVR math problem

Status
Not open for further replies.

eehero

Full Member level 3
Joined
Nov 23, 2005
Messages
169
Helped
13
Reputation
26
Reaction score
5
Trophy points
1,298
Location
Libya
Activity points
2,620
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.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top