I am confuse


Closed Thread
Results 1 to 20 of 20

Thread: I am confuse

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    33

    Red face I am confuse

    Hi, I am trying to use the 16f88 ability for read analog voltages. I need to use analog inputs RA0-RA3. My initial settings are as follows:

    ANSEL = %00001111 'set RA0-RA3 as analog inputs
    ADCON1 = %10000000 'Right Justifies 10-bit value
    OSCCON = $60 'Sets the internal oscillator to 4 Mhz
    DEFINE ADC_BITS 10 ' Sets the number of bits in the result to 10

    ti var byte
    ti = 50 '50 MILLISECONDS DELAY'
    A var word ‘ A,B,C and D as variables
    B var word
    C var word
    D var word

    TRISA = %00001111
    TRISB = 0 ‘Turn PORT B as outputs

    I am using RA5 as my communication out to the LCD. (Internal clock). I am using also the 8 pins Portb for controlling two steps motors. Problem here is that if I ground the input pins (just for testing) I should get zero voltages and I don’t. I am using a 1K resistor to ground. For sure I am missing something here. Please advice.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    With out seeing your code try setting the ADC for 8 bits and see what happens.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    Set comparators OFF ...
    ADCON0 = ?

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

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I think this chip has the comparators off on reset. I need to double check.

    Thinking more along the lines of not reading both the high and low bytes of the 10 bit setup might be the problem???
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Dave

    you're right ... I never trust in defaults ... ( overhead, yes ... but sleeping nights ...)

    what about this one :

    Code:
    TRISA = %00001111
    RA5/MCLR/VPP bit 5 ST Input, Master Clear (Reset) or programming voltage input.
    I am using RA5 as my communication out to the LCD
    ...

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

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Alan,

    That would make the display act funny
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Replies: 288
    Last Post: - 25th August 2008, 16:53

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