Microcontroller UART protocol or Drivers

Thread Starter

satish.svap

Joined Sep 7, 2011
1
Hi Friends,

I got few basic question to clarify on microcontrollers (Mc), please help me.

Ex: Take any 16/32 bit Mc

1.In brand new Mc, is there any inbuilt interrupt service routine for UART protcol or we have to write a driver code to handle all the acknowledgment between rs232 & Mc. who all do these stuff i.e we have to write the code or it will be in built ??

Ex: in 8051

Mov r3,#'A'
Mov sbuf,r3

after placing this code for transmission on sbuf, we get an interrupt say that a character has been sent. So my question is who will take care of the interrupt & the service routine. is it inbuilt ??
 

t06afre

Joined May 11, 2009
5,934
Hi Friends,

I got few basic question to clarify on microcontrollers (Mc), please help me.

Ex: Take any 16/32 bit Mc

1.In brand new Mc, is there any inbuilt interrupt service routine for UART protcol or we have to write a driver code to handle all the acknowledgment between rs232 & Mc. who all do these stuff i.e we have to write the code or it will be in built ??

Ex: in 8051

Mov r3,#'A'
Mov sbuf,r3

after placing this code for transmission on sbuf, we get an interrupt say that a character has been sent. So my question is who will take care of the interrupt & the service routine. is it inbuilt ??
A micro-controller can be seen as system on a chip. All the units are there, wired up and the address range for all the system units are set. But that is about it. If you want it to do something. You have to write the all code needed. Included the ISRs.
 

Roto

Joined Jul 13, 2011
23
It's not that hard if you can get a coded template and example code for the chip and the programming language your going to use. I would pick a chip that suits your purpose but also has a lot of support in the way of examples and maybe even code libraries that you can modify to your needs. I like to start with a library of routine eg. read and write to a flash card.
It makes things a lot easier and you get to study the code from someone else, that hopefully, is better than yourself so you can get a better idea of how to program that chip in general.

I'd also recommend a "sound card oscilloscope" so you can see what your doing eg. checking your interrupt rate or baud rate etc. Takes the guesswork out when you can see it on the screen eg. toggle an output each interrupt to fine tune your timing.
With the PIC's I pick an interrupt rate using the prescaler on the timer but then in the interrupt you can load the timer with a different start value (to speed up the interrupt rate) you can also add NOP's before you load the timer to fine tune it. On some chips you can also vary the main oscillator freq. if you need to be very precise.
The sound card input can be as simple as 2 resistors to drop the input to a volt or less.
But I'm strictly old school; write it in assembler and check it on an oscilloscope.
 
Last edited:
Top