Io Ports - Communication

Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

IO Port Types

Types of parallel ports


• Parallel one bit Input/output
• Parallel Port multi-bit Input
• Parallel Port multi-bit Output

Types of Serial ports

• Synchronous Serial Input


• Synchronous Serial Output
• Asynchronous Serial UART input
• Asynchronous Serial UART output (both as input
and as output, for ex: modem.)
• Parallel Port single bit input
• Completion of a revolution of a wheel
• Achieving pre-set pressure in a boiler
• Exceeding the upper limit of permitted weight
over the pan of an electronic balance

Parallel Port Output- single bit


• PWM output for a DAC, which controls liquid
level, or temperature, or pressure, or speed or
a DC motor control
int motor=9;
int duty_cycle=0;
void setup()
{
pinMode(motor, OUTPUT);
}

void loop()
{
if (duty_cycle<=255)
{
analogWrite(motor, duty_cycle);

delay(3000);
duty_cycle++;
}
}
• Parallel Port Input- multi-bit
ADC input from liquid level measuring sensor or
temperature sensor or pressure sensor Encoder inputs
for bits for angular position of a rotating shaft or a
linear displacement of an object.
Parallel Port Output- multi-bit
• LCD controller - display on the screen the
phone number, time, messages, character
outputs
• Stepper-motor coil driving bits

Parallel Port Input-Output


• PPI 8255
• Touch screen in mobile phone
Types of Serial ports

• Synchronous Serial Input


• Synchronous Serial Output
• Asynchronous Serial UART input
• Asynchronous Serial UART output (both as
input and as output, for ex: modem.)
Synchronous Serial Input / Output
• The sender along with the serial bits also sends the clock pulses SCLK (serial
clock) to the receiver port pin.
• The port synchronizes the serial data input bits with clock bits.
• Each bit in each byte as well as each byte in synchronization
• Synchronization means separation by a constant interval or phase difference.
• If clock period = T, then each byte at the port is received at input in period = 8T.
• The bytes are received at constant rates.
• data transfer rate or the serial line bits is (1/T) bps. [1bps = 1 bit per s]
• When a separate SCLK input is sent, the receiver detects at the middle or+ ve
edge or –ve edge of the clock pulses that whether the data-input is 1 or 0 saves
the bits in an 8-bit shift register
• MOSI when the SCLK is sent from the sender (Master) to the receiver and slave
is forced to synchronize sent inputs from the master as per the inputs from
master clock.
• MISO when the SCLK is sent to the sender (slave) from the receiver (master) and
slave is forced to synchronize for sending the inputs to master as per the master
clock outputs
• Each bit in each byte is in synchronization at input and each bit in each byte is in
synchronization at output with the master clock output.

• The bytes are sent or received at constant rates.


• The I/Os can also be on same I/O line when input/output clock pulses either
suitably modulate or encode the serial input/output,respectively.

• The processing element at the port (peripheral)sends and receives the byte at a
port register to or from where the microprocessor writes or reads the byte
UART
UART
• Does not receive the clock pulses or clock
information along with the bits.
• Each bit is received in each byte at fixed
intervals but each received byte is not in
synchronization.
• Bytes separate by the variable intervals or
phase differences.
• Minimum separation is 1 stop bit interval TxD.
1 Start bit Interval RXD
 The control signals are implemented mainly for modem
communication and some of them may be irrelevant for
other type of devices.
 The Request to Send (RTS) and Clear To Send (CTS) signals
co-ordinate the communication between DTE and DCE.
 Whenever the DTE has a data to send, it activates the RTS
line and if the DCE is ready to accept the data, it activates
the CTS line.
 The Data Terminal Ready (DTR) signal is activated by DTE
when it is ready to accept data.
 The Data Set Ready (DSR) is activated by DCE when it is
ready for establishing a communication link.
 DTR should be in the activated state before the activation
of DSR.
 The Data Carrier Detect (DCD) is used by the DCE to
indicate the DTE that a good signal is being received.
Communication Interface
The communication interface can be viewed in
two different perspectives

• 1. Device/board level communication


interface (Onboard Communication Interface)

• 2. Product level communication interface


(External Communication Interface)
I2C (Inter Integrated Circuit) Bus:
• Inter Integrated Circuit Bus (I2C - I square C) is a
synchronous bi-directional half duplex (one-
directional communication at a given point of
time) two wire serial interface bus.

