Tool/software:
Hello, in the software below, it enters the while loop in main once and does not enter again, the timer continues counting but does not return to the while loop again.
#include "GPIO_Func.h"
#include "ti_msp_dl_config.h"
#include "LCD_Func.h"
#include "RTC_Func.h"
#include "System_Init.h"
#include "stdio.h"
int val=0;
int RTC_Repeat_time;
void TIMER_0_INST_IRQHandler(void)
{
switch (DL_TimerG_getPendingInterrupt(TIMER_0_INST)) {
case DL_TIMER_IIDX_ZERO:
RTC_Repeat_time++;
/*
* Timer'ı durduruyoruz, yük değerini tekrar ayarlayıp
* tekrar başlatıyoruz
*/
// DL_TimerG_stopCounter(TIMER_0_INST);
/* Timer'ı 200 ms periyodunda tekrar başlatıyoruz */
/*
DL_TimerG_setLoadValue(TIMER_0_INST, TIMER_200_MILLISECONDS_TICKS);
DL_TimerG_startCounter(TIMER_0_INST);
/* GPIO pinlerini değiştir (LED'leri yak/söndür) */
break;
default:
break;
}
}
int main(void)
{
SYSCFG_DL_init();
Interrupt_Init();
Timer_Init();
RW_OFF;
LCD_Backlight_ON;
LCD_Init();
Sample_Loop() ;
// DS1307'ye saati ayarla
//writeTimeToDS1307(15, 9, 0, 4, 22, 8, 24); // Saat: 09:52:00, Gün: 5 (Cuma), Tarih: 22 Ağustos 2024
while (1) {
if(RTC_Repeat_time>5){
Read_Time_from_RTC();
char timeStr[16];
snprintf(timeStr, sizeof(timeStr), "%02d:%02d:%02d", hours, minutes, seconds);
char dateStr[16];
snprintf(dateStr, sizeof(dateStr), "%02d/%02d/%02d %s", date, month, year, dayStr);
// Zamanı üst satıra, tarihi alt satıra yazdır (ortalamalı ya da ortalamadan)
lcdPrintLines(timeStr, dateStr, 1, 1);
RTC_Repeat_time=0;
}
//delay_cycles(16000000);
}
}
