timer/clock issues 16f84a

Discussion in 'Programmer's Corner' started by programmer1, Mar 15, 2009.

  1. programmer1

    Thread Starter New Member

    Mar 15, 2009
    hi there,
    im currently working on a system to work out the lenght of a vehicle using two sensors.
    im using the pic 16f84a microcontroller and have the sensors communicating with the pic.
    im using the picbasic pro compiler to program with.
    i need to start a clock at 0 and take readings when each sensor is made and unmade. with these values i can i can work out the lenght given a defined distance between sensors.
    i cant find anything on just a simple timer online hence im posting here.
    i am aware that the pic 16f84a is slightly outdated but its all i have to work with at the mo.

    any help on this matter would be greatly appreciated.
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    How will you distinguish between a 3 meter vehicle passing the sensors at 50 km/h, and a 6 meter vehicle passing at 100 km/h?
  3. programmer1

    Thread Starter New Member

    Mar 15, 2009
    by using the time/distance/speed formula. given that i have the distance between sensors with the code for the clock i have the time so i can get the speed. once i have the speed i can go back to the lenght of time it took to go through either sensor 1 or 2 (or both and get an average) and using the same formula the distance in this case will be the lenght. all these calculations will be done on the pic as they are fairly basic.

    it will only be a model for the time being. so as long as the sensors are apart further than the longest vehicle it should work.
    hope that clears things up for you.
    any other question please ask.