Help with Pic controller

Discussion in 'Embedded Systems and Microcontrollers' started by quietfoot, Dec 3, 2010.

  1. quietfoot

    Thread Starter New Member

    Dec 3, 2010
    5
    0
    Hi,

    Is there a way of taking two digital pulses onto two seperate pins of a pic microcontroller and programming the pic to calculate a ratio between these pulses?

    When the pic detects a particular ratio it needs to light an LED.

    I'm going to use the internal oscillator of the pic to measure the pulses against and loop the program continuously.

    The pulses will be taken from the tacho and speedo of a motorbike

    appreciate any advice

    quietfoot.
     
  2. quietfoot

    Thread Starter New Member

    Dec 3, 2010
    5
    0
    Thanks Alberto,

    Is there anywhere I could look to see a program that operated like this?

    How hard would it be to write (considering this is my first program!)

    regards
     
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    What programming languages do you know?

    Do you already have a PIC?

    You might want to start with something like BoostC to get the idea down, and simulate it. MikroC is another compiler, so is C18. MikroC and BoostC have the easiest integrated design/debug interface short of Oshonsoft's Basic for PICs, which is the "easiest" option which is quite visual.
     
  4. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,685
    900
    I am less clear on the question than some of the others seem to be. Are you talking about comparing the frequency of the two different pulse signals, the pulse width of two signals with the same frequency, pulse widths of two signals with different frequencies, or something else?

    Are the pulses in any way synchronized?

    John
     
  5. maxpower097

    Well-Known Member

    Feb 20, 2009
    795
    388
    nm mind playing with me.
     
  6. quietfoot

    Thread Starter New Member

    Dec 3, 2010
    5
    0
    jpanhalt/thatoneguy,

    jpanhalt - you were right first time I'm trying to compare the frequency of the two different pulse signals, I'll try to outline what i'm doing for more clarity.

    I want to know when my motorbike is in top gear so i'm going to mount an LED in the speedo on the bike that will indicate this. A pulse comes from the tachometer and a pulse comes from the speedometer. The frequency of these pulses will have a linear ratio with each other so i'm trying to find out how to program a pic that could recognise this ratio and turn the LED on - Simple (i wish!)

    thatoneguy - as i have almost zero programming experience i would like to know hat you think would be the easiest way to approach this, i haven't bought a pic yet but i'll buy whatever is required - any recommendations?

    Thanks for your interest
     
  7. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,685
    900
  8. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    How much experience do you have with electronics, such as schematics, soldering, etching PCBoards, etc?

    The analog solution may be best, as counting two frequencies and setting an output when in the right gear might be a bit of trial and error. Also, false positives when the clutch is engaged, etc.

    I never really pay attention to what gear I am in, I only notice when I run out of em. :D
     
  9. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,685
    900
    @quietfoot
    If you really want to pursue the MCU, can you give an idea of the actual frequencies you see from the speedometer and tachometer? There may be simpler ways to approach it.

    John
     
  10. quietfoot

    Thread Starter New Member

    Dec 3, 2010
    5
    0
    Thanks for all your help guys,

    I'll look into the analogue solution first as it seems the simplest -
    (considering the whole project has to be completed and installed by march!)

    I'll keep working at learning how to use Pics and start with something simple like Alberto recommended, if i feel confident enough by january to apply my pic knowledge to this project i'll try both.

    Best Regards

    Nathan
     
  11. quietfoot

    Thread Starter New Member

    Dec 3, 2010
    5
    0
    Jpanhalt,

    I'm taking some readings off the bike soon with an oscilloscope so i've got some exact readings to work with. I'll post these readings when i have them, if you could have a look i'd appreciate your opinion.

    Thanks

    Nathan
     
Loading...