I am trying to design a program that uses a 1 Hz external clock to create a digital clock. The clock must display the hours and minutes in this format, HH:MM, using the 24 hour military format. I have to assume the output is four 7-Segment displays. I have to use a counter to cause an interrupt every 60 seconds, I need to provide a C programming solution to provide the output in BCD. This is what I have so far:
I can't figure out how to get the format to HH:MM in 24 hour format or use a counter to cause an interrupt every 60 seconds, or any thing else, I don't even know if I have the correct code so far, I don't understand C language or assembly language for the pic18f8680 , I am having a hard time trying to understand both. Can someone pls help
Code:
#include <pic18f8680.h>
#include <timers.h>
void int0_ISR (void);
static unsigned char count;
#pragma code high_vector = 0x08
void high_interrupt (void)
{
_asm
goto int0_ISR
_endasm
}
#pragma interrupt int0_ISR
void int0_ISR (void)
{
if (INTCONbits.INT0IF) // verify interrupt caused by
// INT0
{
INTCONbits.INT0IF = 0; // clear INT0 flag
count++;
PORTD = ~count; // display INT0 interrupt count
// on LEDs
}
}
#pragma code
void main (void)
{
count = 0; // initialize count
TRISD = 0; // configure PORTD for output
PORTD = 0xFF; // turn off all LEDs
RCON = 0x80; // enable priority interrupts
INTCON = 0xD0; //
Comment