0% found this document useful (0 votes)
12 views11 pages

A Data Type Is - Understanding Data Types Ensures That Data Is Collected in The Preferred Format and The Value of Each Property Is As Expected

Uploaded by

HARSH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views11 pages

A Data Type Is - Understanding Data Types Ensures That Data Is Collected in The Preferred Format and The Value of Each Property Is As Expected

Uploaded by

HARSH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

A data type is an attribute associated with a piece of data that tells a computer system how

to interpret its value. Understanding data types ensures that data is collected in the preferred
format and the value of each property is as expected.
Special Function registers
The SFRs are the gateway to interaction between the CPU and the peripherals,
and we will get to know them very well. To the CPU, an SFR acts more or less
like a normal memory location – you can usually write to it or read from it. What
makes it ‘special’ is that the bits of that memory location have a dual purpose.
Each bit is wired across to one or other of the microcontroller peripherals. Each
is then used either to set up the operating mode of the peripheral or to transfer
data between the peripheral and the microcontroller core

An interrupt is a signal emitted by a device attached to a computer or from a program within


the computer. It requires the operating system (OS) to stop and figure out what to do next.
An interrupt temporarily stops or terminates a service or a current process. Most I/O devices
have a bus control line called Interrupt Service Routine (ISR) for this purpose.An interrupt
signal might be planned (i.e., specifically requested by a program) or it may be unplanned
(i.e., caused by an event that may not be related to a program that's currently running on the
system).Today, almost all computing systems are interrupt-driven.

RAM stands for random access memory, and it’s one of the most fundamental
elements of computing. RAM is a temporary memory bank where your computer
stores data it needs to retrieve quickly. RAM keeps data easily accessible so your
processor can quickly find it without having to go into long-term storage to
complete immediate processing tasks. RAM is a form of temporary storage that
gets wiped when you turn your computer off. RAM offers lightning-fast data
access, which makes it ideal for the processes, apps, and programs your
computer is actively working on, such as the data needed to surf the internet
through your web browser.

8051 microcontrollers mainly contain two types of registers:

General-purpose registers (Byte addressable registers)


Special function registers (Bit addressable registers)
8051 microcontrollers basically consist of 256 bytes of RAM (Random Access
Memory), which is divided into two parts, first part contain 128 bytes for general
purpose Register these are byte addressable registers and second part contain
128 bytes for special function registers (SFR) memory these are bit addressable
registers.

The part of memory which is used for general purpose is called as RAM, and the
memory used for Special Function Register (SFR) contains all the peripheral
related registers like Accumulator, ‘B’ register, Timers or Counters, and interrupt
related registers

the 8051 microcontroller is a popular 8-bit microcontroller widely used in


embedded systems. It is a single-chip microcontroller with a Harvard
architecture that includes a CPU, RAM, ROM, and several peripherals. The 8051
microcontroller has a 40-pin dual in-line package (DIP) that provides various
inputs and outputs for communication with external devices.
8051 microcontroller is a 40 pin Dual Inline Package (DIP). These 40 pins
serve different functions like read, write, I/O operations, interrupts etc. 8051
has four I/O ports wherein each port has 8 pins which can be configured as
input or output depending upon the logic state of the pins. Therefore, 32 out of
these 40 pins are dedicated to I/O ports. The rest of the pins are dedicated to
VCC, GND, XTAL1, XTAL2, RST, ALE, EA’ and PSEN

Singed and unsinged char


In 8 bit micro an unsigned type can only represent positive values where as a
signed type can represent both positive and negative values. In the case of a 8-
bit char this means that an unsigned char variable can hold a value in the range
0 to 255 while a signed char has the range -128 to 127.

The Memory Interfacing in 8085 is used to access memory quite frequently to read
instruction codes and data stored in memory. This read/write operations are monitored by
control signals. The microprocessor activates these signals when it wants to read from and
write into memory

