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);
}
}