jean12
Advanced Member level 2
- Joined
- Aug 27, 2013
- Messages
- 529
- Helped
- 5
- Reputation
- 12
- Reaction score
- 6
- Trophy points
- 18
- Activity points
- 5,497
Hello there,I would like to make a counter counting from 00-99 and then go to start (go to 0),the added push button when pressed it reset the PIC;I am using ccs c compiler.
can you please help,here are the complete project,proteus simulation and the codes I tried to run;it is working but jumping some digits (0,6,8 and 9).
See the codes below,they are the same with the ones which are in the zipped folder.
Thanks.
can you please help,here are the complete project,proteus simulation and the codes I tried to run;it is working but jumping some digits (0,6,8 and 9).
See the codes below,they are the same with the ones which are in the zipped folder.
PHP:
#include "16F877A.h"
#USE DELAY(CLOCK=4000000 )
#FUSES XT,NOWDT,NOPROTECT,NOPUT,NOLVP,NODEBUG,NOBROWNOUT
byte const digit[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
int right,cnt;
char digit1[2];
void main()
{
set_tris_b(0x00);
set_tris_a(0x00);
set_tris_d(0xff);
output_b(0x00);
output_a(0x00);
for( ;; )
{
for(cnt=0;cnt<=99;cnt++)
{
digit1[0]=cnt/10;
digit1[1]=cnt%10;
delay_ms(200);
output_high(PIN_A0);
output_b(digit[digit1[0]]);
output_low(PIN_A1);
delay_ms(200);
output_high(PIN_A1);
output_b(digit[digit1[1]]);
output_low(PIN_A0);
delay_ms(200);
}
while(input(PIN_D0)==0)
{
cnt=0;
}
}
}