Вы находитесь на странице: 1из 4

Lab Report#4

Serial Communication With Atmega328p/Arduino Uno And Testing


With Hyperterminal
Objective:
How to create project on protious.
How to control Arduino and get output

Tools:
Arduino IDE, Proteousetc

Apparatus:
Arduino IDE, Proteus,Resistor, LED

Theory:
Introduction:
Serial communication works on 1s and 0s. Also known as binary, the Arduino
sends these 1s and 0s (bits) one by one, or Serially. These bits are sent in the
form of Highs(1) and Lows(0). These bits form together and turn into bytes. A
byte
is
composed
of
8
bits.
Each bit represents a certain number to add. the first bit (Far right)
represents
the
ones
place,
1 = 1 and 0 = 0. Serial is used for communication between the Arduino
board and a computer or other devices. All Arduino boards have at least one
serial port (also known as a UART or USART): Serial. It communicates on
digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if
you use these functions, you cannot also use pins 0 and 1 for digital input or
output.

Procedure:

Write Arduino Codes on Arduino Software IDE.

Build .hex file from Arduino Software.


Now click Compile button. Compilation yields .hex file
created.

I turn the Proteus as a Simulator for Arduino with the help


of Arduino Proteus library files.
Draw the required schematic diagram of Proteus that you
would like to Simulate, you can choose the Arduino board
from the menu.
Then attach the resister and LED with proteus and also
attach ground.
To load .hex file to the Arduino board, just double click on
the board and browse the .hex file in the Program File
section.

Lab Task:
Serial Communication With Atmega328p/Arduino Uno And Testing With Hyperterminal

Screen Shoots:

Programe: (1)
char pick;
void setup() {
//put your main code here,to run once;
Serial.begin(9600);
}
void loop() {
//put your main code here,to run repeatedly;
if(Serial.available())
{
pick -Serial.read();

Serial.println("TUFIANS");
delay(1000);
Serial.write(pick);
}
}

(2)
int byteread;
void setup() {
//put your main code here,to run once;
Serial.begin(9600);
pinMode(13,OUTPUT);
}
void loop() {
//put your main code here,to run repeatedly;
if(Serial.available()>0)
{
byteread=Serial.read();
if(byteread='1')
{
digitalWrite(13,HIGH);
Serial.println("LED is on");
}
else if (byteread='0')
{
digitalWrite(13,LOW);
Serial.println("LED is OFF");
}
}
}
(3)
void setup() {
//put your main code here,to run once;
Serial.begin(9600);
}
void loop() {
//put your main code here,to run repeatedly;
Serial.write("ELECTRONICS");
delay(1000);
}

Result:

We can use the Arduino environment's built-in serial monitor to communicate


with an Arduino board. Click the serial monitor button in the toolbar. It
communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer
via USB.We use them to communicate with an external TTL serial device,
connect the TX pin to your device's RX pin, the RX to your device's TX pin,
and the ground of your Mega to your device's ground.

Вам также может понравиться