Computer Science Canada

7-segment decoder display interfacing

Author:  victor15 [ Fri Jan 11, 2008 9:19 am ]
Post subject:  7-segment decoder display interfacing

On my breadboard I have a CD4055 chip connected to a single 7-segment decoder display. How do I interface it on the computer so whenever I press a number in turing, the number comes up on the 7-segment display? Thanks!

Author:  Tony [ Fri Jan 11, 2008 10:30 am ]
Post subject:  RE:7-segment decoder display interfacing

in Turing, a common hardware interface is done through a parallel port, using parallelput command (I think). You should read the documentation in the Help files, it could be confusing. You can then send a signal to the hardware.

You would have to either tweak the hardware to interpret your signal, or figure out what kind of input the hardware is expecting.

Author:  victor15 [ Fri Jan 11, 2008 3:54 pm ]
Post subject:  Re: 7-segment decoder display interfacing

I have tried to use the parallelput command but whenever I do this:

Parallelput (255)

the entire 7-segment decoder lights up. However, if I put any other value for parallelput, then the entire 7-segment still lights up but gets dimmer. I couldent get the value 1 or anthing to appear on the 7-segment using turing. Any suggestions?

Author:  Tony [ Fri Jan 11, 2008 4:03 pm ]
Post subject:  RE:7-segment decoder display interfacing

find documentation for the 7-segment decoder. Or ask someone who knows more about this particular device. This might be a problem outside of Turing.

Author:  octopi [ Fri Jan 11, 2008 7:35 pm ]
Post subject:  Re: 7-segment decoder display interfacing

You've tried every other value?

If you haven't then I'd make a simple loop (with a delay) that will increment from 1 to 255 and write the number to the port, then let it run and watch it, and see for sure.

But, yes, if you can find a pdf for it, it will make things alot easier.

Also the reason your seeing it get brighter and fainter, is that its probably being powered from the parallel port. The parallel port works by setting the data pins high, or low.
High means it is raised to a higher voltage, and low means nothing is there.

When you send it 255 as the value, that means that all 8 pins are being set high (so it will have a lot more power), if you send it a value of 0 that means that no pins will be set high.

It could be that each segment corresponds to a bit, this would explain that when you set it to 255 all the lights light up.

The loop would be your best bet.
Keep in mind your going to probably have to set individual bits


code:
                \1/
                 _
 might be 32 -> |_|   <- 2
          16 -> |_|   <- 4
                           
                /8\

and I'd assume the middle would be 64


however note that my numbering is arbitrary, you'll have to figure out what yours really is.
If your numbering is like this, then for a 1, you'd write
parallelput(6);

for 2 you'd write 1+2+64+16+8
parallelput(92);

for 3 you'd write 1+2+64+4+8
parallelput(79);


etc....

hopefully you'll be able to make sense out of this.

Author:  octopi [ Fri Jan 11, 2008 7:41 pm ]
Post subject:  Re: 7-segment decoder display interfacing

I was just looking up the chip number you mentioned, and it appears that it should handle everything for you, so in this case you'd write just whatever number you want to the parallelport

parallelput(1) should display 1

Author:  victor15 [ Sat Jan 12, 2008 3:45 pm ]
Post subject:  Re: 7-segment decoder display interfacing

When i tried parallelput (1), the entire 7-segment decoder display turned on but extremely dim. I just cant get the digit one to pop up on the display. I also tried this code:

loop
for i: 1..255
parallelput (i)
end for
end loop

When i did the code above, the entire 7-segment display just turns entirely on and off. Any suggestions on how to fix this? I am also using the CD4055 chip connected to my display. Thanks!

Author:  OneOffDriveByPoster [ Sat Jan 12, 2008 5:16 pm ]
Post subject:  Re: 7-segment decoder display interfacing

How did you connect the port to the chip? (Which pins to which.) That might be useful to know.

Author:  Tony [ Sat Jan 12, 2008 5:17 pm ]
Post subject:  Re: 7-segment decoder display interfacing

