# 7 specific volatges to to 1,n,2,3,4,5,6 numbers in Alpha-numeric Display

B

#### [email protected]

Jan 1, 1970
0
What I am attempting is to take 7 specific voltages, and display
certain numbers for these specific voltages on an alpha-numeric
display.

What I currently have is a resistor ladder that breaks up the voltage.
The resistors form a ladder that breaks up the 5v from a voltage
regulator into reference signals to determine at what voltages an
LM339N will use to ground each corresponding LED. It use 1% resistors
to make sure I get exact reference voltages because in the higher gears

the signal is very close and there is not much gap between voltages.
The output voltages from the sensor are 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
The comparators in this circuit will turn on each LED as follows:
1st LED = Anything over 1.022v
2nd LED = Anything over 2.043v
3rd LED = Anything over 2.660v
4th LED = Anything over 3.356v
5th LED = Anything over 4.052v
6th LED = Anything over 4.526v

I now want to take thes voltages and convert them to show the proper
gear on an alpha-numeric display.

How can I turn what I have working in to alpha numeric?

Or, Do I have to start a whole new circuit. Something that takes the
voltage and turns it into a digital signal and then sends to an A/N LED

display.

J

#### John Popelish

Jan 1, 1970
0
What I am attempting is to take 7 specific voltages, and display
certain numbers for these specific voltages on an alpha-numeric
display.

What I currently have is a resistor ladder that breaks up the voltage.
The resistors form a ladder that breaks up the 5v from a voltage
regulator into reference signals to determine at what voltages an
LM339N will use to ground each corresponding LED. It use 1% resistors
to make sure I get exact reference voltages because in the higher gears

the signal is very close and there is not much gap between voltages.
The output voltages from the sensor are 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
The comparators in this circuit will turn on each LED as follows:
1st LED = Anything over 1.022v
2nd LED = Anything over 2.043v
3rd LED = Anything over 2.660v
4th LED = Anything over 3.356v
5th LED = Anything over 4.052v
6th LED = Anything over 4.526v

I now want to take thes voltages and convert them to show the proper
gear on an alpha-numeric display.

How can I turn what I have working in to alpha numeric?

Or, Do I have to start a whole new circuit. Something that takes the
voltage and turns it into a digital signal and then sends to an A/N LED

display.

A small microprocessor like a PIC 16F684:
would make this so much simpler, including programmable levels and
easy digital filtering of the noise on the signal, and possibly a
shift in the levels depending on acceleration. The patterns for the
various digits would be stored in a look up table, and the digital
outputs could drive a 7 segment display, directly.

The main advantage would be that it allows you to experiment with new
variations you think up, after a little use, without going back and
rebuilding the circuit.

B

#### [email protected]

Jan 1, 1970
0
Is there any way I can use the outputs I already have.

In order to use the PIC16F84, I would have to "program" it?

I would actually like to bulild it in multisim first that way I don't
waste money on parts.

Kind of new to this stuff, but am having lots of fun, and pulling out
my hair at the same time.

Maybe if someone could post a schematic?

C

#### Chris

Jan 1, 1970
0
Is there any way I can use the outputs I already have.

In order to use the PIC16F84, I would have to "program" it?

I would actually like to bulild it in multisim first that way I don't
waste money on parts.

Kind of new to this stuff, but am having lots of fun, and pulling out
my hair at the same time.

Maybe if someone could post a schematic?

This is exactly why it's such a good idea to learn microcontrollers, as
Mr. Popelish suggested. You could do this all with one 18-pin PIC,
even driving your LEDs with only seven current-limiting resistors.

OK. If you want to do this the '70s way, make sure your comparator
outputs are active-high (logic 1 when active). Then feed these into an
8-to-3 priority encoder (I'm assuming you're using an automotive 12V
supply, so look at the CD4532). The priority part ensures that, if
you've got multiple comparator inputs, the highest one is the one that
is converted into 3-bit binary. That's pretty much the same as your
table in the first post -- except that neutral will show as 6th gear --
you should make that a 7th LED.

