In a project, I’m using an EIA485 bus to send encrypted data packets. That works with Arduino’s buffered serial, but it is kind of awkward, and I’m using none of the more complex stuff in that class anyway.
If I do not use Serial
anywhere in my Arduino sketch, is it safe to create my own interrupt handlers for USART_RXC
etc. and to directly manipulate the USART registers?
1 Answer 1
Absolutely. The only interrupt that Arduino takes for itself unilaterally is the timer 0 overflow interrupt, used for timing purposes (delay()
, milliseconds()
, et alia).
-
1Does it only define the ISR (like this one) once you've used the Serial object?Gerben– Gerben2014年12月29日 19:33:33 +00:00Commented Dec 29, 2014 at 19:33
-
1@Gerben: Using
Serial
causes it to link in two additional vectors on the '328P: USART, RX and USART, UDRE. I have not checked whether usingSerial1
et alia is required for the further vectors on the '1280 or '2560. And to be fair I have not verified any of this on ARM.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2014年12月29日 19:46:47 +00:00Commented Dec 29, 2014 at 19:46 -
1Hmm 485. FYI if your interested in 9bit. I recently helped a friend and found it much quicker to tweak the existing core library. Rather than rewrite it. See gist.github.com/mpflaga/ebe6aadd20f81de8e970mpflaga– mpflaga2014年12月30日 00:25:57 +00:00Commented Dec 30, 2014 at 0:25