ADC in 12F683; puzzled


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Posts
    25


    Did you find this post helpful? Yes | No

    Thumbs up

    Quote Originally Posted by Acetronics View Post
    Missing :

    - Deactivate comparators
    Is this specific for 10 bit ADC, or should it be there for 8 bit conversion as well?
    And how? -CMON0 something?

    Quote Originally Posted by Acetronics View Post
    Missing :
    - ADC result right justified
    Alain
    Hm, the example programs that I have (for 16F877A) do not have such an instruction, does that PIC not need it?

    ADCON0.7 = 1 seems to have have cured the problem, thanks guys.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mikebike View Post
    Is this specific for 10 bit ADC, or should it be there for 8 bit conversion as well?
    And how? -CMON0 something?
    have a look to datasheet ... Comparator section !!!

    Hm, the example programs that I have (for 16F877A) do not have such an instruction, does that PIC not need it?
    some pins share the comparator and ADC functions ... you HAVE to verify which function is deactivated and which is to activate. ( one at a time ... )

    Depends on the chip used - and the ports used ...

    ADCON0.7 = 1 seems to have have cured the problem, thanks guys.
    Full config done = NO suprise ...

    sometimes, the pic defaults @ reset are the ones you want ... sometimes not. so you have to verify everything with the pic Datasheet !!!
    ************************************************** ***********************
    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
    Aug 2010
    Posts
    25


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    have a look to datasheet ... Comparator section !!!
    Done that, but didn't understand it (new to this stuff).

    Code:
    CMCON0 = %00000000
    seems to be accepted by PBP and the chip (still) works.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mikebike View Post
    Done that, but didn't understand it (new to this stuff).

    Code:
    CMCON0 = %00000000
    seems to be accepted by PBP and the chip (still) works.
    Boooooooooooooo .... the chip is really gentle with you ...

    look a bit closer at the drawings and the corresponding config @ $8 p 53 ...

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

  5. #5
    Join Date
    Aug 2010
    Posts
    25


    Did you find this post helpful? Yes | No

    Default

    I said that I don't understand this kind of data sheet...

    Well, I think it says that .....000 only turnes the comp output off, but ....111 turnes the comp off as well. It doesn't matter much for this project, but my first project is battery operated and saving some current is welcome.


    I guess it's nice to have a comparator integrated, but right now I would need an OP-amp instead!

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mikebike View Post
    I said that I don't understand this kind of data sheet...
    !
    I do promise you lots of fun ...

    Swedish hot nights ... I believed it was a bit different

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

  7. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Not sure if you're sorted, but as someone who recently struggled with this very type of same thing, here are the 12F683 commands towards helping you out ...

    If using 10 bit AtoD, then right justify is required**.....

    ADCON0.7 = 1 (right justifies your 12F683 AtoD result)

    .....whereas with 8 bit AtoD, left justify is required....

    ADCON0.7 = 0 (left justifies your 12F683 AtoD result)

    and finally this one....

    CMCON0 = 0 (turns the pesky 12f683 comparator off - of course if you need the PIC's comparator, then it's not pesky at all & this command should not be used!)

    Good luck!



    ** and no matter how many times I read the datasheet with respect to left/right justifying, I end feeling like an amoeba being wafted around the bottom of a refuse tip pond.
    Last edited by HankMcSpank; - 23rd September 2010 at 16:35.

  8. #8
    Join Date
    Aug 2010
    Posts
    25


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    sometimes, the pic defaults @ reset are the ones you want ... sometimes not. so you have to verify everything with the pic Datasheet !!!
    Yes, I have had some interesting output signals on outputs that were not specified in the program!

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