two 7-segment count up when sw1 is pressed, while count down when sw2 is pressed

Status
Not open for further replies.

Filipe Aparicio

Newbie level 3
Joined
Feb 3, 2013
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,318
Hello everybody, I find difficult to work on this assignment, so I decide to ask any of the group member who knows about this assignment. Your help would be appreciated. Actually this is the assignment, we are required to build the two seven segment circuit by using proteus and create our own code by using MikroC. We are required to use 2 swithches, when SW1 pressed (SW2 unpressed) then the 7-segment will count up(ex 1-20), and when the SW2 pressed(SW1 unpressed) then the 7-segment will count down(ex 20-1). I am done with the circuit in proteus and some codes using MicroC but I really don't know how to include switch with the codes that could fit the circuit. This is the code that I did, please check if there is anything wrong... this only count up form 0-20 repeatedly but as I said, I dont know how to make it count down. Any help would be appreciated.... *** Bless


void main()
{
TRISC=0;
TRISD=0;
{
do
{
PORTD=0x3F;
PORTC=0x3F;
delay_ms(500);
PORTC=0x06;
delay_ms(500);
PORTC=0x5B;
delay_ms(500);
PORTC=0x4F;
delay_ms(500);
PORTC=0x66;
delay_ms(500);
PORTC=0x6D;
delay_ms(500);
PORTC=0x7D;
delay_ms(500);
PORTC=0x07;
delay_ms(500);
PORTC=0x7F;
delay_ms(500);
PORTC=0x6F;
delay_ms(500);
PORTC=0x3F;
PORTD=0x06;
delay_ms(500);
PORTC=0x06;
delay_ms(500);
PORTC=0x5B;
delay_ms(500);
PORTC=0x4F;
delay_ms(500);
PORTC=0x66;
delay_ms(500);
PORTC=0x6D;
delay_ms(500);
PORTC=0x7D;
delay_ms(500);
PORTC=0x07;
delay_ms(500);
PORTC=0x7F;
delay_ms(500);
PORTC=0x6F;
delay_ms(500);
PORTC=0x3F;
PORTD=0x5B;
delay_ms(500);
}
while(1);
}
}
 

In your case, you have to increment or decrement on every button press.
or just increment or decrement from 0 to 20 when button is pressed once?

- - - Updated - - -

also please show your schematic
 
okay, this is schematic diagram that I did using proteus, please check my circuit too
 

Attachments

  • 7s.png
    27.5 KB · Views: 162

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…