Help measuring distance....


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Jul 2007
    Posts
    53


    Did you find this post helpful? Yes | No

    Default May I suggest using PICXX31

    Hi,


    I think you should consider using PIC2331/2431/4331 or 4431.
    Those PICS have a built-in motion feedback module. I think the "velocity feedback module" will do exactly what you want. Look at the datasheet for more details.

    BTW: Downside is that the ADC module is a bit of pain in the ... to use. Since it's not completely integrated with PBP.

    J-P

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default What happened to old days?

    WhyNot use a traditional way;


    Code:
    ' 9 Pulses come in in 0ne meter.
    ' Measure the time it takes for 9 pulses to come in.
    ' Timer0 is in Counter Mode.
    ' Timer1 is in Timer Mode.
    
    ' Set your prescaler and other TMR settings etc... here.
    
    Start:
    
        TMR1ON = 0      ' Stop TMR1.
        TMR1H = 0       ' Clear TMR1.
        TMR1L = 0              '....
        Speed = 0       ' Speed is a Word variable.
        TMR0 = 0        ' Clear TRM0.    
    
        WHILE TMR0 = 0 : WEND       ' Wait for an incoming Pulse (First pulse does not count).
        TMR1ON = 1                  ' Start Timer1 Module.
        WHILE TMR0 < 9 : WEND       ' Count 9 pulses.
        TMR1ON = 0                  ' Stop Timer1 at 9th Pulse.
    
        Speed.LowByte = TMR1L
        Speed.HighByte = TMR1H
        
        ' The car took 1Meter in "Speed" mS.    Example: 1 Meter in 100mS.
        Speed = 60000 / Speed                   ' Speed = 60,000mS / 100Ms => 600 Meter in One Minute.
        Speed = Speed * 60                      ' Speed = Speed * 60Mins   => 600Meter * 60Mins = 36,000Meter. => 36Km/Hr
         
        LCDOUT $FE,1,"Speed:", dec5 Speed,"Km/Hr"
        
        
    Goto Start
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default What happend to the orignal question?

    Is it just me or didn't he say he want to measure distance? IE distance, not speed. Yep, I'm sure, he said distance...

    I may have misunderstood though....

    ;-)

    /Henrik Olsson.
    Last edited by HenrikOlsson; - 30th July 2007 at 12:55.

Similar Threads

  1. Questions on ultrasonic distance finder
    By lilimike in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 20th April 2010, 21:19
  2. Ultrasonic distance sensor with PIC16F84A
    By MrRoboto in forum mel PIC BASIC
    Replies: 3
    Last Post: - 29th June 2009, 09:01
  3. Long distance Communicating between PICs
    By koossa in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th January 2008, 06:47
  4. Distance Measurement Chips
    By sayzer in forum Off Topic
    Replies: 6
    Last Post: - 2nd February 2007, 20:57
  5. GPS waypoint distance in Km
    By Art in forum Code Examples
    Replies: 1
    Last Post: - 28th August 2005, 01:59

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