0% found this document useful (0 votes)
18 views

chapter 2 - lesson2

Uploaded by

sikaryoseph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

chapter 2 - lesson2

Uploaded by

sikaryoseph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 30

www. Micro Digital Ed.

com
BIHE university

Lesson-2 : Communication

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Parallel vs. Serial
www. Micro Digital Ed. com
BIHE university

• Parallel
– Transfer a byte of data at a time -> faster, easier
• Serial
– Transfers a bit after another -> cheaper, ideal for
long distance through phone line (modem is
needed)

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
2
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Direction
www. Micro Digital Ed. com
BIHE university

• Simplex: data can moves only in one


directions
• Half Duplex: data can moves in two
direction but not at the same time
• Full Duplex: data can moves in two
direction at the same time

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
3
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Synchronous vs. asynchronous
www. Micro Digital Ed. com
BIHE university

• Synchronous
Data transfer where the sender and receiver are
synchronized, meaning they operate at the same clock
rate.
– Clock pulse should be transmitted during data
transmission.
– Only one side generates clock at the same time.
• Asynchronous
Data transfer where the sender and receiver do not need
to be synchronized, allowing data to be sent and
received at different times.
– Clock pulse is not transmitted.
– The two sides should generate clock pulse.
– There should be a way to synchronize© 2011
the Pearson
two Higher
sides.
Education,
AVR Microcontroller and Embedded System Using 4
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Data framing and bps
www. Micro Digital Ed. com
BIHE university

• To synchronize the two sides, framing is used:


– Each frame starts with a space (0) which is called
Start bit
– A character of 7-9 bits is transmitted after start bit
– [a bit of parity can be transmitted after the
character] (optional)
– Each frame is ended by one or two mark (1) which is
called stop bit(s).
• Numbers of bit transmitted in a second is called bps

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
5
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Serial communication protocol
www. Micro Digital Ed. com
BIHE university

RS232 Standard
•RS232 (Recommended Standard 232) is a standard
protocol for serial communication, which defines the
physical and electrical characteristics of the interface.
•RS232 was set by the Electronics Industries Association
(EIA) in 1960.
•Data Transmission: Transmits data one bit at a time
over a single communication line.
•Voltage Levels: Utilizes voltage levels between -15V
and +15V, where typically -12V to -3V represents a logic
'1' (marking) and +3V to +12V represents a logic '0'
(spacing).

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
6
Assembly and C Upper Saddle River, NJ 07458. • All Rights
RS232 Pins
www. Micro Digital Ed. com
BIHE university

• DB 25 used to be the standard connector


of RS232
• Now DB9 is used instead of DB25

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
7
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Null modem connection
www. Micro Digital Ed. com
BIHE university

• A null modem connection is a method of directly connecting


two computers (DTE) using a serial cable. This allows the
computers to communicate with each other without the
need for modems or other networking hardware.
• DTE (Data Terminal Equipment) refers to terminals and
computers that send and receive data.
• To connect two DTE, we connect TXD of one device to RXD
of the other and vise versa. It is called Null Modem
Connection

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
8
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Null modem connection
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
9
Assembly and C Upper Saddle River, NJ 07458. • All Rights
RS-232C Pins
www. Micro Digital Ed. com
BIHE university

Pin Function Description


Indicates that the data carrier signal is being
1 DCD (Data Carrier Detect)
received.
Carries data from the DCE (Data
2 RxD (Receive Data) Communication Equipment) to the DTE (Data
Terminal Equipment).

3 TxD (Transmit Data) Carries data from the DTE to the DCE.
Indicates that the DTE is ready to
4 DTR (Data Terminal Ready)
communicate.
5 GND (Signal Ground) Common ground for all signals.
Indicates that the DCE is ready to
6 DSR (Data Set Ready)
communicate.
Indicates that the DTE is ready to transmit
7 RTS (Request to Send)
data.
8 CTS (Clear to Send) Indicates that the DCE is ready to accept data.
Indicates that a ringing signal is being
9 RI (Ring Indicator)
AVR Microcontroller and Embedded System Using received. © 2011 Pearson Higher Education,
10
Assembly and C Upper Saddle River, NJ 07458. • All Rights
AVR Connection
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
11
Assembly and C Upper Saddle River, NJ 07458. • All Rights
AVR Connection
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
12
Assembly and C Upper Saddle River, NJ 07458. • All Rights
AVR Connection
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
13
Assembly and C Upper Saddle River, NJ 07458. • All Rights
USART Serial Data Communication in AVR Microcontroller
www. Micro Digital Ed. com
BIHE university

USART Serial Data Communication in AVR Microcontroller


•The USART stands for universal synchronous and asynchronous
receiver and transmitter.
•It can operate in both synchronous and asynchronous modes.
•This protocol is used for transmitting and receiving the data bit by
bit with respect to clock pulses on a single wire.
•The AVR microcontroller has two pins: TXD and RXD, which are
specially used for transmitting and receiving the data serially.
The Main Features of AVR USART
•The USART protocol supports the full-duplex protocol.
•It generates high resolution baud rate.
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
14
Assembly and C Upper Saddle River, NJ 07458. • All Rights
USART Serial Data Communication in AVR Microcontroller
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
15
Assembly and C Upper Saddle River, NJ 07458. • All Rights
USART Serial Data Communication in AVR Microcontroller
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
16
Assembly and C Upper Saddle River, NJ 07458. • All Rights
USB
www. Micro Digital Ed. com
BIHE university

