That's what happens in a real mcu. In simulide, writing to SBUF would trigger data send AND modify the memory, so the old value in SBUF would be updated.
Maybe we should change the write watcher for SBUF to a write interceptor which don't update the memory?
Yes, you are right.
This can be solved using a "mask", for example:
<register name="SBUF" addr="25" mask="00000000"/>
If fifo and fifo both have valid data, it could happen that fifo is read by mcu monitor and can't be read by the user's mcu code...
A simple solution is don't use fifo in UartRx at all. I think that cache one extra data frame doesn't make a difference in most cases ... But since read from receiver buffer would clear the data received flag bit ( the mega328 datasheet says so), it doesn't really fix this case.
Another solution is only pop the fifo when the receive flag bit changed from 1 to 0. But the mega328 datasheet clearly states that the receive buffer is read triggered.
The third solution is to change memory monitor to only update when change happened. I think it's the only solution that really works. But that needs a lot of change to codes.
I think it should be solved at Rev 1980 (read RAM directly).
The forum truncated my post Sad
Yes, the forum was doing weird things for a few days. All text in bold and some other errors.
From atmega328p's example code for reading data, it seems that avr sets the RXCn flag for every data frame received. But in simulide, move data from m_fifo to m_fifo wont raise the interrupt(set the flag), I think this might be a bug.
Yes, I noticed it. It is already solved.
I'm refactoring USART module, to fix some issues and to work well in all modes.
I also removed the "runHardware" feature, this was complicating the code a lot and causing many problems.
This feature disables the bitbanging if the pins are not connected.
Apart of the USART modes for each MCU and different clock sources, it can receive data from the Serial Monitor, so the number of posible combinations are huge, adding the "runHardware" feature on top of that makes it a mess.
I'm thinking to remove the "send data" feature from the Serial Monitor as well and use a "Serial Terminal Component" connected to the pins instead.
There are a lot of problems related to this that are difficult to solve.