full reading done
This commit is contained in:
parent
5397036918
commit
5e1a035517
11
main.c
11
main.c
@ -53,6 +53,9 @@
|
|||||||
void resetTMR0(void);
|
void resetTMR0(void);
|
||||||
void endFrame(void);
|
void endFrame(void);
|
||||||
|
|
||||||
|
uint8_t nRxByte = 0;
|
||||||
|
extern uint8_t rx_buf[256];
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
// Initialize the device
|
// Initialize the device
|
||||||
@ -104,18 +107,14 @@ void main(void)
|
|||||||
|
|
||||||
|
|
||||||
void resetTMR0(void){
|
void resetTMR0(void){
|
||||||
volatile uint8_t dummy;
|
rx_buf[nRxByte++] = RCREG1;
|
||||||
dummy = EUSART1_Read();
|
|
||||||
|
|
||||||
|
|
||||||
TMR0_Reload();
|
TMR0_Reload();
|
||||||
TMR0_StartTimer();
|
TMR0_StartTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void endFrame(void){
|
void endFrame(void){
|
||||||
|
|
||||||
|
|
||||||
INTCONbits.TMR0IF = 0;
|
INTCONbits.TMR0IF = 0;
|
||||||
|
nRxByte = 0;
|
||||||
TMR0_StopTimer();
|
TMR0_StopTimer();
|
||||||
modbus_analyse_and_answer();
|
modbus_analyse_and_answer();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user