Multiply and ASCii conversion

Discussion in 'Embedded Systems and Microcontrollers' started by allcircuit, Mar 27, 2009.

  1. allcircuit

    Thread Starter Active Member

    Jan 7, 2009
    31
    0
    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.

    Code ( (Unknown Language)):
    1. ;16 bit register 'a'
    2.    WORD        aa
    3. ;16 bit register 'b'
    4.    WORD        bb
    5.    WORD        energy
    6. multiply:
    7. mov16       AmpHour,aa
    8. mov16       Volts,bb
    9. call mult16                        ;multiply AmpHour with Volts
    10. skpc                               ; remainder > 0.5 ?
    11. goto        store_energy           ;store as energy
    12. inc16       dd+2                   ;yes, round up
    13. call print_Char
    14. store_energy:
    15. mov16       dd+2,energy
    Where the mov16 is declared as:
    Code ( (Unknown Language)):
    1. ;====================================================================
    2. ;               16 bit macros (Big-Endian)
    3. ;
    4. mov16   MACRO   src,dst
    5.     movf    src,w
    6.     movwf   dst
    7.     movf    src+1,w
    8.  
    9.     movwf   dst+1
    10.     ENDM
    11.  
    12. ====================================================================
    13.  
     
Loading...