Atmega32 Serial Programming Basics

Slides:



Advertisements
Similar presentations
EXTERNAL COMMUNICATIONS DESIGNING AN EXTERNAL 3 BYTE INTERFACE Mark Neil - Microprocessor Course 1 External Memory & I/O.
Advertisements

SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Serial I/O - Programmable Communication Interface
Lecture 8: Serial Interfaces
Spring EE 316 Computer Engineering Junior Lab Serial Ports.
Serial Peripheral Interface (SPI)
USART and Asynchrono us Communica tion The USART is used for synchronous and asynchronous serial communication. USART = Universal Synchronous/Asynchronous.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
Aztec PC Oscilloscope Michael Mason Jed Brown Josh Price Andrew Youngs.
Programming 8-bit PIC Microcontrollers in C Martin Bates Elsevier 2008.
INPUT-OUTPUT ORGANIZATION
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
4.0 rtos implementation part II
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK–
Digilent System Board Capabilities Serial Port (RS-232) Parallel Port 1 Pushbutton Hint: Good for a reset button Connected to a clock input. See Digilent.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
A Few Words From Dilbert
Lecture Set 9 MCS-51 Serial Port.
Embedded System Design Laboratory October 11, 2002Stanford University - EE281 Lecture #4#1 Lecture #4 Outline Announcements Project Proposal AVR Processor.
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
Universal Asynchronous Receiver/Transmitter (UART)
Embedded System Design Laboratory October 4, 2002Stanford University - EE281 Lecture #3#1 Lecture #3 Outline Announcements AVR Processor Resources –UART.
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
Universal Asynchronous Receiver/Transmitter (UART)
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Essentials of Communication This simple model requires many guarantees. Sender Receiver Communication Link Data.
Serial Peripheral Interface SPI I2C (i-squared cee)
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an introduction to the peripheral functions.
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Communicating. The ATmega16 communicates through one of the following ways: Serial Peripheral Interface (SPI) Universal Synchronous and Asynchronous serial.
BIRLA VISHVAKARMA MAHAVIDYALAY SUBJECT: SPI PROTOCOL & MAX7221 DISPLAY INTERFACING SUBMITTED BY: KISHAN AVASTHI( ) MANSI CHANDEGARA( )
Networked Embedded Systems Pengyu Zhang EE107 Spring 2016 Lecture 8 Serial Buses.
8251 USART.
Criteria for choosing a microcontroller A microcontroller must meet the task at hand efficiency and cost effectively. Speed. What is highest speed of.
Digital Logic Design Alex Bronstein
Embedded Microcontroller Systems
Embedded Systems Programming
Serial Communication Originally created by Anurag Dwidedi and Rudra Pratap Suman.
Serial mode of data transfer
Microcontrollers, Basics Fundamentals of Designing with Microcontrollers 16 January 2012 Jonathan A. Titus.
Serial Communication Buses: I2C and SPI
Input/Output Ports and Interfacing
Tutorial Introduction
Embedded Microcontroller Systems
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
ECE 3430 – Intro to Microcomputer Systems
SERIAL PORT PROGRAMMING
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
SERIAL PERIPHERAL INTERFACE
The Arduino Microcontroller: Atmel AVR Atmega 328
BJ Furman ME 106 Fundamentals of Mechatronics 15NOV2012
Computer Organization and Design
Introduction to Microprocessors and Microcontrollers
Lecture 3 - Instruction Set - Al
Serial Communication Interface: Using 8251
UART Protocol Chapter 11 Sepehr Naimi
COMP3221: Microprocessors and Embedded Systems
Lecturer: Reza Arjmandi Autumn 2015
Преглед Начин функционисања Имплементације
Преглед Начин функционисања Имплементације
SPI Protocol Sepehr Naimi
HD44780 LCD programming From the Hardware Side
HD44780 LCD programming From the Hardware Side
AVR – ATmega103(ATMEL) Architecture & Summary
Compiled by Dr. N.Shanmugasundaram, HOD, ECE Dept, SECE.
Serial Communication 19th Han Seung Uk.
AVR UART The UART, or Universal Asynchronous Receiver Transmitter, provides hardware support for a serial port on AVR processors Signaling is compatible.
Presentation transcript:

