You can also check my digital clock based on 74ls90
here --> http://circuitdesolator.blogspot.com/2010/12/digital-clock-based-on-74ls90.html
Here's the picture of my digital clock prototype
This is the schematic of the device:
Notes to remember:
1. Put resistors from 7447 to the seven segment display pins(a-g) as current limiter resistors
2. You need to start up you're clock at exactly 1200am/pm.
-------------------------------------------SOURCE CODE-----------------------------------------------
//Digital Clock using PIC16f628a microcontroller
//Design by: circuit_desolator
//Date: April 2011
#include<htc.h>
#define _XTAL_FREQ 4000000
__CONFIG(INTIO & WDTDIS & PWRTDIS & UNPROTECT & BORDIS & LVPDIS);
unsigned int hours = 0;
unsigned int mins = 59;
unsigned int timer = 0;
unsigned char mpx_cnt = 0;
static unsigned char mode = 0;
void interrupt ISR(void)
{
{
timer++;
if(timer > 19650)
{
mins++;
if(mins == 60)
{
mins = 0;
hours++;
if(hours == 13)
hours == 1;
}
timer = 0;
}
}
switch (mpx_cnt)
{
case 0:
PORTB = hours/10;
RA0 = 1;
mpx_cnt = 1;
case 1:
PORTB = hours%10;
RA1 = 1;
mpx_cnt = 2;
case 2:
PORTB = mins/10;
RA2 = 1;
mpx_cnt = 3;
case 3:
PORTB = mins%10;
RA3 = 1;
mpx_cnt = 0;
}
T0IF = 0; //clear TMR0 interrupt flag
}
void init_Timers(void)
{
GIE = 0;
T0CS = 0;
PSA = 0;
PS2 = 0;
PS1 = 0;
PS0 = 0;
T0IF = 0;
T0IE = 1;
TMR0 = 6;
GIE = 1;
}
void main()
{
TRISA = 0x00;
TRISB &= ~0x0F;
TRISB |= 0xF0;
init_Timers();
while(1);
}
---------------------------------------SOURCE CODE--------------------------------------------
1 comment:
SIR , PLEASE HELP ME ABOUT UR DIGITAL CLOCK USING PIC16F628A
I DON'T UNDERSTAND THE LAG OF LT542 WHICH MAY BE USE HAIR AS A DISPLAY MY I HEARTILY REQUEST U PLEASE HELP ME....????
ALSO I AM CONFUSED ABOUT THE POINT FROM RESISTOR R 10 , R9 , R8 , R7
Post a Comment