Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC 16F877 programmed as a digital clock

Status
Not open for further replies.

minge

Newbie level 4
Joined
Feb 27, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
pic clock

I need help to design a digital clock that is able to show 6 seven segment displays showing hours, minutes and seconds. It should be able to have a clock setting mechanism.

the clock should use minimum number of ICs
 

pic16f877 digital clock

Hai minge, Hope you are asking to design a custom made clock. May i know wether this a project work as a part of the study, or a custom made product which you will be putting in to the market as commmercial product ?
Also do contact www.united77.com where your dream projects can be brought to reality. Good luck
 
  • Like
Reactions: jujan

    jujan

    Points: 2
    Helpful Answer Positive Rating
pic digital clock

This is a project that i want to accomplish. I want to use PIC16F877 micro controller to be used as main.
If possible could you send me the codes for programming this circuit. I also need to have a basic schematic to to this kind of a clock since am new to micro controllers and i also want to know the parts that i need to add to make this clock
plz assist
 

16f877 clock

So..you want Schematics, Code, Components and the PCB for the Digital clock with PIC16F877. Write to me at qrzdx@rediffmaiil.com. Give me your location too.
 

16f877

Did you look at the Microchip.com website? They have an application note that has the code and schematic for a digital clock. The chip they used is different from the 877 but the code is easily ported over to the 877.

BobK
 

digital clock pic circuit

how should i display digital time in lcd using 16f877a
 

Re: digital clock pic circuit

suthish said:
how should i display digital time in lcd using 16f877a

Hello guys,
The clock can be very simple you can use the mikroBasic or assembly as well.
Below is some sample in MB
The processor is up to you which you want to use (minor changes)


Code:
program RTC_Timer0_FreeRun_18F452

' 24 Hour Real Time Clock - Zero-Sum Timer FreeRun Method
' mikroBasic 5.02 ... 18F452 @ 8MHz Default Configuration
' by Warren Schroeder
' Timer0 in 8-bit mode; No Prescaler; 2 counts per microsecond
'
' 1 second = 2000000 clock cycles - 2 for clock restart

const OneSecond as longint = 2000000 - 2
dim Cyc_Counter as longint absolute $30   ' Timer0 cycle counter
dim T0Load as byte absolute $30           ' Timer0 reload value
dim Countdown as word absolute $31        ' # of 8-bit cycles
dim update as boolean                     ' update output
dim secs, mins, hrs as byte               ' tally variables
dim clk as string[9] absolute $20         ' output string for LCD
dim hstr as string[3] absolute $20
dim mstr as string[3] absolute $23
dim sstr as string[3] absolute $26

sub procedure interrupt
   If dec(Countdown) = 0 Then
      Cyc_Counter = OneSecond             ' reload timer
     TMR0L = TMR0L + T0Load              ' include additional TMR0 counts
      If Status.C = 0 Then
         inc(Countdown)                   ' if no carry increment counter once
      End If
      update = true                       ' flag to update clock output
   End If
   INTCON.TMR0IF = 0                      ' clear interrupt flag
end sub

sub procedure Clock24
    If inc(secs) = 60 Then                ' check each tally for rollover
       secs = 0
       If inc(mins) = 60 Then
          mins = 0
          If inc(hrs) = 24 Then hrs = 0 End If
       End If
    End If
    bytetostr(hrs, hstr)                  ' create clock output string for LCD
    If hstr[1] = 32 Then hstr[1] = 48 End If
    bytetostr(mins, mstr)
    mstr[0] = ":"
    If mstr[1] = 32 Then mstr[1] = 48 End If
    bytetostr(secs, sstr)
    sstr[0] = ":"
    If sstr[1] = 32 Then sstr[1] = 48 End If
    LCD_CMD(130)
    LCD_OUT_CP("24-HOUR CLOCK")
    LCD_CMD(195)
    LCD_OUT_CP(clk)
    update = false
end sub

sub procedure Initialize
   ADCON1 = 15
   secs = 255
   mins = 0
   hrs = 0
   update = true
   Cyc_Counter = OneSecond
   inc(CountDown)
   LCD_INIT(PORTB)
   LCD_CMD(LCD_CURSOR_OFF)
   INTCON.GIE = 1                         ' enable GIE
   INTCON.PEIE = 1                        ' enable PEIE
   T0CON = 72                             ' 8-bit; no prescaler; Timer0 off
   TMR0L = 0                              ' clear timer1
   INTCON.TMR0IE = 1                      ' interrupt enabled
   INTCON.TMR0IF = 0                      ' interrupt flag cleared
   T0CON.TMR0ON = 1                       ' start Timer0
end sub

main:
   Initialize

   While true                             ' loop forever
      If update = true Then               ' advance seconds?
         Clock24                          ' yes...then output
      End If
   Wend

end.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top