rcalls when USART interrupts

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When the USART interrupts I want to show a message (Receiving....) on a display immidiatly, but this needs rcalls and more code executed.
But is this a problem with the SRAM stack? (and then enabling the interrupts again with reti)

Thanks.

RES

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RES wrote:
When the USART interrupts I want to show a message (Receiving....) on a display immidiatly, but this needs rcalls and more code executed.
But is this a problem with the SRAM stack? (and then enabling the interrupts again with reti)

Thanks.

Interrupt service routines should be kept as short and sweet as possible. I suggest you set a semaphone in the ISR and let the background code detect it and display the message.

DFR

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No problem - apart from being highly not recommended!

You get a USART interrupt for every character received. If you spend too much time in the USART interrupt, then you can miss later received characters.

Better solution is to just set a flag that a character has been received and test it in your main loop - the "Receiving...." message won't be immediate, but it will be very quick!

With this solution, even if characters are received whilst you are displaying the message, the interrupts will still fire on the USART and you should miss nothing