Sunday, March 20, 2016

UART : Arduino : Serial Port


I got a new Arduino Uno .........:):):)

So first thing I started is to get the BLINK program which comes as part of examples to run.

Now as thing stand, whenever u tend to do things by urself u will run into lot of questions.

So I am not sure how I came to read about UART, but I did and below are things as per my understanding.




UART is software component which tells how to transmit data.

Ex : Mostly UART uses 10 bit frame structure, which can send 8 bit of data.
       or 11 bit , where 1 bit is parity bit.

2 extra bit are STARTING BIT , which is marked by LOW VOLTAGE and
                       STOP BIT , marked by HIGH VOLTAGE.

We will have BAUD RATE, which tells no of bits can be send per second. Most common is 9600.

So we can send 960 frames ( 10-bit frame) each second. or 960 octects of data in 1 second using UART with baud rate of 9600.

BAUD RATE is property of BAUD GENERATOR, which is an oscillator, with a particular frequency.

Formula  of baud rate :

Frequency / (16*(spbrg+1))   // spbrg here is register value of baud rate generator register. 

Basically depending on the BAUD RATE we need, we set spbrg for a particular frequency. 

there is one function I get from net, which will be in the library of microcontroller u are buying. 

OpenUSART(para1,para2,para3,para4,para5,para6)

here para6 is value of spbrg.  and para4 tell 8 bit data transmission.  REST can be get from internet

We also have to assign MICROCONTROLLER one port as INPUT and one as OUTPUT.

So now we know FRAME structure and how to set spbrg programmatically. Doing this we can tell microcontroller to send / receive data using UART.

Good Link : https://www.youtube.com/watch?v=py3HpisbJEY



Now coming to 2nd part . This will be brief

UART was the software part. The hardware/PHY part which converts signals and send them across can be RS-232 or TTL.

Most microcontrollers with UART uses TTL (Transistor-transistor Logic) level UART.
he TTL level UART is commonly used in the communications between microcontrollers and ICs. Only 2 wires are required for the full duplex communications.It is the simplest form of UART. Both logic 1 and 0 are represented by 5V and 0V respectively.



RS-232 (Recommended Standard 232) is a standard for serial binary data signals connecting between a Data Terminal Equipment (DTE) and a Data Communication Equipment (DCE).


GOOD LINK:
 http://tutorial.cytron.com.my/2012/02/16/uart-universal-asynchronous-receiver-and-transmitter/





No comments:

Post a Comment