You go from there to a BCD-to-Decimal Decoder (CD4028), and then use
those 7 outputs to drive a ULN2004, which drives the LEDs with current
limiting resistors.

Is this what you're looking for?

Good luck
Chris

B

#### [email protected]

Jan 1, 1970
0
Sounds like the 70's way is the way for me.

"make sure your comparator outputs are active-high (logic 1 when
active)"
What do you mean by that?
At present my comparators are simply completing the circuit throught
the resistor ladder. Don't know where the "logic state" is at in this.

What I want is to take out the six LED's(can add another for neutral
also) I currently have and replace with Segment LED.
If you have a second let me know the components I need in conjuction
with what I have to make this work.

C

#### Chris

Jan 1, 1970
0
Sounds like the 70's way is the way for me.

"make sure your comparator outputs are active-high (logic 1 when
active)"
What do you mean by that?
At present my comparators are simply completing the circuit throught
the resistor ladder. Don't know where the "logic state" is at in this.

What I want is to take out the six LED's(can add another for neutral
also) I currently have and replace with Segment LED.
If you have a second let me know the components I need in conjuction
with what I have to make this work.

Aaah, wonderful Google. This will probably post before the followup I
posted. I misread your original post. In order to use a seven segment
display, you should have the outputs of the CD4532 priority encoder
feeding the inputs of a CD4511 7-segment latch and driver. This will
be able to drive the LEDs directly (remember to use current-limiting
resistors -- try 1K to start).

Also, comparators like your LM339 have open collector outputs, which
will sink current when turned on. They're usually gioven output pullup
resistors to Vcc (again, if you're using an automotive 12V, try 22K
pullups). You didn't specify whether the comparator outputs are set up
to go high or low when the proper voltage is achieved. In order for
the 4532 to operate properly, a logic "1" has to be asserted at the
appropriate input. This is the reverse of TTL-type encoders.

By the way, if you reverse the sense of your "Neutral" comparator
output, you can use it to blank the display, which might be useful.

Darn. All this from trying to multitask the Superbowl, s.e.b. and the
War Department at the same time. A fatal combination. ;-)

If you need help, feel free to post again.

Chris

C

#### Chris

Jan 1, 1970
0
Chris said:
This is exactly why it's such a good idea to learn microcontrollers, as
Mr. Popelish suggested. You could do this all with one 18-pin PIC,
even driving your LEDs with only seven current-limiting resistors.

OK. If you want to do this the '70s way, make sure your comparator
outputs are active-high (logic 1 when active). Then feed these into an
8-to-3 priority encoder (I'm assuming you're using an automotive 12V
supply, so look at the CD4532). The priority part ensures that, if
you've got multiple comparator inputs, the highest one is the one that
is converted into 3-bit binary. That's pretty much the same as your
table in the first post -- except that neutral will show as 6th gear --
you should make that a 7th LED.

You go from there to a BCD-to-Decimal Decoder (CD4028), and then use
those 7 outputs to drive a ULN2004, which drives the LEDs with current
limiting resistors.

Is this what you're looking for?

Good luck
Chris

Super Bowl, and the War Department).

The output of the CD4532 priority encoder should go to an CD4511
BCD-to-7-segment display decoder. That will give you your 7-segment
display, without the CD4028 or the ULN2004.

If you make the output from your Neutral comparator active-low, you can
use it to blank out the display. Also, you should disable the latch
function.

Again, feel free to post back if this isn't clear, or you need more
help.

Chris

B

#### [email protected]

Jan 1, 1970
0
I am mocking this up in multisim, and found when I activate everything,
my lines from 4532 are al reading "Low" which I am assuming is
backwards.

I am very new to this, but like to think that I am a quick learner.
Not to sure what to do to the comparators to make them read high.

Thanks for the help so far.

B

#### Byron A Jeff

Jan 1, 1970
0
Is there any way I can use the outputs I already have.

Yes. But is essentially becomes programming in hardware.
In order to use the PIC16F84, I would have to "program" it?
Yes.

I would actually like to bulild it in multisim first that way I don't
waste money on parts.

Microchip will send you samples. So you won't have a spend money.

BAJ

B

#### [email protected]

Jan 1, 1970
0
Only problem is that they don't supply samples of PIC16f84, they do
some others, but not that one or at least that I can find.

C

#### Chris

Jan 1, 1970
0
I am mocking this up in multisim, and found when I activate everything,
my lines from 4532 are al reading "Low" which I am assuming is
backwards.

I am very new to this, but like to think that I am a quick learner.
Not to sure what to do to the comparators to make them read high.

Thanks for the help so far.

Hi. Let's take things one at a time.

A comparator is a logioc device that compares the two voltages at its
+) is greater than the voltage at the inverting input (labelled -), the
output of the comparator is a logic "1". If the voltage at - is
greater than that at +, the output will be a logic "0".

What makes this a little more analog is that the output of your
comparator (usually depicted like an op amp) is an open collector
transistor. It can either be on (logic 0) or off (logic 1). Some
comparators have separate pins for the output transistor emitter
(allowing you to choose the voltage of a logic "0". Others have
standard logic outputs, and can source or sink current. But your LM339
output transistor emitters are tied to the GND pin, so the logic "0"

I suggested above that you wanted the comparator output to be a logic
"1" when the voltage went above the reference. That means putting the
reference voltage at the inverting (-) input and your signal voltage at
the non-inverting (+) input. I also mentioned that you would want your
Neutral signal to be active low. That would mean you want your
reference voltage to be at the non-inverting input (+) and your signal
to be at the inverting (-) input.

You might also want to have a signal for when the gearshift is in
neutral -- as originally described, your system will say "6" when it
should either be saying "N", "0", or blank. I think blank is your best
bet, but you'll need a signal, so add another resistor to your divider,
and another comparator. It will look something like this (and I hope
you're using something better than a 7805 for your reference voltage!):
___
~4.83V |\
..--|___|->+12V
____ .-------------------------. o-|-\ | 22K
+12V | | ___ | ___ 4.526v | | | >-o----------o
N
o--o-|7805|-o-|___|-o-|___|-o----------------.'-)-|+/
+| |____|+| | | | |/
--- | --- .-. | |
--- | --- | | | | ___
| === | | | | | |\
..--|___|->+12V
=== GND === '-' '--)-|-\ | 22K
GND GND |4.052v | | >-o--------o
6th
o--------------. o-|+/
| | | |/
.-. | |
| | | | ___
| | | | |\|
..--|___|->+12V
'-' '----)-|-\ | 22K
|3.356v | | >-o--------o
5th
o------------. o-|+/
| | | |/
.-. | |
| | | | ___
| | | | |\
..--|___|->+12V
'-' '------)-|-\ |' 22K
|2.660v | | >-o--------o
4th
o----------. o-|+/
| | | |/
.-. | |
| | | | ___
| | | | |\
..--|___|->+12V
'-' '--------)-|-\ | 22K
|2.043v | | >-o--------o
3rd
o--------. o-|+/
| | | |/
.-. | |
| | | | ___
| | | | |\
..--|___|->+12V
'-' '----------)-|-\ | 22K
|1.022v | | >-o--------o
2nd
o------. o-|+/
| | | |/
.-. | |
| | | | ___
| | | | |\
..--|___|->+12V
'-' '------------)-|-\ | 22K
| | | >-o--------o
1st
=== '-|+/
GND |/

(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)

Now let's look at the digital logic you'll need to turn those seven
logic signals into a seven segment display, 70s-style. As mentioned
above, we're going to use two 4000-series CMOS ICs, mostly because they
can be powered by the car battery. Be sure you include some kind of
reverse voltage and surge protection -- momentary battery voltages can
exceed 40V under some circumstances.

Here's the CMOS logic part:

|
| N o ------.
| | common
| VCC VCC | VCCVCC cathode
| + + | + + 7-seg.
| 5| |16 4| 3| |16 display
| .--o---o----. .---o---o--o----. .--------.
| 4 | EI Vcc | | Blank LT | 1K X 7 | |
| GND<---o7 | 6| |13 ___ | --- |
| 3 | |GND<-o8 ao---|___|--oa | | |
| 6th o---o6 | | |12 ___ | | | |
| 2 | | 6 2| bo---|___|--ob | | |
| 5th o---o5 Q4o-----o4 |11 ___ | | | |
| 1 | | | co---|___|--oc --- |
| 4th o---o4 4532 | 7 1| 4511 |10 ___ | | | |
| 13| Q2o-----o2 do---|___|--od | | |
| 3rd o---o3 | | |9 ___ | | | |
| 12| | 9 7| eo---|___|--oe | | |
| 2nd o---o2 Q1o-----o1 |15 ___ | --- |
| 11| | | fo---|___|--of |
| 1st o---o1 | | |14 ___ | |
| 10| | | go---|___|--og |
| o0 | | | | |
| | GND | | Store | | |
| '-----o-----' '----o------o---' '----o---'
| 8| 5| |8 |
| === === === ===
| GND GND GND GND
|
|
(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)

Hope this works well for you -- no guarantees. Note that, in
simulation or for real, you have to tie the chip inputs you're not
using to appropriate logic levels, or the chip doesn't do what you
want. The data sheets are the best way to learn about the chip. Read
them every time. And if, as is likely the case, I've forgotten
something or gotten something bass-ackwards and it doesn't work,
muscle it out.

If you need more background on CMOS digital logic, look up Don
Lancaster's CMOS Cookbook -- it's the best intro to the subject. You
can get it at libraries, or purchase it from amazon.com or Mr.
Lancaster's website:

http://www.tinaja.com/

And again, remember that this whole thing could have been done with one
18-pin PIC and a bit of programming. Once you've gotten familiar with
it, and you have the right tools, you can knock off something like this
in an hour or so.

Good luck
Chris

C

Jan 1, 1970
0
Let's try that comparator setup again (view in fixed font or M$Notepad): ___ ~4.83V |\ .-|___|->+12V ____ .---------------------. o-|-\ | 22K +12V | | ___ | ___ 4.526v | | | >-o---------o N o--o-|7805|-o-|___|-o-|___|-o------------.'-)-|+/ +| |____|+| | | | |/ --- | --- .-. | | --- | --- | | | | ___ | === | | | | | |\ .-|___|->+12V === GND === '-' '--)-|-\ | 22K GND GND |4.052v | | >-o-------o 6th o----------. o-|+/ | | | |/ .-. | | | | | | ___ | | | | |\| .-|___|->+12V '-' '----)-|-\ | 22K |3.356v | | >-o-------o 5th o--------. o-|+/ | | | |/ .-. | | | | | | ___ | | | | |\ .-|___|->+12V '-' '------)-|-\ | 22K |2.660v | | >-o-------o 4th o------. o-|+/ | | | |/ .-. | | | | | | ___ | | | | |\ .-|___|->+12V '-' '--------)-|-\ | 22K |2.043v | | >-o-------o 3rd o----. o-|+/ | | | |/ .-. | | | | | | ___ (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de) Hope this doesn't get munged. Chris B #### [email protected] Jan 1, 1970 0 That is absolutety most helpful. The 7805 is only what was available at my local Radio Shack. Is that AACircuit v1.28.6 going to help me veiw you schematic a little better, cause it looks like you got it. After this I am going to a PIC, I have a sample of PIC16f873, and the 4000 series stuff coming as samples. I think that I have to just reverse my inputs to my lm339 and should work with what you put down. Thanks a million. C #### Chris Jan 1, 1970 0 And again! ___ ~4.83V |\ .-|___|->+12V ____ .---------------------. o-|-\ | 22K +12V | | ___ | ___ 4.526v | | | >-o---------o N o--o-|7805|-o-|___|-o-|___|-o------------.'-)-|+/ +| |____|+| | | | |/ --- | --- .-. | | --- | --- | | | | ___ | === | | | | | |\ .-|___|->+12V === GND === '-' '--)-|-\ | 22K GND GND |4.052v | | >-o-------o 6th o----------. o-|+/ | | | |/ .-. | | | | | | ___ | | | | |\| .-|___|->+12V '-' '----)-|-\ | 22K |3.356v | | >-o-------o 5th o--------. o-|+/ | | | |/ .-. | | | | | | ___ | | | | |\ .-|___|->+12V '-' '------)-|-\ | 22K |2.660v | | >-o-------o 4th o------. o-|+/ | | | |/ .-. | | | | | | ___ | | | | |\ .-|___|->+12V '-' '--------)-|-\ | 22K |2.043v | | >-o-------o 3rd o----. o-|+/ | | | |/ .-. | | | | | | ___ | | | | |\ .-|___|->+12V '-' '----------)-|-\ | 22K |1.022v | | >-o-------o 2nd o--. o-|+/ | | | |/ .-. | | | | | | ___ | | | | |\ .-|___|->+12V '-' '------------)-|-\ | 22K | | | >-o-------o 1st === '-|+/ GND |/ (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de) C #### Chris Jan 1, 1970 0 That is absolutety most helpful. The 7805 is only what was available at my local Radio Shack. Is that AACircuit v1.28.6 going to help me veiw you schematic a little better, cause it looks like you got it. After this I am going to a PIC, I have a sample of PIC16f873, and the 4000 series stuff coming as samples. I think that I have to just reverse my inputs to my lm339 and should work with what you put down. Thanks a million. Google munged the ASCII diagram a bit -- just cut & paste to Notepad if your newsreader doesn't have non-proportional/fixed font capability. I sent it again, and it should be OK. AA Circuit is helpful if you want to send ASCII circuit diagrams in this newsgroup. It's beerware (you owe the author a beer if you ever meet him). You're welcome. Just pass it on. Good luck Chris B #### [email protected] Jan 1, 1970 0 Would a PIC16LF84A-04I/P or a PIC16F873A-I/SP accomplish this as I can get samples of these only so far. B #### Byron A Jeff Jan 1, 1970 0 Only problem is that they don't supply samples of PIC16f84, they do some others, but not that one or at least that I can find. Take a look at my "16F84 is really obsolete page" here: http://www.finitesite.com/d3jsys/16F88.html First off the 16F84 wouldn't help you because it doesn't have an ADC converter that you'd need. The page also outlines most of the upgrades the 16F88 has over the 16F84. Finally you can get samples of the 16F88 from Microchip. You mentioned in another post about the 16F873. This would also be a fine choice for this project. BAJ B #### [email protected] Jan 1, 1970 0 Anyone know what the code would look like for the 873A or the 88? I should be able to wire the output voltage from the sensor to the PIC, and the outputs with resistors to the diplay, but what does the code look like internally? J #### John Fields Jan 1, 1970 0 Anyone know what the code would look like for the 873A or the 88? I should be able to wire the output voltage from the sensor to the PIC, and the outputs with resistors to the diplay, but what does the code look like internally? Well, neglecting initialization and housekeeping, you're going to wind up with two sections, basically. The first will have to do with converting your sensor's output voltage into a number beween zero and 255 and determining where that number sits with reference to some 'magic numbers' you'll have to program into the chip. Your trip points are: 6 = Anything over 4.526v 5 = Anything over 4.052v 4 = Anything over 3.356v 3 = Anything over 2.660v 2 = Anything over 2.043v 1 = Anything over 1.022v You have to equate those voltages to numbers, and if you have an 8 bit ADC with an input upper limit of 5V, then zero volts into it will result in 0000 0000 (hex 0X00) out of it and five volts into it will result in 1111 1111 (0Xff) out of it. So, since you have 256 output states available from the ADC, the sensitivity of the LSB will be equal to: 5V LSB = ------------ = 0.01953 V 256 states which means that the granularity of your ADC will be such that the smallest change you'll be able to detect in the output of your sensor will about 20 millivolts. With that in mind, we need to 'normalize' your trip points to the 8 bit field we're playing in, and we can do that by dividing your various trip points by the sensitivity of the ADC, like this: 4.526V TP6 = --------- = 230.8 ~ 231 = 0xe8 = 1110 1000 0.01961 So, when your ADC outputs 1110 1000, you'll know that the output of your sensor is pretty close to 4.526V (within about 20mV one way or the other, anyway.) If you performed that division and conversion for all of your trip points, you could wind up a table that looked like this: TP VOUT ADCHEX ADCBIN ---|-------|--------|--------| 6 | 4.526 | 0XE8 |11101000| ---|-------|--------|--------| 5 | 4.052 | 0XCF |11001111| ---|-------|--------|--------| 4 | 3.356 | 0XAC |10101100| ---|-------|--------|--------| 3 | 2.660 | 0X88 |10001000| ---|-------|--------|--------| 2 | 2.043 | 0X69 |01101001| ---|-------|--------|--------| 1 | 1.022 | 0X34 00110100| ---|-------|--------|--------| Now, if at the end of every conversion you stored the value in the ADC's output to a register, (let's call it ADCHEX) then to find out what gear you're in all you'd have to do would be something like this, in Motorola 6800 assembler: ngear: lda adchex ;get ADC output cmp #$e8 ;compare it to 232
bhs six ;branch if it's > = 232
cmp #$cf ;compare it to 207 bhs five ;branch if it's > = 207 cmp #$ac ;compare it to 172
bhs four ;branch if it's > = 172
cmp #$88 ;compare it to 136 bhs three ;branch if it's > = 136 cmp #$69 ;compare it to 105
bhs two ;branch if it's > = 105
cmp #$34 ;compare it to 52 bhs one ;branch if it's > = 52 bra ngear ;else loop Now, what you'd like to have, at the branches's targets, is a pattern stored which will get the seven-segment display to display what gear you're in. To do that, you need to know how a seven-segment display is set up. It's like this, where 'a' through 'g' are the names of the segments: a ----- | | f| g |b ----- | | e| |c ----- d So, if you turn on a,b,g,e, and d, the display will read '2'. OK, so assuming (to make my life a little easier) that you've got a common-cathode display and that the µC can source enough current to make the segments easily visible, what we need to do is assign a register to drive the IO port. If we call the register "segdata" and the port "ledout", and agree that the LSB (bit0) of the register and the port will correspond to segment 'a', bit 1 to segment 'b' and so forth, with the MSB always being equal to 0, then the code for the branches should look like this: six: lda #$0d ;segment data for "6"
bra ledon ;to turn on the segments

five: lda #$65 ;segment data for "5" bra ledon ;to turn on the segments four: lda #$66 ;segment data for "4"
bra ledon ;to turn on the segments

three: lda #$4f ;segment data for "3" bra ledon ;to turn on the segments two: lda #$3b ;segment data for "2"
bra ledon ;to turn on the segments

one: lda #\$06 ;segment data for "1"
ledon: sta ledout ;turn on the segments
bra ngear ;loop back to the beginning

B
Replies
21
Views
2K
M
Replies
7
Views
127
Replies
1
Views
308
Replies
20
Views
2K
Replies
21
Views
2K