interrupt on range finder


Closed Thread
Results 1 to 2 of 2
  1. #1

    Default interrupt on range finder

    Hello,

    I made a platform that looks similar to boe bot. I am using a 16F877A MCU for it, lots of I/O. I have two sharp range finders that are on my A0 & A1 ADC ports. Currently I have range detection, speed control (using 2-HWPWM) and steering all in main. There has to be a better more efficient way of doing this in an interrupt? The goal of this is to avoid obstacles when the range finders get to a threshold distance.

    Thanks!

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: interrupt on range finder

    Hi,
    Here's one suggestion:
    Use the CCP module to generate a PWM signal, integrate that signal with a simple low pass filter to get a voltage corresponding to the distance at which you want your rangefinder to "trip". Feed that voltage back into the PIC to one (or both) of the comparator(s). Connect the analog output of the rangefinder(s) to the other input of the comparator(s). Set up the comparator(s) to generate an interrupt when the output toggles.

    EDIT: I see that you're using the CCP modules for drivning the motors. Either use a fixed reference voltage or perhaps use the reference voltage module or set up a shiftregister and a R2R ladder or....

    /Henrik.

Members who have read this thread : 1

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