Unfortunately there are no UART interrupts in the Due version of the Arduino IDE. You have to check for new characters on the UART via polling. There really isn't any reason for that... I mean, the cortex 3M chip does have the capability; it is just not hooked up right now.
Hello...I have a doubt..you said due doesn't have interrupts...u mean by directly using the registers of SAM 3X8E ,interrupt still cannot be used or the due board doesn't have the functionality??. I am trying to use UART interrupt of Due board by directly accessing registers of the controller in it. But no success yet...
Please have a look at it.....any help always welcomed......
My previous posting was sort of wrong. You see, the arduino core for Due does use interrupts for the serial comm. It has pretty much always been there. But, until around 1.5.2 or 1.5.4 they didn't internally to the core have the line:
if (Serial.available()) serialEvent();
So you'd have to do this yourself. That line causes your function called serialEvent to be called if there is available serial data. If you look at the defintion for the method available you'll see that it is checking the serial buffer for characters. Those characters are placed there by the serial interrupt handler. Whether or not the line above is there you can always poll yourself with:
if (Serial.available())
Now, this feels like polling and it is on your end but actually you are polling a buffer that is filled by an interrupt handler. No, you don't ever get a chance to directly implement your own serial interrupt handler. The arduino core has its own handler.
These lines are automatically run every time your loop function is run:
if (Serial.available()) serialEvent();
if (Serial1.available()) serialEvent1();
if (Serial2.available()) serialEvent2();
if (Serial3.available()) serialEvent3();
As you can see, this allows you to have functions that are automatically called for four serial ports if one of them gets incoming data. All the serial ports are really interrupt driven though. Your best bet is really to implement the appropriate serialEvent function and keep your loop function short.