I2c, srf02, 16f688 -> ultrasonic rangefinder


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: I2c, srf02, 16f688 -> ultrasonic rangefinder

    You want to write directly to ADCON1 so you have at least Fosc/8 for 4MHz.

    ADCIN doesn't do this for you - so your AD conversion clock is way too fast with ADCON1 = 0 by default.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default Re: I2c, srf02, 16f688 -> ultrasonic rangefinder

    Quote Originally Posted by Bruce View Post
    You want to write directly to ADCON1 so you have at least Fosc/8 for 4MHz.

    ADCIN doesn't do this for you - so your AD conversion clock is way too fast with ADCON1 = 0 by default.
    Thanks, Bruce.

    I've used ADC with other devices (12F683; 16F88; 16F1827) and always gotten by with the RC clock.

    Can I use DEFINE ADC_CLOCK 1? Or if I use ADCON1=%00010000, do I simply omit the DEFINE?
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: I2c, srf02, 16f688 -> ultrasonic rangefinder

    Hi Russ,

    DEFINE ADC_CLOCK xx only works if the clock select bits are in ADCON0, so just write directly to ADCON1 to set the conversion clock. ADCON1 = %00110000 for RC, ADCON1 = %00010000 for Fosc/8 (recommended).
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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