KlausST
Advanced Member level 7
Hi,
In main() you send the buffer, then delay, then send the buffer, then delay then send the buffer .... again and again...
you don´t wait until new data is recieved....
****
I´d use a "received_flag". decalred as global UNIT8
In the receive ISR you set the flag = true
in main() you write
* If received_flag then --> send buffer, received_flag=flase
as long as there is no byte received the flag is FALS, no data is transmitted
when a byte is received, that flag is TRUE. The IF recognizes it, sends the buffer, clears the flag to omit the buffer to be sent again and again.
Klaus
added:
but usually you want the ISR to be as short as possible (in the meaning of processing time).
Thus the "switch (buffer)" should be within the "IF" in main() loop.
Klaus
This is what you told the microcontroller to do.The program keeps sending the old value over and over(with small delay) till it gets a new command.
In reality when i sent a command letters it sent back nothing.
In main() you send the buffer, then delay, then send the buffer, then delay then send the buffer .... again and again...
you don´t wait until new data is recieved....
****
I´d use a "received_flag". decalred as global UNIT8
In the receive ISR you set the flag = true
in main() you write
* If received_flag then --> send buffer, received_flag=flase
as long as there is no byte received the flag is FALS, no data is transmitted
when a byte is received, that flag is TRUE. The IF recognizes it, sends the buffer, clears the flag to omit the buffer to be sent again and again.
Klaus
--- Updated ---
added:
but usually you want the ISR to be as short as possible (in the meaning of processing time).
Thus the "switch (buffer)" should be within the "IF" in main() loop.
Klaus