A to D on the PIC16F687


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    All that I am doing with the pot is dmeonstrating that can read an input voltage on a pin. I have a project where I will have to be reading a voltage that will be coming from another input and I just wanted to verify this with a pot. Do you have any suggestions how to convert 1635 to 1.635 ? I can just shift it because if I had 735 that would be equal to 0.735 and wouldn't want to look at it as 7.35.
    Thanks
    Josh

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


    Did you find this post helpful? Yes | No

    Wink Rtfm

    You could also open the manual ...

    Section 4.17.2 ( page 33 ) ...

    as a miracle, the example is just that you should use ...

    ON your LCD , just place the comma between W1 and W2 of the example !!! Should I say W0 is supposed to be the result of the DIV32 operation ???

    Alain
    Last edited by Acetronics2; - 4th July 2006 at 08:54.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  3. #3
    Join Date
    May 2006
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    This somewhat works but I need to work through a way that it will display the value, 2.004 instead of 2.4 because the way I did it is with W0 = 5*AD_Value (AD_Value could be 0 to 1023). Then I did:
    AD_VALUE_HIGH = W0 / 1023
    AD_VALUE_LOW = W0 / 1023

    THEN LCDOUT, $FE, $C0, #AD_VALUE_HIGH, ".",#AD_VALUE_LOW, "VDC"

    I am not sure what you meant by using the DIV32 command. Can you please explain more? Thanks.

    Josh
    Last edited by jblackann; - 5th July 2006 at 14:48.

  4. #4
    Join Date
    Jun 2005
    Location
    Mumbai,India
    Posts
    43


    Did you find this post helpful? Yes | No

    Wink DIV32 Is this place on moon or timbaktoo?

    Hey ! all the time I thought I was most dumbo person for Basic espeacilly for
    pretty type.
    Now Im relieved that there is atleast one more and may be many thousands!
    I hope Josh takes some troubles with searching on forum.
    I don't have experience with PIC or other Basic but in assembly there is
    DIV32 routine - sort of macro - for dividing 32bit version.
    wish U best!

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jblackann

    I am not sure what you meant by using the DIV32 command. Can you please explain more? Thanks.

    Josh
    That's a simple function of PbP :

    PBp does internally the 16x16 multiplication ...

    then the result is internally stored into 2 separate WORDS ...but you can't ( normally !!! ) access them nor make another thing without tearing them !!!

    A function was implemented, DIV32, that can divide those 2x16 bits by another 16 bits max value

    so, first, you do the mult.:
    WWRes = W1*W2
    and the very next line MUST be
    Wres = DIV32 W3

    This realizes the Word1*Word2/Word3 operation, despite PbP do not work with more than 16 bits !!!

    Just need to use for WWRes an already declared WORD.

    For details see $ 4.17.8 page 35 ...

    Alain
    ************************************************** ***********************
    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 " !!!
    *****************************************

Similar Threads

  1. LCD with PIC16F687
    By jblackann in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th June 2006, 23:16
  2. PIC16F687 - supported?
    By badcock in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th August 2005, 10:33

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