victor15 @ Sat Jan 12, 2008 3:45 pm wrote:
When i tried parallelput (1), the entire 7-segment decoder display turned on but extremely dim.

This just doesn't seem right. Are you sure that everything is connected correctly?

Author:  victor15 [ Sat Jan 12, 2008 5:42 pm ]
Post subject:  Re: 7-segment decoder display interfacing

Heres how I connected it:

On the CD4055 chip, pins 2,3,4,5 connects to pins 2,3,4,5 on the ribbon cable

and pins 9,10,11,12,13,14,15 on the chip connects to the 7-segment display.


Also, after I connected the chip to the 7-segment display, I turned on the power on my breadboard and the entire 7-segment turned on so, I know the circuit on my breadboard works. Any suggestions?

Author:  octopi [ Sat Jan 12, 2008 6:58 pm ]
Post subject:  Re: 7-segment decoder display interfacing

how does the ribbon cable connect to the parallel port?

Shouldn't there be atleast one connection to the computers ground, so that it knows when its high or low?
Ground would be pin 18-25 on the 25pin parallel port.

Author:  victor15 [ Sat Jan 12, 2008 7:48 pm ]
Post subject:  Re: 7-segment decoder display interfacing

Yes I also connected one end of a loose wire to pin 18 of the ribbon cable and the other end to the negative end of the breadboard. Still need help. Thanks!

Author:  OneOffDriveByPoster [ Sat Jan 12, 2008 10:08 pm ]
Post subject:  Re: 7-segment decoder display interfacing

Try connecting pin 9 on the parallel port to pin 16 on the chip and pin 7 and 8 on the chip to the negative bar (where you connected pin 18 of the the parallel port). I hope your LEDs can take 5V... Do use delay(1000) or similar to see the output...

Author:  victor15 [ Sun Jan 13, 2008 11:06 am ]
Post subject:  Re: 7-segment decoder display interfacing

If this does not work then are there any other ways I can try?

Author:  OneOffDriveByPoster [ Sun Jan 13, 2008 11:52 am ]
Post subject:  Re: 7-segment decoder display interfacing

victor15 @ Sun Jan 13, 2008 11:06 am wrote:
If this does not work then are there any other ways I can try?
Yes. Connect pin 8 of the parallel port to pin 6 of the chip and disconnect everything connected to the common electrode of the 7-segment display and connect pin 0 of the chip to the common electrode instead. Do go through all of 0 to 255. Might help to jump to 64 or 128 or 192 and start from there.

Author:  victor15 [ Sun Jan 13, 2008 12:04 pm ]
Post subject:  Re: 7-segment decoder display interfacing

I didnt quite understand that. Also, are there any other ways I can try to get the program to work. Also I do not want to disconnect the 7-segment from the chip because, I know there are no problems .

Author:  OneOffDriveByPoster [ Sun Jan 13, 2008 12:18 pm ]
Post subject:  Re: 7-segment decoder display interfacing

victor15 @ Sun Jan 13, 2008 12:04 pm wrote:
I didnt quite understand that. Also, are there any other ways I can try to get the program to work. Also I do not want to disconnect the 7-segment from the chip because, I know there are no problems .
How do you know? Just because something lights up? You shouldn't need to disconnect the 7-segment from the chip to make the change I mentioned... How many connections are there from the chip to the 7-segment? Are there 7 or 8?
I think you should just try a simple test program until you know that your hardware is connected properly.

Author:  victor15 [ Sun Jan 13, 2008 1:25 pm ]
Post subject:  Re: 7-segment decoder display interfacing

There are 7 connections from the chip to the 7-segment display.
Also, I know it works because, with my breadboard power turned off,
the 7-segment works when I connect my breadboard to the ribbon cable.
Any other suggestions? Thanks!

Author:  OneOffDriveByPoster [ Sun Jan 13, 2008 1:42 pm ]
Post subject:  Re: 7-segment decoder display interfacing

