16F876A Pulsin issues


Results 1 to 16 of 16

Threaded View

  1. #14
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Bobbo_ZA View Post
    just not getting the decimal places now, :-(

    Latest attempt
    Code:
    ADCIN 4, volt                  ' Read AN4 into temp variable
    volt = volt * 2
    Vin = (5*volt/1023)
    Vind = (volt // 1000) / 10 'millivolts?
    
    lcdout $FE, $C0+8, dec Vin,".",dec2 Vind,"V"
    Time to pack it in for the night, work tomorrow, fairly good progress, just the decimal points to figure out.

    Kind Regards
    Rob
    Ok Rob,

    What about :

    Code:
    ADCIN 4, volt                  ' Read AN4 into temp variable
    
    volt = volt * 2 * 5
    
    Volt = 100*volt               ' See manual for DIV32 !!!
    Vind = DIV32 1024           ' Here we have result in 1/100 Volts ...
    
    Vin = Vind/100                  ' Here we get the integer part ...
    Vind = Vind // 100             ' Here we get the decimal part ...
    
    lcdout $FE, $C0+8, dec Vin,".",dec2 Vind,"V"
    that's all !
    Last edited by Acetronics2; - 31st March 2010 at 10:37.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts