midi and serial data i/o at same time

hi all, first post, which i've put off for days, but.. i'm having problems with midi messages over the rx/tx pins, and am coming to the realisation that i don't know enough about what actually goes on when sending and receiving serial data at the same time.

what actually happens in real time when serial data arrives while serial data is being sent ?

i'd be grateful for any information, or tips where to go - i'm a beginner as far as chips are concerned.



something else. is there a way to poll the serial output to see if it's busy?




Built into the atmega168 is a hardware serial port that's brought out on the TX/RX pins. It's bidirectional and TX and RX are independent. This is near page 172 on the datasheet.

It should be possible to see if data is being transfered by the port but I'm not seeing it in the datasheet as I'm new at this too. It would not be available with one of the built in commands that I can tell.

my intention was to check - while a routine is running - whether or not the serial port was busy before sending more information through it. my problem seemed at the time to be that the serial input was missing things because it was busy sending stuff.

it seems however that i was wrong. i stopped the programme from sending anything at all, and fast playing on the keyboard still leads to noteoffs or noteons being missed. looks like i'll have to slim down the other routines, slim though they already are.

If you post a schematic and the source code it would help. I may not have an answer but someone should.