victor15 @ Sun Jan 13, 2008 1:25 pm wrote:
There are 7 connections from the chip to the 7-segment display.
Okay, I am saying that you can make an eighth connection. It may not change much though. Can you at least try all the existing suggestions before asking for more?

Author:  victor15 [ Mon Jan 14, 2008 3:32 pm ]
Post subject:  Re: 7-segment decoder display interfacing

I tried the circuit today at school. Here is how I connected it

Pins 9,10,11,12,13,14,15 from the chip are connected to the 7-segment display.
Pins 2,3,4,5 from the chip are connected to pins 2,3,4,5 on the ribbon cable.
Pin 16 from the chip is connected to the positive side of the breadboard.
Pin 6 from the chip is connected to the positive side of the breadboard.
Pins 7 and 8 from the chip is connected to the negative side of the breadboard.
Pin 18 from the ribbon cable connects to the negative side of the breadboard.

When I tried the circuit connection above, I put parallelput (2) on turing and, the number 2 comes on the 7-segment display but, if I put any other number, the 7-segment displays a 6 or 9 or it just gets messed up on the display. Any suggestions? Am I connecting anything wrong? Also, I am using a CD4055 chip. Thanks!

Author:  octopi [ Mon Jan 14, 2008 3:38 pm ]
Post subject:  Re: 7-segment decoder display interfacing

I would check your connections on both the ribbon cable, and the chip, the results you are seeing suggest that some wires are accidently touching each other/making contact.

What do you see when you do the number 8?
You should see all them light up...

Author:  victor15 [ Mon Jan 14, 2008 3:52 pm ]
Post subject:  Re: 7-segment decoder display interfacing

When I use parallelput (8) the 7-segment display just gets messed up. In case you wanted to know, here is the default connection on the sheet my teacher gave me:

Pins 2,3,4,5 from the chip connect to pins 2,3,4,5 on the ribbon cable.
Pin 18 of the ribbon cable connect to the negative side of the breadboard.
Pins 9,10,11,12,13,14,15 from the chip connect to the 7-segment.
Pins 6 and 16 from the chip connect to positive side of the breadboard.
Pin 16 from the chip connect to positive of the breadboard.
I also have the CD4055 chip.

Are there any ways to make my 7-segment appear the number I want from 1 to 9 when I use parallelput? What should be connected? Thanks! Very much appreciated!!

Author:  octopi [ Mon Jan 14, 2008 5:14 pm ]
Post subject:  Re: 7-segment decoder display interfacing

Did you do what I suggested? Check your connections, to make sure nothings touching that shouldnt be?

How do they get "messed up" we can't help you unless you help us to understand.

Author:  victor15 [ Mon Jan 14, 2008 5:18 pm ]
Post subject:  Re: 7-segment decoder display interfacing

Everything is connected properly and no wires are touching other wires. But, when I move them around and run the program on turing, the 7-segment display become messed up and gets jumbled up.

Author:  octopi [ Mon Jan 14, 2008 5:24 pm ]
Post subject:  Re: 7-segment decoder display interfacing

I want you to tell me what you mean by messed up, or jumbled up!

Author:  victor15 [ Mon Jan 14, 2008 5:35 pm ]
Post subject:  Re: 7-segment decoder display interfacing

Jumbled up on the 7-segment means, that the sections on the 7-segment are all over the place such as: _
|
|_
or


|_|
|_

Author:  octopi [ Mon Jan 14, 2008 6:03 pm ]
Post subject:  Re: 7-segment decoder display interfacing

do they keep moving?

or is there a direct relation of 1 number to 1 output
like parallelput(1) always displays the same thing, which is different from
parallelput(3) etc?

Author:  victor15 [ Mon Jan 14, 2008 6:25 pm ]
Post subject:  Re: 7-segment decoder display interfacing

yes they keep on moving jumbled up if i loop it from 1..255. If I just put in parallelput (1), it is still jumbled but, it moves on the display when I wiggle the wires around.

