Connect with us

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

Discussion in 'Hobby Electronics' started by [email protected], Feb 8, 2006.

Scroll to continue with content
  1. Guest

    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
    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

    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

    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.

    Any help would be appreciated, as I am quit new to this.
  2. 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 :)
  3. Guest

    I would prefer Basic
  4. Franc Zabkar

    Franc Zabkar Guest

    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
  5. Poxy

    Poxy Guest

    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.
  6. 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 :)
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day