Help with Pic controller

Thread Starter

quietfoot

Joined Dec 3, 2010
5
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.
 

Attachments

Thread Starter

quietfoot

Joined Dec 3, 2010
5
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
 

thatoneguy

Joined Feb 19, 2009
6,359
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.
 

jpanhalt

Joined Jan 18, 2008
8,099
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
 

Thread Starter

quietfoot

Joined Dec 3, 2010
5
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
 

thatoneguy

Joined Feb 19, 2009
6,359
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
 

jpanhalt

Joined Jan 18, 2008
8,099
@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
 

Thread Starter

quietfoot

Joined Dec 3, 2010
5
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
 

Thread Starter

quietfoot

Joined Dec 3, 2010
5
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
 
Top