From 5e1a03551771be2f66687c0a5574e4147b2c4146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Fri, 10 Mar 2023 13:39:55 +0100 Subject: [PATCH] full reading done --- main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index f324d9a..7d192b5 100644 --- a/main.c +++ b/main.c @@ -53,6 +53,9 @@ void resetTMR0(void); void endFrame(void); +uint8_t nRxByte = 0; +extern uint8_t rx_buf[256]; + void main(void) { // Initialize the device @@ -104,18 +107,14 @@ void main(void) void resetTMR0(void){ - volatile uint8_t dummy; - dummy = EUSART1_Read(); - - + rx_buf[nRxByte++] = RCREG1; TMR0_Reload(); TMR0_StartTimer(); } void endFrame(void){ - - INTCONbits.TMR0IF = 0; + nRxByte = 0; TMR0_StopTimer(); modbus_analyse_and_answer();