• The concept of I2C bus was developed by Philips


Semiconductors in the early 1980s. The original
intention of I2C was to provide an easy way of
connection between a microprocessor / microcontroller
system and the peripheral chips in Television sets.

• The I2C bus is comprised of two bus lines


Serial Clock – SCL and Serial Data – SDA
Serial Peripheral Interface (SPI) Bus:

• The Serial Peripheral Interface Bus (SPI) is a synchronous bi-


directional full duplex four wire serial interface bus.
• The concept of SPI is introduced by Motorola.
• SPI is a single master multi- slave system.
• It is possible to have a system where more than one SPI device can
be master, provided the condition only one master device is active
at any given point of time, is satisfied.
• SPI is used to send data between Microcontrollers and small
peripherals such as shift registers, sensors, and SD cards.

SPI requires four signal lines for communication. They are:


• Master Out Slave In (MOSI): Signal line carrying the data from
master to slave device. It is also known as Slave Input/Slave Data In
(SI/SDI)
• Master In Slave Out (MISO): Signal line carrying the data from slave
to master device. It is also known as Slave Output (SO/SDO)
• Serial Clock (SCLK): Signal line carrying the clock signals
• Slave Select (SS): Signal line for slave device select. It is an active
low signal.
1-wire interface (protocol)

• 1- Wire is a device communications bus system designed by Dallas


Semiconductor Corp. that provides low-speed data, signaling, and power
over a single conductor.
• 1-Wire is similar in concept to I²C, but with lower data rates and longer
range.
• It is typically used to communicate with small inexpensive devices such as
digital thermometers and weather instruments.
• One distinctive feature of the bus is the possibility of using only two wires:
data and ground.
• To accomplish this, 1-Wire devices include an 800 pF capacitor to store
charge, and to power the device during periods when the data line is active
RS-232C
• RS-232 C (Recommended Standard number 232, revision C from the
Electronic Industry Association) is a legacy, full duplex, wired, asynchronous
serial communication interface
• RS-232 extends the UART communication signals for external data
communication.
• UART uses the standard TTL/CMOS logic (Logic „High‟ corresponds to bit
value 1 and Logic „LOW‟ corresponds to bit value 0) for bit transmission
whereas RS232 use the EIA standard for bit transmission.

• As per EIA standard, a logic „0‟ is represented with voltage between +3 and
+25V and a logic „1‟ is represented with voltage between -3 and -25V.
• In EIA standard, logic „0‟ is known as “Space‟ and logic „1‟ as “Mark‟.

• The RS232 interface define various handshaking and control signals for
communication apart from the „Transmit‟ and „Receive‟ signal lines for
data communication

• RS-232 supports two different types of connectors, namely;


DB-9: 9-Pin connector and
DB-25: 25-Pin connector
Universal Serial Bus (USB)
• Serial transmission and reception between host and
serial devices
• A bus between the host system and interconnected
number of peripheral devices
• Maximum 127 devices can connect a host.
Three standards:
• USB 1.1 (a low speed1.5 Mbps 3 meter channel along
with a high speed 12 Mbps 25 meter channel),
• USB 2.0 (high speed 480 Mbps 25meter channel), and
wireless USB(high speed 480 Mbps 3 m)
• USB HOST: Device that controls
entire system usually a PC of some
form. Processes data arriving to and
from the USB port.

• USB HUB: Tests for new devices and


maintains status information of child
devices.
• Serve as repeaters, boosting
strength of up and downstream
signals. Electrically isolates devices
from one another - allowing an
expanded number of devices.
IEEE 1394 (Firewire)
• IEEE 1394 (Firewire) is a wired, isochronous high speed serial
communication bus. It is also known as High Performance Serial Bus
(HPSB).

• 1394 is a popular communication interface for connecting embedded


devices like Digital Camera, Camcorder, Scanners to desktop computers
for data transfer and storage.

• Unlike USB interface, IEEE 1394 doesn‟t require a host for