USB Port: The Universal Serial Bus, or USB, is an external port that
interfaces between external devices and a computer. The
original IBM personal computers had an RS-232 port that connected
external devices like a keyboard or mouse. Today, USB ports are
replacing RS-232 ports. One may plug most anything into a USB
port. This includes keyboards, cameras, mice, joysticks, modems,
zip drives, floppy drives, printers, and scanners.

USB to TTL convertor


AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
17
Assembly and C Upper Saddle River, NJ 07458. • All Rights
USB
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
18
Assembly and C Upper Saddle River, NJ 07458. • All Rights
SPI (Serial
( Peripheral Interface )
www. Micro Digital Ed. com
BIHE university

Serial Peripheral Interface (SPI) is an interface bus commonly


used to send data between microcontrollers and small peripherals
such as shift registers, sensors, and SD cards. It uses separate clock
and data lines, along with a select line to choose the device you
wish to talk to.

SPI configuration with master and a slave

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
19
Assembly and C Upper Saddle River, NJ 07458. • All Rights
SPI (Serial
( Peripheral Interface )
www. Micro Digital Ed. com
BIHE university

4-wire SPI devices have four signals:


•Clock (SPI CLK, SCLK)
•Chip select (CS)
•Master out, slave in (MOSI)
•Master in, slave out (MISO)
• The chip select signal from the master is used to select
the slave device.
• MOSI and MISO are the data lines.
• MOSI transmits data from the master to the slave and.
• MISO transmits data from the slave to the master.
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
20
Assembly and C Upper Saddle River, NJ 07458. • All Rights
SPI (Serial
( Peripheral Interface )
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
21
Assembly and C Upper Saddle River, NJ 07458. • All Rights
TWI:Two-wire
TWI: Serial Interface
www. Micro Digital Ed. com
BIHE university

• I2C (Inter-Integrated Circuit) is a serial bus interface


connection protocol, It is also called TWI (two-wire
interface).
• The Two-wire Serial Interface (TWI) is ideally
suited for microcontroller applications. The TWI
protocol allows the systems designer to interconnect
up to 128 individually addressable devices using
only two bi-directional bus lines; one for clock
(SCL/serial clock) and one for data (SDA/serial data).

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
22
Assembly and C Upper Saddle River, NJ 07458. • All Rights
TWI:Two-wire
TWI: Serial Interface
www. Micro Digital Ed. com
BIHE university

TWI-Connection
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
23
Assembly and C Upper Saddle River, NJ 07458. • All Rights
TWI:Two-wire
TWI: Serial Interface
www. Micro Digital Ed. com
BIHE university

How it works

1.Start Condition: The master initiates


communication by generating a start condition,
pulling the SDA line low while SCL is high.
2.Addressing: The master sends the address of
the target slave device along with a read/write bit.
3.Acknowledgement: The addressed slave device
acknowledges by pulling the SDA line low.
4.Data Transfer: The master and slave exchange
data bits synchronized by the SCL clock signal.
5.Stop Condition: Communication ends when the
master generates a stop condition by releasing the
SDA line while SCL is high.
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
24
Assembly and C Upper Saddle River, NJ 07458. • All Rights
TWI:Two-wire
TWI: Serial Interface
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
25
Assembly and C Upper Saddle River, NJ 07458. • All Rights
TWI:Two-wire
TWI: Serial Interface
www. Micro Digital Ed. com
BIHE university

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
26
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Ethernet
www. Micro Digital Ed. com
BIHE university

• Ethernet has traditionally been a quite complex


interface. All Ethernet chips until today had 100 pins
or more, where difficult to find in small quantities
and difficult to use from a small microcontroller with
little memory. Microchip has changed the world with
their new ENC28J60 Ethernet chip.

• The ENC28J60 chip has Tx/Rx, MAC and PHY address


in one small chip.

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
27
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Ethernet
www. Micro Digital Ed. com
BIHE university

Ethernet Block
Diagram
AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
28
Assembly and C Upper Saddle River, NJ 07458. • All Rights
Ethernet
www. Micro Digital Ed. com
BIHE university

Key Features of the ENC28J60 Chip


•Integrated MAC and PHY: The ENC28J60 includes
both the Media Access Control (MAC) and Physical
Layer (PHY) components, which are essential for
Ethernet communication.
• MAC handles data packet transmission and
reception,
• PHY deals with the physical connection to the
network
•Tx/Rx Functions: It supports both transmit (Tx) and
receive (Rx) operations, allowing it to send and receive
data over the Ethernet network.
•SPI Interface: The chip communicates with the
microcontroller via the Serial Peripheral Interface (SPI)
•Buffer RAM: It includes 8 KB of buffer RAM for storing
data packets, which helps in managing data
AVR Microcontroller and Embedded System Using
flow
© 2011
and
Pearson Higher Education,
29
reducing latency.
Assembly and C Upper Saddle River, NJ 07458. • All Rights
www. Micro Digital Ed. com
BIHE university

End of lesson 2

AVR Microcontroller and Embedded System Using © 2011 Pearson Higher Education,
30
Assembly and C Upper Saddle River, NJ 07458. • All Rights

You might also like