The document outlines various experiments and programming tasks using 8051 Assembly Language and Arduino. It includes procedures for writing assembly programs for LED blinking, data transfer between registers and memory, and basic arithmetic operations. Additionally, it provides an introduction to the Arduino platform, highlighting its accessibility, versatility, and programming environment.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
20 views18 pages
Iot Observation
The document outlines various experiments and programming tasks using 8051 Assembly Language and Arduino. It includes procedures for writing assembly programs for LED blinking, data transfer between registers and memory, and basic arithmetic operations. Additionally, it provides an introduction to the Arduino platform, highlighting its accessibility, versatility, and programming environment.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 18
—__
051 ASSEMBLY LANGUAGE
EXPERIMENTS USING SIMULATOR
[DATE ¢ fb
EXPT NO?
AIM:
‘To write 8051 Assembly Language experiments using Simulator.
PROCEDURE:
STEP 1: Initialize Port 1 as an output port.
STEP 2: Enteran infinite loop labeled as "LOOP."
STEP 3: The delay subroutine is called "DELAY."
«Initialize register R2 with the value 0xFF (255 in decimal).
+ Entera loop labeled as "DELAY_LOOP."
The program continues to loop indefinitely, creating a blinking LED effect
STEP 4:
on P1.0.
PROGRAM 1:
ORG 0x00
MOV PI, #0x00 ; Initialize Port | as output LOOP:
SETB P1.0; Turn on LED at P1.0
ACALL DELAY ; Call the delay subrouti
CLR P1.0 ; Turn off LED at PL 0 wv
ACALL DELAY ; Call the delay i
Seed i¢ delay subroutine
DELAY:
MOV R2, #0xFF DELAY_LOop:
DINZ.R2, DELAY Loop
RET ~oRu 0 (90
NOW P1, aoxon
loop:
SHB Pho:
AcaLC DELW
CLE pio}
ACALL DELI;
SAP Jpop
DELAY:
nov Pp» OXFSF
DEL Ay Loop:
DINZ RL, DELNY. L@OP
Rr
RESULT:
This program was successfully executed and output was obtained.ixrroa Tn
NO:2 | nT
DATE: DATA TRANSFER BETWEEN REGISTER
__| AND MEMORY _
AIM:
To Write a Data Transfer Between Register and Memory
PROCEDURE:
‘Transfer a value froma register to memory and then from memory back to another
register. We'll use the ‘MOV’ (move) instruction for this purpose.
STEP 1: Text Section:
We declare the program's entry point using the global main directive.
STEP 2: Main Function:
‘The main function begins.
STEP 3:Load a Value into a Register:
s'
STEP 5: Load the Value from Memory
4:Store the Value in Memory
STEP 6:Program Exitfer Between Register and Memory Example
051 Data Trans
IRG 0x0000 5 Start address
MAIN:
; Move a valu
MOV A, HOxAA ; Load the accumulator
MOV RO, A; Move the accumulator content to Register RO
MOV 0x30, RO ; Move the content of Register RO to memory location 0x30 ¢ x
ma memory location (¢.8-5 0x30) to register RI MOV A, 0x30 ;
content of memory po: ge
A CR BORN
ntent to Register RI ;
1c (¢.g., OXAA) from register RO to a memory location (e.g., 0x30)
with the value 0xAA
pos oxhh
Move a value {ro!
Load the accumulator with the
location 0x30
MOV RI, A; Move the accumulator co!
; End of the program (you can add more instructions as needed) rpyer™
; Infinite loop for the simulator SJMP MAIN
NDRESULT:
This program was successfully executed and output was obtained.ETN
Oss -
3S SREORA ALL OPERARTIONS
DATE: PERE
r
Ae
To Wintte a Peer ALU Queacens
STEP i: Dowskad af sell BS the official
(amps www.edsinS Leon).
STEP 2: Oper EuSimS I and create ¢ new file.
STEP 3: Initialization
+ Load the valué [0 into RO (First operand).
+ Load the value 5 into RI (Second operand). STEP4:
Addition Subtraction Multiplication DivisionSTEPS: Infinite
Loop:
+ Enter an infinite loop using the HERE label and the SJMP HERE
instruction. This loop keeps the program running indefinitely.PROGRAM:
; ALU Operations in 8051 Assembly for imS1ORG
0x0000
; Initialize data in RAM
MOV RO, #10 __; First operand (e.g., 10)
MOV RI, #5 ; Second operand (¢.g., 5)
; Addition Q,
ADD A,RO ;A=A+RO SL %\
; Result of addition will be stored in the Accumulator (A)
; Subtraction
MOV R2, A ; Store the result of addition in R2
. SUBB A, RI ; A= R2 (Result of addition) - R1
; Result of subtraction will be stored in the Accumulator (A)
; Multiplication
MOV R2, A ; Store the result of subtraction in R2
MUL AB ; Multiply A by B (R2), Result will be in ACC (A,lower
byte) and B (higher ‘byte)
; Result of multiplication will be stored in the Accumulator (A)
; Division
MOV R2, A ; Store the result of multiplication in R2
DIV AB ; Divide ACC (A) by B (R2), Quotient will be in ACC(A),
Remainder in B
; Result of division will be stored in the Accumulator (A) and B
- (Remainder)
\
LACKS
« Infinite loop to hold the program - ae 4
HERE: A Lerdns
SIMP IIBRE wv S\
a a |
cx / gi oeRESULT:
This program was successfully executed and output was obtained.“A*EENO:4
|b, | WRITE BASIC AND ARITH)y
ATE: PROGRAM USING EMBEDp i
Ie
ED
AIM:
To write basic and arithmetic Program using embedded c.
BASIC PROGRAM:
Blinking LED
OBJECTIVE:
To blink an LED connected to a micro controller pin.
ALGORITHM:
STEP 1 : Include necessary header files
STEP 2: Define the LED pin
STEP 3: Start the main function
STEP 4 : Configure the LED pin as an output STEP
5: Enter an infinite loop with while(1) STEP 6 :
Create a delay
STEP 7: Repeat the LED toggle and delay
STEP 8: Exit the main functionOUTPUT:
Hinclude
Hinclude
Idefine LED_PIN PBOint
* main(void) {
// Set the LED pin as outputDDRB |=
(1 << LED_PIN);
while (1) {
1/ Toggle the LED pin PORTB
A= (1 << LED_PIN);
// Delay for a period of time
_delay_ms(500);
}
return 0;
3
INITIALLY LIGHT IS OFF..STEP 1:
STEP 2:
STEP 3:
STEP 4:
5:
STEP 6:
STEP 7:
STEP 8:
PROGRAM:
LIGHT IS GLOWING AFTER THE EXECUTING OF THE
PROGRAM.
ARITHMETIC PROGRAM:
Addition of Two Numbers
Objective: To add two numbers and display the result.
ALGORITHM :
Include the necessary header file
Start the main function
Declare variables
Read the first number from the user STEP
Read the second number from the user
Perform the addition
Display the result
Exit the main functionPROGRAM:
include
int main() {
int num], num2, sum;
// Read two numbers from the user
print{("Enter the Ist no: ");
scan{("%d", &num1);
printf("Enter the 2nd no: ");
scan{{"%d", &num2);
// Perform the addition
sum = num] + num2;
// Display the result
printf(num1+"+"+num2+"=")
printf(‘“press * to reset”)
return 0;RESULT:
‘as obtained.
cessfully executed and output wi
This program was su
fogee | INTRODUCTION TO ARDUINO
aa : | PLATFORM AND PROGRAMMING
AL
A study of introduction to Arduino Platform and programming,
INTRODUCTION:
Arduino is an open-source electronics platform that has gained immense
popularity among beginners, students, hobbyists, and professionals for its simplicity
and versatility. This introduction provides anoverview of the Arduino platform and its
programming aspects:
What is Arduino?
Arduino is a versatile microcontroller-based hardware and softwareplatform
that énables users to create interactive and programmable electronic projects. It
consists of two main components:
Hardware: Arduino boards are the physical computing devices at the coreof the
platform. They come in various shapes and sizes but share common elements,
including a microcontroller, digital and analog input/output pins,power supply, and
s 5
communication interfaces.vare: The Arduii
ee 7 "duino Integrated Development Environment (IDE) is @ user-
i rogrammin, i
fiend “ “i : 'g environment for writing, compiling, and uploading code to
Arduino boards. It uses a simplified version of the C andC++ programming
Janguages.
+
Why Use Arduino?
Here are some key reasons why Arduino has become so popular:
Accessibility: Arduino is designed to be easy for beginners to start working with
electronics and programming. It lowers the entry barrier for those newto the field.
Open Source: Arduino's hardware and software are open source, meaningthe designs
users and
and source code are freely available. This encourages a vibrantcommunity of
‘
developers who share their knowledge and contribute to its growth.
Versatility: Arduino is not liinited to any specific application. It can be used fora
wide range of projects, including robotics, home automation, artinstallations, and
scientific experiments.
Abundance of Resources: There is a wealth of online resources, tutorials,and libraries
available to help users get started and solve problems they encounter.
‘OX, -
Pansion Capability: Arduino can be eis
Additional boards that providle extra functionality. These shicldscan be stacked on ig,
Of the ii
the Arduino board.
T .
he Arduino Programming Environment
Arduino programming is done in the Arduino IDE, which provides asimple
and straightforward way to write code for your projects. Here are some key aspects
ofthe Arduino programming environment:
Sketch: In Arduino, a program is called a "sketch." A sketch typically consists of
two essential functions: sctup() (for initialization) and loop()(for continuous
execution),
Libraries: Arduino libraries are pre-written code packages that simplify working wii
external components like sensors and displays. Many librariesare available for variot
purposes.
Upload: Once you've written your code, you can upload it to the Arduino board via
USB connection. The Arduino IDE handles the compilation anduploading process fo!
you.
Conclusion
* Arduino is a powerful and accessible platform for learning about electronics an
programming. It allows you to turn your creative ideas intotangible projects, whether
you're a student learning the basics or an experienced engincer building advanced
systems. This introduction sets thestage for exploring Arduino further and getting
hands-on experience with this remarkable platform.RESULT:
0} vi ly a was obtained.
et Itput was ob
i s successfully executed and outp’
Is program W a id