Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Incorrect digit display in 7-segments by using PIC

Status
Not open for further replies.

cxiong

New Member
I have tried to use the PIC16F877 to work as a temperature display
device.

I used a thermo sensor from radioshack. I used PORTA RA0/AN0 to do
the ADC and used PORTD as output and connected it to all segments abcdefg (3 modules), and used
PORTE as output - RE0 - RE2 as control signals to 3 modules (common cathode)
through 3 transistors.

The problem I have is that I can not display all 3 display at
the same time. Because when all 3 display are used, I have to set
PORTE,0,1,2 to a high state. Example, I want to display 100, (module2=1 , module1=0, &
module0=0). What I get are all 3 modules display
000 because all the data abcdefg of all segments connected together.

What should I do to display the right number in each individual
segment?

Please help.

Thanks...
 
Not being into pic programming - yet - the only way I see the problem is...

PORTE, RE0 - RE2, need to be high so the segments light. I would forget this idea and just wire the led's as normal.

As the 3 led's are connected in parallel whatever you write to one will display on ALL - as long as PORTE is high so...

Use a latching circuit on each led and use PORTE to control the latch.

This allows you to parallel the lines from pic to latch but beyond this they must be seperate.

Write to PORTD, set RE2 high, write to PORTD, set RE1 high, write to PORTD, set RE0 high.

Result, if I've not drunk too much, is that each led will display what you want.

There may be a better solution but it's too late at night & I don't program pics.

Must go, more beer has arrived.

:lol: :lol:
 
Yeah that's what you need to do.

Basically you just turn on each display for one third of the time. When that display is on it displays its data. so for 100 you might have.
E0=high (to turn on this segment display)
PortD=data to display 1
E0=low (to turn off display segment)
E1=high
PortD=data to display a 0
E1=low
E2=high
PortD=data to display a 0
E2=low.

It will cycle through so quickly it will appear as though the displays are on all the time. The only downside is that you loose a bit of brightness because the displays aren't actually on all the time.
 
Have you connected transistor at the outout of port E or you have directly connected it to supply pin of display?
If you haven't used the transistor, then it will create a problem since port pin cannot supply current to lit 7 LEDs.
And one more thing, in multiplexed displays LEDs are drvien at a current highr than the rated to make display brightnees comparable to non-multiplexed displays. So you need much higher current from port to drive it which can be only taken from Vcc line using a transistor.
 
:wink:

Go to next site below, you will find a hard - and software solutions
to work with 7-segment displays.

**broken link removed**
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top