ARM processors are a family of central processing units (CPUs) based on a reduced
instruction set computer (RISC) architecture. ARM stands for Advanced RISC Machine.
ARM architectures represent a different approach to how the hardware for a system is
designed when compared to more familiar server architectures like x86.

The ARM ecosystem has emerged over the last several years with server optimized
products and solutions that are designed for cloud and hyperscale computing,
telecommunications, and edge computing, as well as high-performance computing (HPC)
applications. Learn how Red Hat® Enterprise Linux® for ARM delivers a reliable, high-
performance platform that includes a consistent application environment across physical,
virtual, and cloud deployments.

The Arm architecture is a family of reduced instruction set computing (RISC) architectures
for computer processors.
Arm system architectures define components and interfaces that simplify hardware and
software interoperation. These architectures offer standardization and commonality across
the ecosystem and help reduce the cost of ownership for software
The acronym ARM stands for Advanced RISC Machine. In the globe, it is one of the most
widely licensed processor cores
Arm processors are used extensively in consumer electronic devices such as smartphones,
tablets, wearables and other mobile devices. They're also used in a wide range of sensors
and internet of things devices

Half duplex Mode: The communication between sender and receiver occurs in both
directions in half duplex transmission, but only one at a time. The sender and receiver can
both send and receive the information, but only one is allowed to send at any given time.

Instruction Set of 8051

The process of writing program for the microcontroller mainly consists of


giving instructions (commands) in the specific order in which they should be
executed in order to carry out a specific task. As electronics cannot
“understand” what for example an instruction “if the push button is pressed-
turn the light on” means, then a certain number of simpler and precisely
defined orders that decoder can recognise must be used. All commands are
known as INSTRUCTION SET. All microcontrollers compatibile with the 8051
have in total of 255 instructions, i.e. 255 different words available for
program writing.
At first sight, it is imposing number of odd signs that must be known by
heart. However, It is not so complicated as it looks like. Many instructions
are considered to be “different”, even though they perform the same
operation, so there are only 111 truly different commands. For example:
ADD A,R0, ADD A,R1, ... ADD A,R7 are instructions that perform the same
operation (additon of the accumulator and register). Since there are 8 such
registers, each instruction is counted separately. Taking into account that all
instructions perform only 53 operations (addition, subtraction, copy etc.)
and most of them are rarely used in practice, there are actually 20-30
abbreviations to be learned, which is acceptable.
3.1 Types of instructions
Depending on operation they perform, all instructions are divided in several
groups:
Arithmetic Instructions
Branch Instructions
Data Transfer Instructions
Logic Instructions
Bit-oriented Instructions

The way in which an operand is given to an instruction is known as addressing


mode. Addressing modes do exist in every processor and microcontroller, There
are various types of addressing modes in 8051, and important one are listed
here.
 Immediate addressing mode.
 Register addressing mode.
 Direct addressing mode.
 Indirect addressing mode.
 Indexed addressing mode.
Immediate addressing mode:

In this type of addressing mode in 8051, directly data is given to instruction to


perform operation. Data and address of a location looks the same( both are
numbers ). So a special character ‘#’ is used to differentiate data from
addresses.

Register addressing mode:

In this type of addressing mode, instead of giving the data directly, the register
name is given. Data from one register is moved to other register, data doesn’t
get erased from first register. Generally the data is stored in general purpose
registers, thus it is named as register addressing mode

Direct addressing mode:

In this addressing mode of 8051 , the address of the data location is given in the
instruction , This operation is only for internal RAM and SFRs because it provides
an address of only 8-bit.

Index addressing mode:

This addressing mode of 8051 microcontroller is the sum of two registers. ROM
doesn’t only consist only of program memory, it also has bit data memory in
some cases.

In full duplex transmission mode, the communication between sender and receiver can occur
simultaneously. The sender and receiver can both transmit and receive at the same time.
Full duplex transmission mode is like a two-way road, in which traffic can flow in both
directions at the same time.
Serial Interrupts

Serial Interrupts are slightly different than the rest of the interrupts. This is due to the fact
that there are two interrupt flags: RI and TI. If either flag is set, a serial interrupt is triggered.
As you will recall from the section on the serial port, the RI bit is set when a byte is received
by the serial port and the TI bit is set when a byte has been sent.

This means that when your serial interrupt is executed, it may have been triggered because
the RI flag was set or because the TI flag was set--or because both flags were set. Thus,
your routine must check the status of these flags to determine what action is appropriate.
Also, since the 8051 does not automatically clear the RI and TI flags you must clear these
bits in your interrupt handler.

Operators in Embedded C programming are symbols that perform specific operations on values or
variables. Mathematical and logical operations is one of the important task that any microcontrollers
has to perform during execution of set of instructions based on the user data expressions. This
operation in embedded C will be performed with special symbolic operator called as “Operators in
C”. To execute this operation C compiler recognizing them with with special symbols. Operators are
the symbols that help in performing operations of mathematical and logical format

 Arithmetic Operators
 Relational Operators
 Logical Operators
 Bitwise Operators
 Assignment Operators
 Conditional Operators
 Special Operators

The do/while loop is a variant of the while loop. This loop will execute the code block once,
before checking if the condition is true, then it will repeat the loop as long as the condition is
true.

A "While" Loop is used to repeat a specific block of code an unknown number of times, until
a condition is met. For example, if we want to ask a user for a number between 1 and 10, we
don't know how many times the user may enter a larger number, so we keep asking "while
the number is not between 1 and 10".

The for loop in C language is used to iterate the statements or a part of the program several
times. It is frequently used to traverse the data structures like the array and linked list.
Represents the initialization of the loop variable. More than one variable can be initialised.
Minimum mode Maximum mode

In minimum mode there can be only one processor In maximum mode there can be
i.e. 8086. multiple processors with 8086, like 8087
and 8089.

MN/MX¯¯¯¯¯¯¯¯¯¯��/��¯ is 1 to indicate MN/MX¯¯¯¯¯¯¯¯¯¯��/��¯is 0 to


minimum mode. indicate maximum mode.

ALE for the latch is given by 8086 as it is the only ALE for the latch is given by 8288 bus
processor in the circuit. controller as there can be multiple
processors in the circuit.

DEN¯¯¯¯¯¯¯¯¯¯¯¯���¯and DT/R¯¯¯¯��/�¯ andDT/R¯¯¯¯��/�¯ for the trans-


for the trans-receivers are given by 8086 itself. receivers are given by 8288 bus
controller.

Direct control Instead of control signals, each


signals M/IO¯¯¯¯¯¯�/��¯, RD¯¯¯¯¯¯¯¯��¯ an processor generates status signals
d WR¯¯¯¯¯¯¯¯¯��¯ are given by 8086. called S2¯¯¯¯¯�2¯, S1¯¯¯¯¯�1¯ an
d S0¯¯¯¯¯�0¯.

Control Status
signals M/IO¯¯¯¯¯¯�/��¯, RD¯¯¯¯¯¯¯¯��¯ an signals S2¯¯¯¯¯�2¯, S1¯¯¯¯¯�1¯ an
d WR¯¯¯¯¯¯¯¯¯��¯ are decoded by a 3:8 decoder d S0¯¯¯¯¯�0¯ are decoded by a bus
like 74138. controller like 8288 to produce control
signals.

INTA¯¯¯¯¯¯¯¯¯¯¯¯¯¯����¯ is given by 8086 in INTA¯¯¯¯¯¯¯¯¯¯¯¯¯¯����¯ is


response to an interrupt on INTR line. given by 8288 bus controller in
response to an interrupt on INTR line.

HOLD and HLDA signals are used for bus request with RQ¯¯¯¯¯¯¯¯/GT¯¯¯¯¯¯¯¯��¯/
a DMA controller like 8237. ��¯,lines are used for bus requests
by other processors like 8087 or 8089.

The circuit is simpler. The circuit is more complex.

Multiprocessing cannot be performed hence As multiprocessing can be performed, it


performance is lower. can give very high performance.

Arrays in C are an essential data structure that allows you to store and manipulate a
collection of elements of the same type. They provide a convenient way to work with a fixed-
size sequence of values.Arrays can be instantiated by specifying a list of initial values.
Syntax: datatype [] arrayName = { value0, value1, … }; where valueN is an expression
evaluating to the data type of the array and is the value to assign to the element at index N.
An initialization list can be given only when the array is declared

 Pin 29 − This is PSEN pin which stands for Program Store Enable. It is used
to read a signal from the external program memory.

These five sources of interrupts in 8051are:


 Timer 0 overflow interrupt- TF0.
 Timer 1 overflow interrupt- TF1.
 External hardware interrupt- INT0.
 External hardware interrupt- INT1.
 Serial communication interrupt- RI/TI.

Size of int in c
The size of the int type is 4 bytes (32 bits). The minimal value is -2 147 483 648, the
maximal one is 2 147 483 647

Block diagram of 8051


The FLAGS register is the status register that contains the current state of an x86 CPU. The
size and meanings of the flag bits are architecture dependent. It usually reflects the result of
arithmetic operations as well as information about restrictions placed on the CPU operation
at the current time. Some of those restrictions may include preventing some interrupts from
triggering, prohibition of execution of a class of "privileged" instructions. Additional status
flags may bypass memory mapping and define what action the CPU should take on
arithmetic overflow.
The carry, parity, auxiliary carry (or half carry), zero and sign flags are included in many
architectures.
In the i286 architecture, the register is 16 bits wide. Its successors,
the EFLAGS and RFLAGS registers, are 32 bits and 64 bits wide, respectively. The wider
registers retain compatibility with their smaller predecessors.

Input and output, or I/O is the communication between an information processing system,
such as a computer, and the outside world, possibly a human or another information
processing system. Inputs are the signals or data received by the system and outputs are
the signals or data sent from it.

At its most basic level, an information system (IS), such as a software


application, is installed on a computer and its users in the outside world operate
the computer to get solutions to problems. Input refers to the signals or
instructions sent to the computer. Output refers to the signals sent out from the
computer.

This term is also known as I/O operations, which references the input and output
actions.

RS232 standard

One of the advantages of the RS232 protocol is that it can be transmitted over
telephone lines. Serial digital data can be converted by a DTU, placed on a
standard voice-grade telephone line, and converted back to serial digital data at
the receiving end of the line by another modem.

Officially, RS-232 is defined as "the interface between data terminal equipment


and data communication equipment using serial binary data exchange". This
definition defines data terminal equipment (DTE) as a computer and data
communication equipment (DCE) as a modem. Modem cables have pin-to-pin
connections designed to connect DTE equipment to DCE equipment.

RS-232 is widely used for the connection between data acquisition equipment
and computer systems. RS-232 devices are defined as DTE (usually a computer)
or DCE (usually an interface device). A direct connection is required when
connecting a DCE device to a computer (DTE). However, not all interface devices
or data acquisition systems are DCEs, so a null modem cable is required, which
"crosses" the necessary signal lines.
Interfacing Keyboard to 8051 Microcontroller

The key board here we are interfacing is a matrix keyboard. This key board is designed with a
particular rows and columns. These rows and columns are connected to the microcontroller through
its ports of the micro controller 8051. We normally use 8*8 matrix key board. So only two ports of
8051 can be easily connected to the rows and columns of the key board.

Whenever a key is pressed, a row and a column gets shorted through that pressed key and all the
other keys are left open. When a key is pressed only a bit in the port goes high. Which indicates
microcontroller that the key is pressed. By this high on the bit key in the corresponding column is
identified.

Once we are sure that one of key in the key board is pressed next our aim is to identify that key. To
do this we firstly check for particular row and then we check the corresponding column the key board.

To check the row of the pressed key in the keyboard, one of the row is made high by making one of
bit in the output port of 8051 high . This is done until the row is found out. Once we get the row next
out job is to find out the column of the pressed key. The column is detected by contents in the input
ports with the help of a counter. The content of the input port is rotated with carry until the carry bit is
set.

The contents of the counter is then compared and displayed in the display. This display is designed
using a seven segment display and a BCD to seven segment decoder IC 7447.

The BCD equivalent number of counter is sent through output part of 8051 displays the number of
pressed key.

A 32-bit register is used to select the function of the pins in which the user needs it to
operate. As I said there are four functions for each pin of the controller, and the first function
was GPIO ( General Purpose Input Output ). It means that the pin can either act as an Input
or Output with no specific functions.

There are totally three PINSEL registers in LPC2148 Controller in order to control the
functions of the Pins in the respective ports. The classification is given below

 PINSEL0 – Controls functions of Port0.0 – Port0.15


 PINSEL1 – Controls functions of Port0.16-Port0.31
 PINSEL2 – Controls functions of Port1.16-Port1.31

PPI 8255 is a general purpose programmable I/O device designed to interface


the CPU with its outside world such as ADC, DAC, keyboard etc. We can
program it according to the given condition. It can be used with almost any
microprocessor. It consists of three 8-bit bidirectional I/O ports i.e. PORT A,
PORT B and PORT C. We can assign different ports as input or output functions.

8051 Microcontroller has two 16-bit counters/timers: timer 0 and timer1. These
timers work as a counter also. It means these timers perform dual function.
When they work as a timer to generate a time delay or as counter to count
events happening outside the microcontroller. Both timers are 16 bits wide.

We know that 8051 microcontrollers have an 8-bit microcontroller. So, it can


process 8-bit data at a time. So, these registers are divided into two parts Higher
8-bits (TH) and Lower 8-bits (TL). The higher byte is stored in TH register and the
lower byte is stored in TL register.

In short we can say that, timer is a special type of clock which is used to
measure time intervals. Where as Counter is a device that able to count the
number of times a particular event or process occurred, with respect to a clock
signal. Counters can be easily implemented with the help of flip-flop.

Timer 0 Registers

Timer 0 register is 16 bits register and accessed as low byte and high byte. The
TL0 is referred as a low byte register and the TH0 is referred as a high byte
register. These registers can be also accessed like any other registers. Example,
the instruction MOV TL0, #5H moves the value into the low-byte of Timer 0.

Timer1 Registers

Timer1 is also 16 bits register and is divided into two 8-bit register, referred to as
TL1 (lower timer 1 register) and TH1 (Higher timer 1 register). The low byte
register is referred as a TL0 and the high byte register is referred as TH0. These
registers can be accessed like any other registers. Example, the instruction MOV
TL1, #5H moves the value into the low-byte of Timer1.

SBUF is an 8-bit register used for serial communication in 8051 microcontrollers. The Serial
Buffer or SBUF register is used to hold the serial data while transmission or reception. The
internal RAM address of SBUF in 8051 is 99 H

The 8051 has only single SBUF register.

SCON(Serial Control Register), BIT AddressableThe serial port control and status register is
the Special Function Register SCON. This register contains not only the mode selection bits,
but also the 9th data bit for transmit and receive (TB8 and RB8), and the serial ports
interrupt bits (TI and RI)

PCON: The PCON or Power Control register, as the name suggests is used to control the
8051 Microcontroller's Power Modes and is located at 87H of the SFR Memory Space. Using
two bits in the PCON Register, the microcontroller can be set to Idle Mode and Power Down
Mode.27 Oct 2020

You might also like