This document discusses various arithmetic and logic operations that can be performed on the 8051 microcontroller including signed and unsigned operations, binary and BCD arithmetic, addition, subtraction, multiplication, division, logic operations, rotate and swap operations, and single bit instructions. It provides examples of how to perform operations like addition, subtraction, multiplication and division on 8051 in both binary and BCD formats. It also explains concepts related to signed arithmetic like representation of negative numbers, usage of overflow flag, and how to perform signed arithmetic operations.
Logical instruction of 8085
Instruction Set of 8085
Classification of Instruction Set
Logical Instructions
AND, OR, XOR
Logical Instructions
Summary Logical Group
Logical instruction of 8085
Instruction Set of 8085
Classification of Instruction Set
Logical Instructions
AND, OR, XOR
Logical Instructions
Summary Logical Group
7.1 Data types and time delay in 8051 C
7.2 I/O programming in 8051 C
7.3 Logic operations in 8051 C
7.4 Data conversion programs in 8051 C
7.5 Accessing code ROM space in 8051 C
7.6 Data serialization using 8051 C
Lecture 03 Arithmetic Group of InstructionsZeeshan Ahmed
Course on Microprocessor Theory and Interfacing. This is 4th lecture on 8085 microprocessor which include arithmetic instructions like add, subtract, BCD addition in detail.
Intel 8085 is an 8-bit microprocessor. It handles 8-bit data at a time. One byte consists of 8-bits.A memory location for Intel 8085 microprocessor is designed to accumulate 8-bit data. If 16-bit data are to be stored, they are stored in consecutive memory locations. The address of memory location is 0f 16-bit i.e. 2 bytes. In this slide we have discussed about the various instructions set of INTEL 8085 micrpoprocessor.
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSveerababupersonal22
It consists of cw radar and fmcw radar ,range measurement,if amplifier and fmcw altimeterThe CW radar operates using continuous wave transmission, while the FMCW radar employs frequency-modulated continuous wave technology. Range measurement is a crucial aspect of radar systems, providing information about the distance to a target. The IF amplifier plays a key role in signal processing, amplifying intermediate frequency signals for further analysis. The FMCW altimeter utilizes frequency-modulated continuous wave technology to accurately measure altitude above a reference point.
6th International Conference on Machine Learning & Applications (CMLA 2024)ClaraZara1
6th International Conference on Machine Learning & Applications (CMLA 2024) will provide an excellent international forum for sharing knowledge and results in theory, methodology and applications of on Machine Learning & Applications.
The Internet of Things (IoT) is a revolutionary concept that connects everyday objects and devices to the internet, enabling them to communicate, collect, and exchange data. Imagine a world where your refrigerator notifies you when you’re running low on groceries, or streetlights adjust their brightness based on traffic patterns – that’s the power of IoT. In essence, IoT transforms ordinary objects into smart, interconnected devices, creating a network of endless possibilities.
Here is a blog on the role of electrical and electronics engineers in IOT. Let's dig in!!!!
For more such content visit: https://nttftrg.com/
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
We have compiled the most important slides from each speaker's presentation. This year’s compilation, available for free, captures the key insights and contributions shared during the DfMAy 2024 conference.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Water billing management system project report.pdfKamal Acharya
Our project entitled “Water Billing Management System” aims is to generate Water bill with all the charges and penalty. Manual system that is employed is extremely laborious and quite inadequate. It only makes the process more difficult and hard.
The aim of our project is to develop a system that is meant to partially computerize the work performed in the Water Board like generating monthly Water bill, record of consuming unit of water, store record of the customer and previous unpaid record.
We used HTML/PHP as front end and MYSQL as back end for developing our project. HTML is primarily a visual design environment. We can create a android application by designing the form and that make up the user interface. Adding android application code to the form and the objects such as buttons and text boxes on them and adding any required support code in additional modular.
MySQL is free open source database that facilitates the effective management of the databases by connecting them to the software. It is a stable ,reliable and the powerful solution with the advanced features and advantages which are as follows: Data Security.MySQL is free open source database that facilitates the effective management of the databases by connecting them to the software.
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesChristina Lin
Traditionally, dealing with real-time data pipelines has involved significant overhead, even for straightforward tasks like data transformation or masking. However, in this talk, we’ll venture into the dynamic realm of WebAssembly (WASM) and discover how it can revolutionize the creation of stateless streaming pipelines within a Kafka (Redpanda) broker. These pipelines are adept at managing low-latency, high-data-volume scenarios.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Recycled Concrete Aggregate in Construction Part III
Class4
1. Pari vallal Kannan
Center for Integrated Circuits and Systems
University of Texas at Dallas
8051 Programming: Arithmetic
and Logic
EE4380 Fall 2002
Class 4
2. 5-Sep-02 2
Topics
l Signed and Unsigned arithmetic
l Binary and BCD coded numbers
l Addition Instructions
l Subtraction
l Multiplication
l Division
l Logic Operations
l Rotate and Swap operations
l Bit addressable memory and single bit instructions
3. 5-Sep-02 3
Unsigned Addition
l add a, source ; A = A + source
l Carry (if any) will be in CY flag
mov A, #0F5H
add A, #0BH ; A = F5 + B0 = 00, CY=1
l 16 bit addition
– addc A, source ; A = A + source + CY
– Add the lower bytes using add
– Save the result
– Add the upper bytes using addc
4. 5-Sep-02 4
Unsigned Addition (contd.)
l Example of 16 bit addition
l Add UUVV and PPQQ
clr C
mov A, QQ
add A, VV
mov r6, A
mov A, PP
addc A, UU
mov r7, A
l Final 16 bit result in r7:r6 and CY flag
5. 5-Sep-02 5
BCD Addition
l BCD – Binary Coded Decimal
– 4 bits are used to represent a decimal number from 0-9
l Packed BCD has two such numbers in one byte
– 17 PBCD = 17decimal = 11hex
l Packed BCD addition may not yield a valid BCD. Use
decimal adjust instruction (da A) for correcting it
l After adding two Packed BCD numbers call da to get
valid PBCD
mov A, #47H ; first BCD = 47d
mov B, #25H ; second BCD = 25d
add A,B ; A = 6CH (binary addition of 47H and 25H)
da A ; A = 72H (BCD result of addition)
6. 5-Sep-02 6
BCD Addition (contd.)
l To correct an invalid BCD, add 6 to the digit
that is greater than 9
l What da does
– If lower nibble is > 9 or AC=1 then add 6 (0110) to
the lower nibble
– If upper nibble is > 9 or CY=1 then add 6 to the
upper nibble
l da will work for ADD only. For other operations
(inc, sub etc), this correction has to be done
manually
7. 5-Sep-02 7
Unsigned Subtraction
l subb x, y ; x = x-y with borrow from CY
l Operation:
– Take 2’s complement of the subtrahend (y)
– Add it to the minuend (x)
– If the CY flag is set after the subb operation, then
the result is negative and the destination has the 2’s
complement of the result
l subb performs subtract with borrow, if CY is set
before the call. Used for 16bit subtraction
– To get plain sub, clear CY before calling subb
8. 5-Sep-02 8
Unsigned Subtraction (contd.)
l Example
clr c ; clear CY for sub operation
mov A, #4CH ;
subb A, #6EH ; two operands, do 4C – 6E
jnc done ; if CY==0 result is positive
cpl A ; CY=1, result negative. So find 2’s complement
inc A ; by complementing A and adding 1 to it
done: mov R1, A ; final result in R1
l 16 bit subtraction 2762H – 1296H
clr C ; clear Cy
mov A, #62H ;
subb A, #96H ; 62H – 96H = CCH and CY=1
mov R7, A ; store the lower byte of the result in R7
mov A, #27H ; now subtract the upper bytes
subb A, #12H ; 27H – 12H – 1 = 14H
mov R6, A ; store upper byte of result in R6.
; Final 16bit result is in R6:R7
9. 5-Sep-02 9
Multiplication and Division
l MUL AB ; A x B, place result in BA
mov A, #25H ; operand1: 25H
mov B, #65H ; operand2: 65H
mul AB ; 25H * 65H = E99H
; B = 0EH, A = 99H
l DIV AB ; A/B, place quotient in A and
remainder in B
mov A, #95H
mov B, #10
div AB ; A = 9 (quotient), B = 5 (remainder)
10. 5-Sep-02 10
Signed Arithmetic - Concepts
l Representation of the sign
– Allocate one bit of all numeric quantities for the sign
– Usually MSB (most significant bit) is assigned for
the sign
– The remaining bits represent the magnitude
l 8051 has only 8-bit registers
– Signed numbers can have only a 7 bit magnitude
– Positive numbers in 8051 = 0 to +127 (7 bits)
– Negative numbers -128 to –1
– Why ?
11. 5-Sep-02 11
Signed Arith. – Negative Numbers
l Negative Number representation in signed
arithmetic
– The sign bit (MSB) is 1
– Magnitude is in 2’s complement form
l Examples
Represent –5
5 = 0000 0101
Cpl = 1111 1010
+1 = 1111 1011
Hex = FBH
Hence –5 = FBh
Represent –34H
34H = 0011 0100
Cpl = 1100 1011
+1 = 1100 1100
Hex = CCH
Hence –34H = CCH
Represent –128
128 = 1000 0000
Cpl = 0111 1111
+1 = 1000 0000
Hex = 80H
Hence –128 = 80H
Range
-128 = 80H
-127 = 81H
…..
-1 = FFH
0 = 00H
1 = 01H
+127 = 7FH
12. 5-Sep-02 12
Signed Numbers - Usage
l Application may require a specific quantity be
represented as a signed number
– Temperature measurement –20deg, +10deg etc
– Water/Gas/Beer level measurement in a tank
l Data is collected and stored as an array of signed
numbers
– Some of the array elements can be negative, while others are
positive
– Identify negative numbers by the MSB. If MSB=1, the number
is negative
l Same arithmetic operations (add, sub, mul, div etc)
may need to be performed on the array elements, and
the result can be positive or negative.
13. 5-Sep-02 13
8051 – Signed Arithmetic
l 8051 uses negative number representation in
the sub instruction. Not enough!
l When signed numbers are needed,
programmer has to take care of signed
arithmetic
l Overflow has to be dealt with. Carry flag is not
enough, because only 7 bits carry the
magnitude in signed numbers
l The 8051 provides another flag – OV
(Overflow) for this purpose.
14. 5-Sep-02 14
8051 - Signed Arithmetic (contd.)
l Addition A+B A = 01H, B = FFH
A = +1, B = -1
A = 0000 0001
B = 1111 1111
+ = 1 0000 0000
A+B = 0H
A+B A = FEH, B = FFH
A = -2, B = -1
A = 1111 1110
B = 1111 1111
+ = 1 1111 1101
A+B = FDH = -3
A-B A = 01H, B = FFH
A = +1, B = -1
2’s(B) = 0000 0000 +1 = 0000 0001
A = 0000 0001
2’s(B) = 0000 0001
+ = 0 0000 0010
A-B = 02H
A-B A = FEH, B = 01H
A = -2, B = +1
2’s(B) = 1111 1110 +1 = 1111 1111
A = 1111 1110
2’s(B) = 1111 1111
+ = 1 1111 1101
A-B = FDH = -3
l Subtraction
15. 5-Sep-02 15
8051 Signed Arith. - Overflow
l Overflow can occur from
the magnitudes of the
signed numbers, which
can change the sign bit.
l OV Flag is to be
checked for error in
signed arithmetic
l Example
A+B, A=+96 (60H), B=+70(46H)
A = 0110 0000
B = 0100 0110
+ = 1010 0110 = A6H = -90 (wrong)
OV = 1, CY=0
96+70 = 166 > +127
16. 5-Sep-02 16
8051 – OV Flag
l After arithmetic operations, OV is set if
– Carry from D6 to D7 but no carry from D7
– Carry from D7 but no carry from D6 to D7
– These cases indicate a wrong result due to signed
arithmetic
l After arithmetic operation involving signed
numbers, check OV flag, for error detection
– Use jb PSW.2 or jnb PSW.2
– PSW.2 = OV
17. 5-Sep-02 17
8051 Logic Instructions
l AND
– anl dest, source ; dest = dest AND source
– Commonly used to mask out (set to 0) a few bits in an operand
l OR
– orl dest, source ; dest = dest OR source
– Commonly used to set a few bits in an operand
l XOR
– xrl dest, source ; dest = dest XOR source
– Commonly used to clear a register, check if two registers have
the same value and toggle a few bits
l Complement
– cpl A ; A = A’
l None of these instructions affect any flags
18. 5-Sep-02 18
8051 – Compare Instruction
l CJNE
– Cjne dest, source, rel address
– Compare dest and source and jump to relative address if not
equal
– Basically a subtract operation which does not change the
operands but affects the CY flag
– dest > source è CY=0
– dest < source è CY=1
l Example
– Monitor P1 continuosly and
– exit if P1=63H
Loop: mov A, P1
cjne A, #63, loop
Cmp: cjne R5, #80, NEQ
EQ: …. ;R5= #80
NEQ: jnc GREAT
LESS: … ;R5< #80
GREAT: …. ;R5 > #80
19. 5-Sep-02 19
8051 – Rotate and Swap
l Bitwise rotation is required in many apps like serial
comm., control etc.
l Rotate right
– rr A ; rotate right A
l Rotate left
– rl A ; rotate left A
l Rotate right/left with Carry
– Use CY in the rotate sequence (9 bit rotate)
– rlc A : D7 à CY àD0
– rrc A: D0 à CY à D7
l Swap nibbles
– swap A ; swaps D7-D4 with D3-D0
Example for RR
mov A, #AAH
rr A ; now A = 55H
rr A ; now A = 2AH
Example for RL
mov A, #55H
rl A ; now A = AAH
rl A ; now A = 54H
20. 5-Sep-02 20
8051 – Single Bit Instructions
l Set a bit
– set bit_name ;bit = 1
l Clear a bit
– clr bit_name ;bit = 0
l Complement a bit
– cpl bit_name ;bit = bit’
l Conditional Jump on bit value
– jb (jump if bit=1), jnb (jump if bit=0), jbc (jump if
bit=1 and clear the bit)
21. 5-Sep-02 21
Bit addressable Regs and Memory
l I/O ports (P0 – P3), B, PSW, IP, IE, ACC, SCON and
TCON are bit addressable registers (BARs)
l The bits of BARs can be referred to as Register.bitnum
(P0.1, PSW.2, IE.4 etc) or by their bit address
l Bit address is the base address of the register + the bit
number
– ACC Base address is E0H, hence ACC.1=E1H, ACC.7=E7H
– P0, Base address is 80H, hence P0.0=80H, P0.5=84H and so
on
l 16 bytes of the internal RAM is bit addressable
– 20H to 2FH has a bit address of 00H to 7FH
– clr 67H ; clear bit D7H of RAM location 2CH
– setb 05H ; set bit 5 of RAM location 20H
22. 5-Sep-02 22
Single Bit Operations with CY flag
l 8051 has special instructions that directly
manipulate CY flag
– setb C; clr C; cpl C; mov b,C; mov C,b; jnc, jc, anl
C,b; anl C,/b; orl C,b; orl C,/b
– anl C, /b ;C = CY AND b’
l Example: Turn ON fan (P2.2) and turn OFF
light (P2.3) Fan_on: setb C
orl C,P2.2 ;CY = CY OR P2.2
mov P2.2, C;turn on fan if not already ON
Light_off: clr C
anl C,P2.3 ;CY = CY AND P2.3
mov P2.3,C ;turn off light if not already OFF
23. 5-Sep-02 23
Class-4: Review
l Signed and Unsigned arithmetic
l Binary and BCD coded numbers
l Addition, Subtraction, Multiplication, Division
l Signed Number representation and arithmetic
l Logic Operations
l Rotate and Swap operations
l Bit addressable memory and single bit
instructions