7 specific voltages to display 1,n,2,3,4,5,6 in 7 Segment Display

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


This is kind of a repost, someone was extemely helpful in getting me
code but it was for 6800 assembler.......

Here is what I got.

My motorcycle has an output voltage on the gear position sensor as
follows;
1st gear = 1.782v
2nd gear = 2.242v
3rd gear = 2.960v
4th gear = 3.630v
5th gear = 4.310v
6th gear = 4.660v
Neutral = 5.000v

I am awaiting a PIC16F873A and programming board, that should arrive
soon.

What would the code be in order to take the voltage on an analog input
and convert it to the pinouts on the output side to display my various
numbers on a 7 segment LED display. I currently program in VBA so
understand the logic, jsut not sure about the specific syntaxes and
such.

Just like the link below, however I am only going to use a 7-segment
for simplicity. Maybe later I will try a 15 segment. I also will have
no reverse input and no button to reprogram as I am going to make the
code accept a reange of voltage for a given gear.

http://www.sportdevices.com/gearindi...schematics.htm

Any help would be appreciated, as I am quit new to this.


Re: 7 specific voltages to display 1,n,2,3,4,5,6 in 7 Segment Display


Quoted text here. Click to load it

The PICAXE would have been much easier from a programming point of
view. You really are making it hard for yourself the first time out...

What language do you want to use for your PIC? - assembler?, BASIC?, C?
I don't know what's available for free in PIC BASIC compilers these
days, but BASIC or C is MUCH easier than PIC assembler.

Your program will (obviously) be something like this in psuedo code:
Initialise ADC
Initialise I/O ports
Initialise other stuff required
Start loop
Read ADC
if (ADC<=2V) light required segments
if (ADC>2V AND ADC<2.5V) light required segments
etc for all levels required
End Loop

Like I said in another post, make sure your 5V input does not play up
with a 5V supply. A divider on the input is a nicer idea maybe. Or
power the PIC from 6V.

Dave :)


Re: 7 specific voltages to display 1,n,2,3,4,5,6 in 7 Segment Display


I would prefer Basic


Re: 7 specific voltages to display 1,n,2,3,4,5,6 in 7 Segment Display


Quoted text here. Click to load it

Then you should strongly re-consider a PICAXE. There are basic compilers for
PICs, but the decent ones cost money and still present the considerable
challenges of programming a microcontroller - I'm sure you could work it all
out eventually, but the learning curve is steep.

You're not going to be able to program is sucessfully by asking a series of
questions on discussion forums - you need to get a decent book or read and
study the many guides and tutorials available online.






Re: 7 specific voltages to display 1,n,2,3,4,5,6 in 7 Segment Display


Quoted text here. Click to load it

Nicely put.
I completely agree.
PICAXE is by far the best solution in the case of the OP. Anything else
will lead to frustration.

Dave :)


Re: 7 specific voltages to display 1,n,2,3,4,5,6 in 7 Segment Display


On 8 Feb 2006 00:31:18 -0800, snipped-for-privacy@persona.ca put finger to
keyboard and composed:

Quoted text here. Click to load it

I'd follow Dave's advice and implement a calibration routine to
account for variations in your 5V (or 6V?) regulator and/or your
signal source.

I don't know how the kit does it, but this would be my suggestion:

Press the button (S1) for three secs.
The LED should flash "C" to indicate calibration mode.
Press S1.
Display flashes "1".
Select 1st gear and press S1.
PIC acquires the sensor voltage.
The display should now show a steady "1".
Press S1.
Display flashes "2".
Select 2nd gear and press S1.
PIC acquires the sensor voltage.
The display should now show a steady "2".
Repeat for remaining gears and neutral ("0" ?)
Indicate any errors with a flashing "E".

You could also have the PIC report the actual voltage by displaying
each of three digits at 1 sec intervals. This would serve as
confirmation that you've selected the correct gear.

- Franc Zabkar
--
Please remove one 'i' from my address when replying by email.

Site Timeline