What I need is when I press button2, I want to increment after 0.5 seconds the numbers shown at two 7-segment displays.
The code that I am using is below. When I press button2 it is incrementing very fast both digits.
Then change your main program so it's similar to this:
Code:
void main()
{
int8 increment = 0;
while(1)
{
wait_for_keypress();
increment++;
// Put the 7-segment code here.
}
}
nina
Joined: 20 Apr 2007 Posts: 111
increment
Posted: Wed May 19, 2010 5:00 pm
Thank you for all responses...the way I solved the problem was:
Code:
while (input(button1) == 0)
{
output_b(dezena[vdezena]);
delay_ms(5);
output_b(unidade[vunidade]);
delay_ms(5);
if (input(button2) == 0)
{
a++;
if (a == 50)
{
incrementa = incrementa +1;
vdezena = incrementa/10;
vunidade = incrementa - (vdezena*10);
output_b(dezena[vdezena]);
delay_ms(5);
output_b(unidade[vunidade]);
delay_ms(5);
a = 0;
}
}
}
It is working but I would like to know if there is another way to do this...
tks again
nina
nina
Joined: 20 Apr 2007 Posts: 111
increment
Posted: Sat May 22, 2010 1:55 pm
What is the way and/or hardware that I can use to "save" some pins at PIC when using 7 segments display?
Suppose I need use 6 display 7 segments. How to "save" pins at PIC?
Thank you
Nina
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Sat May 22, 2010 2:04 pm
I think you are asking how to multiplex the pins on one 7-segment display.
Normally, the multiplexing is done with several displays. 7 pins are used
on the PIC to display the segments. Then other pins on the PIC are
used to enable each display (each digit).
Scroll down to Figure 6 on this webpage. It shows how to connect the
wires.
http://www.melabs.com/resources/articles/ledart.htm
Is this what you really want to do ?
nina
Joined: 20 Apr 2007 Posts: 111
multiplex
Posted: Sat May 22, 2010 3:41 pm
That is what I am looking for...
Where can I find some examples (CCS) about multiplexing 7 segment display.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum