+ Reply to Thread
Results 1 to 7 of 7

Thread: adc issue

  1. #1
    Licensed User rverm's Avatar
    Join Date
    Dec 2008
    Location
    ciccinati ohio
    Posts
    214

    Default adc issue

    The newest version has a adc issue. It displays data in 16 bit but the adc is only 10 bit. I dont why its doing this problem. I have tried declaring it ,like in the examples in the manual but it still comes up as 16 value. up in a 16 bit value. I have emailed the proteaus people about this issue but there in denial about it. A 16 bit value is good just wished the chip had one. Im using a 18f2420 in my simulation. Let me if anyone else has this problem.

    Hi, its great to see you visiting our forum. Why not try Proton Compiler for FREE?

    Download the FREE version of Proton Compiler, Its called Amicus18 and its available from HERE

    Already using proton Compiler??? Get rid of these pesky messages... get LICENSED USER STATUS




  2. If you're a Licensed user of PROTON DEVELOPMENT SUITE, apply for Licensed User Status to remove these pesky messages
     and get access to additional forum areas, Beta test downloads and more!

  3. #2
    Super Moderator wastrix's Avatar
    Join Date
    May 2008
    Location
    Sydney, Australia
    Posts
    2,555


    Default Re: adc issue

    Please post code, but I'm sure this is not an issue, rather if you look at the number in binary you will see that it is a 10-bit number that is left-justified. You will need to consult the datasheet to right-justify the result and get a 10 bit value, or, shift the value right 6 places.

    Has the same code worked in older versions of Proteus and/or real life?
    "If you have an important point to make, don't try to be subtle or clever. Use a pile driver."
    - Winston Churchill
    If you want to contact me, please email me, don't PM me.

  4. #3
    Licensed User rverm's Avatar
    Join Date
    Dec 2008
    Location
    ciccinati ohio
    Posts
    214


    Default Re: adc issue

    No it goes from 0 to 65500 on the lcd display. I will post code later.

  5. #4
    Licensed User glenlivet's Avatar
    Join Date
    Nov 2004
    Location
    Cedar Lake, Indiana USA
    Posts
    39


    Default Re: adc issue

    Sounds to me that you should DECLARE your ADC variable as a WORD which is 16-bits wide.
    Even though your ADC is only 10 bits you have to DECLARE it as a WORD. When you do a conversion the upper 6 most significant bits will be zero's by default. Hope this helps

  6. #5
    Licensed User rverm's Avatar
    Join Date
    Dec 2008
    Location
    ciccinati ohio
    Posts
    214


    Default Re: adc issue

    Ill put the program in a chipand see if it is proton or isis .

  7. #6
    Super Moderator wastrix's Avatar
    Join Date
    May 2008
    Location
    Sydney, Australia
    Posts
    2,555


    Default Re: adc issue

    Quote Originally Posted by glenlivet View Post
    When you do a conversion the upper 6 most significant bits will be zero's by default.
    Not if the ADC result format is left-justified, in which case the 6 least significant bits would be 0; you will get a 16 bit number with 10 bit accuracy.

    The following code works perfectly in ISIS:
    Code:
    Device = 18F2420
    
    Dim result As Word
    
    ADCON2.7 = 1
    
    result = ADIn 1
    
    Cls
    
    Print Dec result, $FE, $C0, Bin16 result
    The following code gives problems like you describe:
    Code:
    Device = 18F2420
    
    Dim result As Word
    
    result = ADIn 1
    
    Cls
    
    Print Dec result, $FE, $C0, Bin16 result

    Are you sure you have right justified the data?
    "If you have an important point to make, don't try to be subtle or clever. Use a pile driver."
    - Winston Churchill
    If you want to contact me, please email me, don't PM me.

  8. #7
    Licensed User rverm's Avatar
    Join Date
    Dec 2008
    Location
    ciccinati ohio
    Posts
    214


    Default Re: adc issue

    That nailed right on head. I guess i better go back and look over all the registers again. I used set them up that way.
    Thanks again.

+ Reply to Thread

Similar Threads

  1. Pds usb key issue (win 7)
    By Derick.Stevens in forum USB License key
    Replies: 1
    Last Post: 17th February 2010, 11:35

Members who have read this thread since 2nd May 2012, 22:08 : 0

Actions :  (Set Date)  (Clear Date)

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