0% found this document useful (0 votes)
23 views21 pages

EEE 5a

This document describes the GPIO pins, analog pins, and specialized function pins on the Arduino Uno board. It explains how to configure pins as digital inputs or outputs and how to read from and write to pins. It also provides an overview of serial communication concepts like UART and asynchronous serial communication as well as LCD display modes and using the serial library to communicate over the serial port.

Uploaded by

Aisha Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
23 views21 pages

EEE 5a

This document describes the GPIO pins, analog pins, and specialized function pins on the Arduino Uno board. It explains how to configure pins as digital inputs or outputs and how to read from and write to pins. It also provides an overview of serial communication concepts like UART and asynchronous serial communication as well as LCD display modes and using the serial library to communicate over the serial port.

Uploaded by

Aisha Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 21

Peripheral Interface-I

Arduino Board
GPIO
• GPIO-General purpose input output.
• Arduino uno has 14 digital input/output pins and 6
analog input pins.
• Digital I/O:
• Each of the 14 pins can be used as input /output.
• They operate at 5Volts.Each pin can provide 20mA
and has internal pull-up resistor of 20-50Kohm.
Specialized function pins
• Serial:0(Rx) & 1(Tx):these pin are used to receive(Rx) and
transmit(Tx) serial data.These pins are connected to
corresponding pins of Atmega 328P.
• External interrupt: 2&3: These pins can be configured to
trigger an interrupt on a low value, rising or falling edge ,or
change in value.
• PWM:3,5,6,9,10,11 pins: These pins provide 8 bit PWM
output.
• SPI:10(SS),11(MOSI),12(MISO),13(SCK): These pins
support SPI communication using SPI library.
• LED:13: There is built in LED driven by pin 13.

• Analog inputs: The Uno has 6 inputs A0 to A5.
• Each of which provide 10 bit resolution.
• 1024 different values.
• They measure from ground to 5Volts.
• The reference voltage is changed using AREF and
analogReference() function.
Digital input and output
• Each of 14 digital pins on the Arduino can be used as input or
output, using pinMode(),digitalWrite() and digitalRead()
function.
• pinMode():Configures the specified pin to behave either as an
input or an output.
• Syntax: pinMode(pin, mode)
• Parameters:
• Pin : pin number whose mode you wish to set
• Mode : INPUT, OUTPUT, or INPUT_PULLUP.
• Example
• pinMode (11, OUTPUT); // sets the digital pin 11 as output
• digitalWrite( )
• If the pin has been configured as an OUTPUT
• digitalWrite pin writes a HIGH or a LOW value to a digital
pin.
• If the pin is configured as an INPUT-digitalWrite() will enable
or disable internal pullup on the input pin.
• If the pin is configured as OUTPUT,its voltage will be set to
5V for HIGH,0V for LOW.
• Syntax: digitalWrite( pin, value)
• Parameters:
• Pin : pin number whose value to be changed
• value : HIGH or LOW
• Example
• digitalWrite (11, HIGH)
• digitalRead()
• Reads the value from a specified digital pin, either HIGH or
LOW.
• Syntax: digitalRead(pin)
• Parameters:
• Pin : pin number whose value to be read
• Returns:High or LOW
• Example:
• byte Val = digitalRead(11)
UART Concept
• UART:-Universal Asynchronous Receiver/ Transmitter.
• It is computer hardware that transmits the data between
parallel and serial forms.
• It is the integrated circuit that are used for serial
communication that contains a receiver (Serial to parallel
converter) and transmitter (parallel to serial converter),each
clocked separately.
• The parallel side of UART is connected to the bus of computer.
• When computer writes a byte to the transmit register of
UART,the UART will start to transmit it on the serial line.
• UARTs are often used with communication standard such as
RS-232,RS-485.
• Several modern integrated circuits used device
called USART to communicate synchronously
/asynchronously.
• Applications of UART:
• GPS units
• Modems
• Wireless communication
• Bluetooth modules
Asynchronous Serial Communication
• The bits of character or data word are sent at constant
rate but bits are come at any rate as long as they don’t
overlap.
• When no character/bit is sent a line stays high at logic
‘1’called mark and logic ‘0’called space.
• The beginning of character is indicated by a start
bit which is always low. This is used to synchronize
transmitter and receiver.
• Stop bit is always high.
• Baud Rate: Transmission of data can be expressed as
bits /sec. The bits/second is called as baud rate.
LCD display
LCD Display mode
• 8 bit mode
• Uses all 8 data lines DB0-DB7
• Data transferred to LCD in byte units
• Interface requires 10 (sometimes 11) I/O pins of
microcontroller (DB0-DB7, RS, E) (sometimes R/W).
• 4-bit mode
• 4-bit (nibble) data transfer
• Each byte transfer is done in two steps: high order
nibble, then low order nibble
• Interface requires only 6 (sometimes 7) I/O pins of
• microcontroller (DB4-DB7, RS, E)
Serial Communication
• Serial Hardware:Serial hardware send and receives
data as a electrical pulses that represents sequential
bits.
• Data is carried in zeros(0s) and ones(1s) format.
• In arduino 0volts is represented by a bit value 0,and 5
volts is represented by bit value 1.
• In arduino serial communication hardware uses
digital pin 0(RX) and Digital pin 1(TX).
• Some serial devices uses RS-232 standard for serial
connection.
Serial Communication
• Serial Software:
• For serial communication arduino has built in library.
• With help of this library communication with
hardware port is possible.
• For serial communication we require: computer,USB
cable,Arduino uno,and Arduino IDE.

Serial communication
• Serial.print()
• Syntax: Serial.print(val)
Serial.print(val,format)
– Val:the value to print –any data type
– Format: specifies the number base or number of
decimal places

Ex:Serial.print(78) gives 78.


Serial.print(78,BIN) gives 1001110
Serial.print(78,OCT) gives 116
S Serial.print(78,DEC) gives 78
erial.print(78,HEX) gives 4E
• Serial.println():
• Print data to the serial port as a human readable
ASCII text and newline character.
• Serial.println(1.2356,0) gives 1.
• Serial.println(1.2356,2) gives 1.23
• Write a sketch which prints sequential
number on serial monitor
Void setup() Output: by clicking serial
monitor
{ output displayed as
follows
Serial.begin(9600); The number is
0
} The number is 1
int number=0; The number is 2
Void loop()
{
Serial.print(“The number is”);

You might also like