UART Protocol Chapter 11 Sepehr Naimi www.NicerLand.com.

Slides:



Advertisements
Présentations similaires
To use the emebedded macros in the games Before you start:
Advertisements

Fun French Language Club
Les réseaux Industriels MODBUS
Why? Extended language Sentence level work Cultural Find out new language Stimulus for creativity Reinforce everything children do in English Fun for.
By: Reshiga and Pavitra
Primary French PowerPoints What’s Your Name?.
Modulation numérique.
Talking about yourself
Word jumble. Can you work out the words below? 1.annlopta2.epuj enritcueasktebs.
Questions II How do you Form Questions in French??
ASR4 - Avril 2005 Téléinformatique - Couche physique1 Mode transmission V24 etc.
Reading an analog clock
Affichage LCD RS: Register Selection Transfert de données
Le Téléphone 1 Âllo! Tante Claudia? 2. Société Lamar, j'écoute 3. Je voudrais parler à 4. C'est de la part de qui? 5. Je vais appeler chez elle 6 Ne quittez.
EXOGAM2 Quelques motivations
Starter Fill in the gaps with the right words from the bottom:
Talking about yourself
Codage et Protection contre les Erreurs
MIC7340 Entrées sorties de base – ports sériels
TRANSMISSION DES DONNEES.
Eri Prasetyo Universitas Gunadarma
TRANSMISSION SÉRIE ASYNCHRONE Février 2008 JF VIENNE.
Fonction COMMUNIQUER les liaisons série
TortoiseSVN N°. Subversion : pour quoi faire ? Avoir un espace de stockage commun – Tous les étudiants du SIGLIS ont un espace svn commun Partager vos.
Architecture introduction.
PLSQL ORACLE 8i Connecter VB à BD Oracle Les collections Question de révision Les blocs anonymes Les triggers REVISION Par : Joël Huot.
Miguel Garzon CrUise Lab - SITE. Introduction Data Types and Sizes Constants Logic Operators Type conversions Example.
IFT 6800 Atelier en Technologies d’information
Introduction au Langage C
Les périphériques de communication
Microcontrôleurs et Langage C Les Interruptions diapo 1
La liaison série RS232 BTS Systèmes Numériques
9 décembre 2014J.Callot L.Piedfort1 Chapitre_1 K60 Evolution des machines Introduction au K60 Liaison série.
Journal télévisé de 20 heures du 13 mars Use the buttons below the video to hear it played, to pause it and to stop it. It lasts roughly 60 seconds.
Etude de cas: carte 80C552++ ‘APPALACHES’
Sif Cours 9 n 7. Communication série u Concepts généraux u Programmation des ports séries n Le matériel u Chapitre 10 CSA u Article dans MSDN: F.
La programmation de l’interface FischerTechnik
1. Introduction Le traitement informatisé de données requiert un dialogue, une communication entre l’homme et la machine, et parfois, entre plusieurs.
La programmation de l’interface FischerTechnik
Pthread Ordonnancement. #define _MULTI_THREADED #include #ifndef _CHECK_H #define _CHECK_H /* headers used by a majority of the example program */ #include.
1 II2/AVR II2 - Microcontroleur  Introduction  Famille ATMEL AVR8bits  ATMega16  Organisation Mémoire  Architecture CPU  Modes d'adressage et jeu.
Micro contrôleurs M. Boutemeur
Direct and Indirect Shauna O.
13/08/2013JC/LP/MD1 TP2 Enoncé. 13/08/2013JC/LP/MD2 Objectif Gérer la liaison série en polling Envoi d’un caractère § au démarrage Faire l’écho des caractères.
WALT: how to tell the time in French WILF: to be able to understand ¼ past, ½ past, ¼ to and o’clock (level 2) to be able to understand all times in French.
Making PowerPoint Slides Avoiding the Pitfalls of Bad Slides.
PERFORMANCE One important issue in networking is the performance of the network—how good is it? We discuss quality of service, an overall measurement.
An Introduction To Two – Port Networks The University of Tennessee Electrical and Computer Engineering Knoxville, TN wlg.
IP Multicast Text available on
1. Neal Creative | click & Learn more Neal Creative © TIP │ Use the built-in c olor palette with green and yellow for callouts and accents Neal Creative.
UBC104 Embedded Systems Review: Interrupts & Timers.
La liaison série RS232 BTS Systèmes Numériques
Communication série Le matériel Concepts généraux
TP4
Evolution des machines Introduction au K60 Liaison série
Phase-Locked Loop Design S emiconducto r S imulation L aboratory Phase-locked loops: Building blocks in receivers and other communication electronics Main.
Le port série GIF-1001 Ordinateurs: Structure et Applications, Hiver 2015 Jean-François Lalonde.
Liaison série.  Dans une liaison série, les données sont envoyées successivement, bit par bit. Il suffit de deux fils (un fil de signal et un fil de.
Essai
WRITING A PROS AND CONS ESSAY. Instructions 1. Begin your essay by introducing your topic Explaining that you are exploring the advantages and disadvantages.
Making PowerPoint Slides Avoiding the Pitfalls of Bad Slides.
INSERT High quality Team photo
Plus que parfait du Subjonctif
Lequel The Last Part.
University : Ammar Telidji Laghouat Faculty : Technology Department : Electronics 3rd year Telecommunications Professor : S.Benghouini Student: Tadj Souad.
Week 10: Healthcare Data Standardization
Linking Schools Class 4Helsinki at Lapage linking with Finland
Asset Management Inventorial Assets: Stand-Alone equipment items that have a cost of $2,000 or more and a useful life of one year or more Artwork & Collections.
User Support Activities
Transcription de la présentation:

UART Protocol Chapter 11 Sepehr Naimi www.NicerLand.com

Topics Communication theory UART protocol UART in AVR Parallel vs. Serial Direction: Simplex, Half duplex, Full duplex Synchronization: Synchronous vs. Asynchronous Line coding UART protocol UART in AVR UART Registers Some programs

Parallel vs. Serial Parallel For short distances Not applicable for long distances More expensive Cross-talk problem

Direction Simplex Half Duplex Full Duplex

Synchronization Synchronous Asynchronous

Line coding Line coding: presenting data using signals Digital NRZ-L: Coding using level of voltage TTL RS232 NRZ-I: Inverting or not inverting Analog: using sine waves ASK FSK PSK RS232 NRZ-I TTL

UART Protocol Serial Asynchronous Full duplex

USART (Universal Synchronous Asynchronous Receive Transmit) USART devices can be used to communicate asynchronously (UART) and synchronously. Since the synchronous capability of USART is not used nowadays, we concentrate on UART.

UART in AVR Control registers: (initialize speed, data size, parity, etc) UBRR, UCSRA, UCSRB, and UCSRC Send/receive register UDR Status register UCSRA

Baud rate System clock UART baud rate

Example: Find the UBRR value for 9600bps. Solution:

Some Standard Baud rates 1200 2400 4800 9600 19,200 38,400 57,600 115,200

UCSRB RXCIE0 (Bit 7): Receive Complete Interrupt Enable To enable the interrupt on the RXC0 flag in UCSR0A you should set this bit to one. TXCIE0 (Bit 6): Transmit Complete Interrupt Enable To enable the interrupt on the TXC0 flag in UCSR0A you should set this bit to one. UDRIE0 (Bit 5): USART Data Register Empty Interrupt Enable To enable the interrupt on the UDRE0 flag in UCSR0A you should set this bit to one. RXEN0 (Bit 4): Receive Enable To enable the USART receiver you should set this bit to one. TXEN0 (Bit 3): Transmit Enable To enable the USART transmitter you should set this bit to one. UCSZ02 (Bit 2): Character Size This bit combined with the UCSZ1:0 bits in UCSRC sets the number of data bits (character size) in a frame. RXB80 (Bit 1): Receive data bit 8 This is the ninth data bit of the received character when using serial frames with nine data bits. TXB80 (Bit 0): Transmit data bit 8 This is the ninth data bit of the transmitted character when using serial frames with nine data bits.

UCSRC UMSEL01:00 (Bits 7:6): USART Mode Select These bits select the operation mode of the USART: 00 = Asynchronous USART operation 01 = Synchronous USART operation 10 = Reserved 11 = Master SPI (MSPIM) UPM01:00 (Bit 5:4): Parity Mode These bits disable or enable and set the type of parity generation and check. 00 = Disabled 01 = Reserved 10 = Even Parity 11 = Odd Parity USBS0 (Bit 3): Stop Bit Select This bit selects the number of stop bits to be transmitted. 0 = 1 bit 1 = 2 bits UCSZ01:00 (Bit 2:1): Character Size These bits combined with the UCSZ02 bit in UCSR0B set the character size in a frame. UCPOL0 (Bit 0): Clock Polarity This bit is used for synchronous mode. UCSZ02 UCSZ01 UCSZ00 Char. size 5-bit 1 6-bit 7-bit 8-bit 9-bit

UDR

UCSRA RXC0 (Bit 7): USART Receive Complete 0 This flag bit is set when there are new data in the receive buffer that are not read yet. It is cleared when the receive buffer is empty. It also can be used to generate a receive complete interrupt. TXC0 (Bit 6): USART Transmit Complete 0 This flag bit is set when the entire frame in the transmit shift register has been transmitted and there are no new data available in the transmit data buffer register (TXB). It can be cleared by writing a one to its bit location. Also it is automatically cleared when a transmit complete interrupt is executed. It can be used to generate a transmit complete interrupt. UDRE0 (Bit 5): USART Data Register Empty 0 This flag is set when the transmit data buffer is empty and it is ready to receive new data. If this bit is cleared you should not write to UDR0 because it overrides your last data. The UDRE0 flag can generate a data register empty interrupt. FE0 (Bit 4): Frame Error 0 This bit is set if a frame error has occurred in receiving the next character in the receive buffer. A frame error is detected when the first stop bit of the next character in the receive buffer is zero. DOR0 (Bit 3): Data OverRun 0 This bit is set if a data overrun is detected. A data overrun occurs when the receive data buffer and receive shift register are full, and a new start bit is detected. PE0 (Bit 2): Parity Error 0 This bit is set if parity checking was enabled (UPM1 = 1) and the next character in the receive buffer had a parity error when received. U2X0 (Bit 1): Double the USART Transmission Speed 0 MPCM0 (Bit 0): Multi-processor Communication Mode 0

Program: sending character ‘G’ continuously #include <avr/io.h> void usart_init (void) { UCSR0B = (1<<TXEN0); UCSR0C = (1<<UCSZ01)|(1<<UCSZ00); UBRR0L = 103; //baud rate = 9600bps } void usart_send (unsigned char ch) while (! (UCSR0A & (1<<UDRE0))); //wait until UDR0 is empty UDR0 = ch; //transmit ch int main (void) usart_init(); //initialize the USART while(1) //do forever usart_send ('G'); //transmit ‘G’ letter return 0;

Program 2: It receives bytes of data serially and puts them on Port B. #include <avr/io.h> int main (void) { DDRB = 0xFF; //Port B is output UCSR0B = (1<<RXEN0); //initialize USART0 UCSR0C = (1<<UCSZ01)|(1<<UCSZ00); UBRR0L = 103; while(1) while (! (UCSR0A & (1<<RXC0))); //wait until new data PORTB = UDR0; } return 0;

USB to serial converter in Arduino

MAX232