Assembly help!!!

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

  1. sanwa

    Thread Starter Active Member

    Jan 18, 2009
    36
    0
    Guys, I really really need your help to get me out of my problems which I'd been suffered for months. Please if possible, spend a lil' of your time, it may helps a people like me who's almost exhausted.

    I am gonna implement a code using the algorithm below:

    Code ( (Unknown Language)):
    1.  
    2. [I]1.Multiply 16 bits binary number of AmpHour and Volts
    3. 2.Convert to human readable characters on hyper terminal
    4. 3.Transmit this value serially via software UART .[/I]
    5.  
    To be honest, I am referring to this project from bhabott and permitted by the author.
    The complete code is here

    I need to add the algorithm above to this existing code. Until now, I'd tried this:
    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 mov16 and inc16 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.     movwf   dst+1
    9.     ENDM
    10. inc16   MACRO   dst
    11.     incf    dst+1
    12.     skpnz
    13.     incf    dst
    14.     ENDM
    15.  
    16.  
    Please, I really need your help. This is a forum. Thanks.....
     
Loading...