communicating between devices.
• For example, you can directly connect a scanner with a printer for
printing.
• The data rate supported by 1394 is far higher than the one supported
by USB 2.0 interface. The 1394 hardware implementation is much
costlier than USB implementation.
Wireless communication interface : Wireless
communication interface is an interface used to
transmission of information over a distance
without help of wires, cables or any other forms of
electrical conductors.
They are basically classified into following types
• 1. Infrared
• 2. Bluetooth
• 3. Wi-Fi
• 4. Zigbee
• 5. GPRS
INFRARED:
• Infrared (IrDA) is a serial, half duplex, line of sight based wireless
technology for data communication between devices.
• It is in use from the olden days of communication and you may be
very familiar with it.
• The remote control of your TV, VCD player, etc works on Infrared
data communication principle

• Infrared is a certain region in the light spectrum


• Ranges from .7μ to 1000μ or .1mm
BLUETOOTH
• Bluetooth is a wireless technology standard for short distances (using short-
wavelength UHF band from 2.4 to 2.485 GHz)for exchanging data over radio
waves and mobile devices, and building personal area networks (PANs).

• Bluetooth is a low cost, low power, short range wireless technology for data
and voice communication.
• Bluetooth supports point-to-point (device to device) and point-to-multipoint
(device to multiple device broadcasting) wireless communication.

• Invented by telecom vendor Ericsson in 1994,


• it was originally conceived as a wireless alternative to RS- 232 data cables .

• one Bluetooth device as master and more than one device as slaves, it is
called a Piconet.
• A Piconet supports a maximum of seven slave devices.

• Each channel has a bandwidth of 1 MHz.

• It supports a data rate of up to 1 Mbps and a range of approximately 30 feet


for data communication
Wi-Fi
• Wi-Fi or Wireless Fidelity is the popular wireless communication technique for
networked communication of devices.
• Wi-Fi is intended for network communication and it supports Internet Protocol
(IP) based communication.

• Wi-Fi follows the IEEE 802.11a to IEEE 802.11g standard


• Wi-Fi operates at 2.4GHZ or 5GHZ of radio spectrum and they co-exist with
other ISM band devices like Bluetooth

• Wi-Fi based communications require an intermediate agent called Wi-Fi


router/Wireless access point to manage the communications.
• Wi-Fi supports data rates ranging from 1 Mbps to 300Mbps and offers a range
of 100 to 300 feet.
• Wi-Fi enabled devices contain a wireless adaptor for transmitting and receiving
data in the form of radio signals through an antenna.

• A Wi-Fi network is identified with a Service Set Identifier (SSID). A Wi-Fi device
can connect to a network by selecting the SSID of the network and by providing
the credentials if the network is security enabled.
Real Time Clock
• A real-time clock (RTC) is a computer clock, usually in the form of
an integrated circuit that is solely built for keeping time.
• Real tome clock is a clock that occurrences of regular interval
interrupts on each tick.
• An Interrupt Service Routine Executes on each time out(overflow)
of this clock.
• This Timing Device once Started never Resets or never reloaded
with another value.
• Once it is set, It is not modified Later
• They usually interface to a microprocessor circuit by an SPI or I2C
serial bus.
• An RTC maintains its clock by counting the cycles of an oscillator –
usually an external 32.768kHz crystal oscillator circuit, an internal
capacitor based oscillator
WatchDog Timer
• Watch Dog Timer is Hardware Timer for monitoring Firmware
Execution.
• If the firmware execution does not complete due to malfunctioning
within the time required by watch dog to reach the maximum
count.
• The counter will generate the reset pulse, it will reset the processor.
• If the Firmware execution completes before expiration of watchdog
timer, you can resetting the counter by writing ‘0’.
Example:
• Assume that we anticipate that a set of tasks must finish in
100ms interval.
• The Watchdog timer disabled and stopped by the program
instruction in case the tasks finish within 100ms interval
• If task does not finish, Watchdog timer generated interrupts
after 100ms and executes a routine.

Application -1:
Mobile phone display is OFF in case of NO GUI interaction
takes place within a watched time interval.
i.e; 10 Sec, 15 Sec..30 Sec. It saves Power
Application – 2:
• An application in temperature controller is that if
controller No action to switch off the current within the
preset watched Interval
• The Current is switched off and warning signal raised as
indication of controller failure.
• Failure to switch off current may burst a boiler in which
water is heated

• A software task can also


be programmed as a watchdog
timer
• Microcontroller may also provide for watchdog timer

You might also like