Microcontroller UART protocol or Drivers

Discussion in 'Embedded Systems and Microcontrollers' started by satish.svap, Sep 8, 2011.

  1. satish.svap

    Thread Starter New Member

    Sep 7, 2011
    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 ??
  2. srikanthsamaga


    Jul 1, 2008
    No... it is not inbuilt... you should write the program and Flash the hex into microcontroller.
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    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.
  4. Roto

    New Member

    Jul 13, 2011
    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: Sep 13, 2011