Author:  octopi [ Mon Jan 14, 2008 6:29 pm ]
Post subject:  RE:7-segment decoder display interfacing

Okay, so that tells you, that you have bad connections, make sure all your connections are good.

Some wires must not be conducting properly, if the breadboard is well used, it could be that the connection inside the breadboard isn't good anymore, try moving it to a different spot in the breadboard.

Ensure your connections are all good, do you have a digital multi-meter, you can use the continuity setting on this to check to make sure all your connections are good.

Perhaps you could ask your teacher for some help? Explain to him/her all the steps you've gone through to test it. They should be willing to help you.

Author:  victor15 [ Mon Jan 14, 2008 6:33 pm ]
Post subject:  Re: 7-segment decoder display interfacing

I cant ask the teacher because its a project. Anyways, will the circuit work if I connect pins 7 and 8 from the chip to the negative side on the breadboard. And Pin 9 from the ribbon cable to pin 16 of the chip? Or what would you suggest for the connection? Thanks!

Author:  OneOffDriveByPoster [ Mon Jan 14, 2008 6:51 pm ]
Post subject:  Re: 7-segment decoder display interfacing

victor15 @ Mon Jan 14, 2008 6:33 pm wrote:
Or what would you suggest for the connection? Thanks!
*There should be no power to the breadboard except from the port
9,10,11,12,13,14,15 of chip to 7-segment
1 of chip to other side of the 7-segment (seriously, your 7-segment should have 8 electrodes)
2,3,4,5 of chip to 2,3,4,5 of cable
6 of chip to 8 of cable
16 of chip to +ve side
9 of cable to +ve side
7,8 of chip to -ve side
18 of cable to -ve side

Author:  victor15 [ Mon Jan 14, 2008 7:02 pm ]
Post subject:  Re: 7-segment decoder display interfacing

Wow Thanks! By the way, if I run parallelput (1) or any number from 1 to 9, will the exact number appear on my 7-segment display? Also, where does pin 1 from the chip connect to on the 7-segment? Once again Thanks!!!

Author:  OneOffDriveByPoster [ Mon Jan 14, 2008 7:20 pm ]
Post subject:  Re: 7-segment decoder display interfacing

victor15 @ Mon Jan 14, 2008 7:02 pm wrote:
Wow Thanks! By the way, if I run parallelput (1) or any number from 1 to 9, will the exact number appear on my 7-segment display? Also, where does pin 1 from the chip connect to on the 7-segment? Once again Thanks!!!
No, the chip appears to have some inputs reversed (0 is 1 and 1 is 0) but I can't make out which ones. Try these four ranges first.
parallelput(1..15)
parallelput(64+1..64+15)
parallelput(128+1..128+15)
parallelput(128+64+1..128+64+15)

Please put delay(1000) for (I think) a 1 second delay for you to see the output.

For your 7-segment, it depends on your specific 7-segment. For example, see http://www.nutchip.com/progetti/counter_en.htm.

BTW, pins 9-15 to make sure it looks right:
code:
  09
14  10
  15
13  11
  12

Author:  victor15 [ Mon Jan 14, 2008 7:39 pm ]
Post subject:  Re: 7-segment decoder display interfacing

[/quote]*There should be no power to the breadboard except from the port
9,10,11,12,13,14,15 of chip to 7-segment
1 of chip to other side of the 7-segment (seriously, your 7-segment should have 8 electrodes)
2,3,4,5 of chip to 2,3,4,5 of cable
6 of chip to 8 of cable
16 of chip to +ve side
9 of cable to +ve side
7,8 of chip to -ve side
18 of cable to -ve side


If I just follow the steps above will I be able to use parallelput (1) and the number 1 will appear? Also, the link does not work. Thanks!

Author:  OneOffDriveByPoster [ Mon Jan 14, 2008 8:25 pm ]
Post subject:  Re: 7-segment decoder display interfacing

