From c73442dc0b44de62e9a2df4007f8772e4bbbcab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Fri, 3 Mar 2023 15:00:03 +0100 Subject: [PATCH] first config of the EUSART and TMR --- solar_panel.X/main.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/solar_panel.X/main.c b/solar_panel.X/main.c index e43bd5c..432a126 100644 --- a/solar_panel.X/main.c +++ b/solar_panel.X/main.c @@ -49,6 +49,9 @@ /* Main application */ +void resetTMR0(); +void endFrame(); + void main(void) { // Initialize the device @@ -65,17 +68,19 @@ void main(void) // Use the following macros to: // Enable the Global Interrupts - //INTERRUPT_GlobalInterruptEnable(); + INTERRUPT_GlobalInterruptEnable(); // Disable the Global Interrupts //INTERRUPT_GlobalInterruptDisable(); // Enable the Peripheral Interrupts - //INTERRUPT_PeripheralInterruptEnable(); + INTERRUPT_PeripheralInterruptEnable(); // Disable the Peripheral Interrupts //INTERRUPT_PeripheralInterruptDisable(); uint16_t foo = 512; + EUSART1_SetRxInterruptHandler(resetTMR0()); + TMR0_SetInterruptHandler(endFrame()); while (1) { foo = ++foo%1023; @@ -94,6 +99,17 @@ void main(void) } } + + +void resetTMR0(){ + TMR0_Reload(); + TMR0_StartTimer(); + INTCONbits.TMR0IF = 0; +} + +void endFrame(){ + // TODO +} /** End of File */ \ No newline at end of file