Atmega32 Serial Programming Basics EE281 Lecture #3 October 4, 2002 Atmega32 Serial Programming Basics MCI-2151001 By Virendrasinh Vaghela (140973111008) Electronics & Communication Department Faculty Of Technology, Marwadi Education Foundation’s Group of Institutions

Announcements Have you finished Lab #1? Lab#0 Due date is: Monday, (5pm?) Lab#0 Research your ideas Project Idea Discussion (arrange to meet) Do you need a group In-Circuit Emulator (AVR-ICE) Works like simulator but on real hardware One station available, second one coming soon

AVR Processor Resources Interrupts Timers UART (Universal Asynchronous Receiver/Transmitter) SPI (Serial Peripheral Interface) A/D Converters (Analog to Digital) Analog Comparator

AVR AT90S8515 Pinout General Purpose Ports Special Purpose Pins PORTA PORTB PORTC PORTD (Special Functions) Special Purpose Pins Crystal (XTAL1/XTAL2) RESET ICP, OLE, OC1B Power (VCC/GND)

‘8515 Functional Architecture 32 Registers (R0-R31) 4K Prog ROM 512 bytes RAM 512 bytes EEPROM 32 I/O lines 13 Interrupts Lots of fun built-in peripherals

UART The UART, or Universal Asynchronous Receiver Transmitter, provides hardware support for a serial port on AVR processors Signaling is compatible with PC/Mac/Unix serial (RS-232C) The UART provides: Parallel-to-Serial and Serial-to-Parallel conversion Start and Stop Bit framing Parity Generation Baud-Rate Generation (2400-115.2kbps at 3.686 or 7.37MHz) Interrupts Transmit Complete Transmit Data Register Empty Receive Complete

Serial Specification (RS-232C) Data Start bit 6,7,8,9 data bits Parity bit optional (E,O,M,S,N) Stop bit Voltages Processor outputs 0/5V logic-level signal RS-232C uses +12V/-12V signal Level-converter IC provided on STK500 (MAX202) 5V – 0V –

UART Registers UDR (UART Data Register) USR (UART Status Register) Write bytes to transmit Read received bytes USR (UART Status Register) Rx/Tx complete signal bits Framing error, overflow signal bits UCR (UART Control Register) Interrupt enable bits Rx/Tx enable bits Data format control bits UBRR (UART Baud Rate Register) Baud rate generator division ratio

UART Transmitting Send a byte by writing to UDR register TXC bit in USR is set when the final bit has finished transmitting Tx Complete interrupt triggered if enabled in the UCR Must wait for current byte to finish transmitting before sending the next one

UART Receiving How do I know a byte has arrived? Watch the RXC bit in USR Use the Rx Complete interrupt and write an ISR Read received bytes from the UDR UDR is double-buffered, but be sure to read it in time

UART Baud Rate Set by UBRR Varies with fCK

UART Example Code echo1.asm echo2.asm Available on the course website Echos characters sent over serial port back to the sender Shows setup of UART Shows non-interrupt use of both serial receive and transmit echo2.asm Echos only printable characters Uses interrupt-driven receive Implements a 50-byte receive buffer Can be used as starter code for Lab#2 Available on the course website

STK500 UART Connection

Serial Peripheral Interface Allows transfer of information, 8 bits at a time, between microcontroller and any number of peripherals Read and Write operations happen simultaneously Using chip selects allows lots of peripherals to be connected to a single SPI bus at the same time Has no start/stop bit overhead High data rates: 250Kbit to 2Mbit/sec Common uses: Inter-Processor Network Sending MP3 data to MP3 decoders Interfacing to external serial RAM/EEPROM/FLASH Interfacing to serial graphic LCDs Compatible with thousands of chips with SPI, Microwire, I2S, and other serial interfaces

SPI Connections AVR Microcontroller   PERIPHERAL

SPI Pins and Registers SPI Pins SPI Registers MOSI (master out, slave in) MISO (master in, slave out) SCK (serial clock) SS (slave select, optional) SPI Registers SPDR (transferred data read/write register) SPCR (control register) SPSR (status register) SPI Transfer Complete interrupt