victor15 @ Mon Jan 14, 2008 7:39 pm wrote:
If I just follow the steps above will I be able to use parallelput (1) and the number 1 will appear? Also, the link does not work. Thanks!
Again, no. The mapping is not that simple and the documentation I found is (literally) fuzzy. The link is http://www.nutchip.com/progetti/counter_en.htm . (This site has trouble with periods after a link).

Author:  victor15 [ Mon Jan 14, 2008 8:48 pm ]
Post subject:  Re: 7-segment decoder display interfacing

How do I make it possible so that when I put parallelput (1) the number 1 appears on the 7-segment? Thanks! I have the CD4055 once again.

Author:  octopi [ Tue Jan 15, 2008 12:33 am ]
Post subject:  Re: 7-segment decoder display interfacing

I wouldn't suggest changing anything, I would suggest double checking your connections and making sure they are actually connected, and just don't appear to be connected.

Sometimes you may think its connected, but its not touching enough, and not completing the circuit.

Author:  OneOffDriveByPoster [ Tue Jan 15, 2008 10:06 am ]
Post subject:  Re: 7-segment decoder display interfacing

octopi @ Tue Jan 15, 2008 12:33 am wrote:
I wouldn't suggest changing anything, I would suggest double checking your connections and making sure they are actually connected, and just don't appear to be connected.

Sometimes you may think its connected, but its not touching enough, and not completing the circuit.
Actually, I agree. Switch pin 6 of the chip to the -ve side if the current connections do not work. Only change the circuit to the way I suggested if it still does not work. parallelput(1) will not put 1 on the display without additional circuitry afaik. Again, the chip expects certain inputs to be "reversed" and the pin order for 2,3,4,5 does not match the order of the bits.
What is this obsession with making it display the same number as you put with parallelput() anyway. Do you have to make it work that way?

Author:  octopi [ Tue Jan 15, 2008 10:52 am ]
Post subject:  Re: 7-segment decoder display interfacing

no, it will display 1 if you do parallelput(1), thats the whole point of using the chip, and not directly connecting the 7 segment to the parallelport.

The chip takes care of the conversion for you.

Author:  OneOffDriveByPoster [ Tue Jan 15, 2008 11:09 am ]
Post subject:  Re: 7-segment decoder display interfacing

octopi @ Tue Jan 15, 2008 10:52 am wrote:
no, it will display 1 if you do parallelput(1), thats the whole point of using the chip, and not directly connecting the 7 segment to the parallelport.

The chip takes care of the conversion for you.
No, the chip (if I got the right documentation) does not take input in as straight-forward a manner as what you say. Unless if you used the same chip before...

Author:  octopi [ Tue Jan 15, 2008 11:54 am ]
Post subject:  Re: 7-segment decoder display interfacing

Then what would be the point of the chip at all?

You could directly connect the parallel port to the 7-segment display.

http://www.datasheet4u.com/download.php?id=109190

That shows it as well, it shows input code, and the corresponding graphical output.

Author:  OneOffDriveByPoster [ Tue Jan 15, 2008 1:34 pm ]
Post subject:  Re: 7-segment decoder display interfacing

octopi @ Tue Jan 15, 2008 11:54 am wrote:
http://www.datasheet4u.com/download.php?id=109190
Note the overbar over the 2^0 input pin and the pin order for 2^0, 2^1, 2^2 and 2^3.

Author:  fobbio [ Tue Jan 15, 2008 3:46 pm ]
Post subject:  Re: 7-segment decoder display interfacing

Hey I got this to work at school, I am doing the exact same thing. This is how you connect the loose wires(2,3,4,5) on the breadboard to the ribbon thing:
First number= breadboard
Second number= ribbon/ cable thingy
2-5,3-3,4-2,5-4
Thats how you connect it, and when you run it, turn on the power of your breadboard as well. If your program is fine, this should work.
Program At the end should be something like this:
if ans = 2 then
cls
delay (1000)

elsif ans = 1 then
parallelput (product)
exit
end if

Product being the sum of num1 and num2, if the answer is two the program will restart, if its 1, then it would display the number and exit the program.


: