Multiply and ASCii conversion

Thread Starter

allcircuit

Joined Jan 7, 2009
31
OK, now i am planning to multiply two variables, AmpHour and Volts, then i call print_Char to have human readable character and transmit serially to my RF module (view in Hyper Terminal). I'd written a very simple code for it, so i might need your guidance and see is it correct. Thanks.

Rich (BB code):
;16 bit register 'a'
   WORD        aa
;16 bit register 'b'
   WORD        bb
   WORD        energy
multiply:
mov16       AmpHour,aa
mov16       Volts,bb
call mult16                        ;multiply AmpHour with Volts
skpc                               ; remainder > 0.5 ?
goto        store_energy           ;store as energy
inc16       dd+2                   ;yes, round up
call print_Char
store_energy:
mov16       dd+2,energy
Where the mov16 is declared as:
Rich (BB code):
;====================================================================
;               16 bit macros (Big-Endian)
;
mov16	MACRO	src,dst
	movf	src,w
	movwf	dst
	movf	src+1,w

	movwf	dst+1
	ENDM

====================================================================
 
Top