hirenn
Full Member level 1
Pic16f690 interfacing wih two 7 segment using 7447 delay using timer 0
Hi Everyone
i'm using PIC16f690 interface with two seven segment by 7447
im making 0 to 99 counter by using timer 0 of pic controller
i write a code but it shows only ''0'' on my both 7 segment...
can anybody please help me to figure out the problem
Thanks
Hi Everyone
i'm using PIC16f690 interface with two seven segment by 7447
im making 0 to 99 counter by using timer 0 of pic controller
i write a code but it shows only ''0'' on my both 7 segment...
can anybody please help me to figure out the problem
Thanks
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 #include <htc.h> // hi tech compiler for pic16 #define _XTAL _FREQ 4000000 // 4 Mhz freq int overflow = 0; // counter variable for 0 to 99 void interrupt ISR(void) // timer interrupt { if(T0IF) { overflow++; T0IF=0; } } void timer0() { PSA = 0; T0CS = 0; PS1 =1; //prescaler 1:256 PS2 =1; PS0 = 1; T0IE = 1; T0IF=0; GIE = 1; // global interrupt enable } void main(void) { unsigned short second=0; unsigned short x,y=0; // for display on segment TRISC = 0; TRISB7 = 1; ANSEL = 0x00; ANSELH = 0x00; TMR0 = 0; timer0(); //timer0 function while (1) { if(overflow==15) { second++; overflow = 0; } if(second>99) { second =0; } x = second/10; y = second%10; PORTC = (y<<4)+x; // PORTC connected with 7 segment via 7447 } }
Last edited by a moderator: