Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/26/03 21:59
Read: times


 
#59490 - 80c320 math help ........
I have a piece of code that I am trying to modify to show one decimal place more in the final result and I am not sure how the math is being performed with the "RRC" statement .... below is the portion of code I am having trouble with, it was written for an 80C320 any help would be greatly appreciated.

Thanks,

Dave


;This section just takes the temp sensor value in TMCH and TMCL
;Converts it to the temp in 'C and stores the value in the
;8 bit register BTEMP Tref
;Formula 'C = (ADC Reading - 2607) /2
BOARD: mov TEMP2,TMCL
mov TEMP1,TMCH
mov a,TEMP2
subb a,#LOW(2607)
mov TEMP2,a
mov a,TEMP1
subb a,#HIGH(2607)
mov TEMP1,a
;Now Divide by 2.....
clr c
mov a,TEMP2
rrc a
mov TEMP2,a
mov a,TEMP1
rrc a
mov TEMP1,a

;We expect the value to be less then 8 bits.... So...
mov BTEMP,TEMP2
;Send back Temperature to the Analog System
mov TMCH,#00H
mov TMCL,TEMP2
ret

List of 3 messages in thread
TopicAuthorDate
80c320 math help ........            01/01/70 00:00      
   RE: 80c320 math help ........            01/01/70 00:00      
   RE: 80c320 math help ........            01/01/70 00:00      

Back to Subject List