ELECTRONIC 1 FRONTback
ELECTRONIC 1 FRONTback
4) Explain the function of following instructions. iv) RR A: The RR A instruction is a logical instruction in the 8051 Vii) NOP: It is used for various purposes such as fine-tuning delays,
i) Mov A, @ R0: The instruction MOV A, @R0 is used to move the contents microcontroller that shifts the data stored in the accumulator to the right creating a handle for breakpoints, occupying a branch delay slot,
of the memory location pointed to by the register R0 into the in a bit-by-bit fashion. The data in the least significant bit (LSB) is shifted rendering void an existing instruction such as a jump, as a target of an
accumulator A . to the most significant bit (MSB). v) SUBB A,B: This instruction is part of execute instruction, or as a placeholder to be replaced by active
ii) CPL bit: CPL is a bit manipulation instruction in the 8051 the data manipulation instructions in the 8051 microcontroller, which instructions later on in program development.
microcontroller instruction set. It is used to complement or invert the perform operations on data and provide computational capabilities for viii) SUBB A, # 05 H: The instruction SUBB A, #05H is a subtraction
value of a specific bit in a bit addressable SFR1. The instruction takes the the computer. instruction in the 8051 microcontroller instruction set. It subtracts
address of the SFR and the bit number as its operands. vi) CLR A: The CLR A instruction is a ladder logic rung output instruction the value 05H from the accumulator register A and stores the result
iii) djNz R2, Next: The instruction DJNZ R2, NEXT is used to perform a loop that clears all the bits (sets them to zero) of the Destination tag. The in the same register.
operation in 8051 assembly language 1. In this instruction, the register R2 instruction is enabled when the preceding logic is true and disabled ix) SWAP A: The SWAP A instruction is a command used in Intel 8051
is decremented by 1. If it is not zero, then the CPU jumps to the target otherwise. microcontroller programming to exchange the high and low nibbles
address referred to by the label NEXT. within the accumulator1. This operation is useful for binary-coded
decimal (BCD) manipulation.
5) Explain internal ram oraganization of 8051 microcontroller. 6) Explain in brief classification of 8051 instructions Write short note on the following.
The 8051 microcontroller instruction set is divided into five groups based
The 8051 microcontroller has 128 bytes of internal RAM, which is divided on the operation they perform: Data Transfer Instructions, Arithmetic ix) Timer mode 2 of 8051:
into three different areas: Working Registers, Bit addressable Registers, Instructions, Logical Instructions, Boolean or Bit Manipulation
and General Purpose Registers 1. The first 32 bytes from addresses 00H to Instructions, and Program Branching Instructions 123. Timer mode 2 of 8051 is an 8-bit timer or counter mode that allows only
1FH are organized as four banks 1. The remaining 96 bytes are used for - Data Transfer Instructions are used to move data between registers, values of 00 to FFH to be loaded into the timer’s high byte register (TH0
scratchpad memory memory locations, and I/O ports. or TH1). The 8051 then copies the same value to the low byte register
2. Arithmetic Instructions are used to perform arithmetic operations such a (TL0 or TL1) and starts the timer or counter by setting the TR0 or TR1 bit
The Working Registers are used for temporary storage of data during the addition, subtraction, multiplication, and division. in the TCON register. The timer or counter will increment TL until it
execution of instructions 1. The Bit addressable Registers are used to Logical Instructions are used to perform logical operations such as AND, overflows from FFH to 00. When this happens, the TF0 or TF1 bit in the
store data in individual bits 3. The General Purpose Registers are used for OR, XOR, and NOT. TCON register is set and the original value in TH is reloaded into TL. This
storing data temporarily during the execution of instructions . Boolean or Bit Manipulation Instructions are used to manipulate mode is useful for generating fixed time intervals or baud rates for serial
individual bits of a byte. communication.
Program Branching Instructions are used to change the sequence of
program execution.
SHORT 6) State the role of C/T in TMOD register. vii) Difference between simplex and full duplex
1.What is size of address and data bus of 8051 microcontroller? The TMOD register is a control register in the 8051 microcontroller Simplex and full duplex are two types of transmission modes that allow
The 8051 microcontroller has an 8-bit data bus and a 16-bit address that is used to configure the operation of the two 16-bit timer/counters data and information to be transferred between two devices. The main
bus. (Timer 0 and Timer. difference between them is the direction and simultaneity of
2) Define step angle of stepper motor. 7) which port of 8051 requires external pull up
resistor. Port 0. communication. In simplex mode, the communication is unidirectional,
The step angle of a stepper motor is defined as the angle by which the
rotor of a stepper motor moves when one input pulse is applied to the 8) Name the timer register of 8051 microcontroller used as meaning that data can only be sent in one direction. For example, a
stator of the motor. bit addressable? The TCON (Timer Control) register of the keyboard can only send input to a computer, and a monitor can only
3) Which special function register is used to keep track of priority of 8051 microcontroller is used as a bit-addressable. display output from a computer. In full duplex mode, the
interrupt. communication is bidirectional, meaning that data can be sent and
The Interrupt Priority (IP) register is used to keep track of priority of received in both directions at the same time. For example, a telephone
interrupt. network can allow two people to talk and listen simultaneously.
4) which pin of lcd is used for controlling its contrast?
Pin no 3 is used for controlling the contrast of the LCD .
5) List any two asembler directives of 8051
microcontroller. ORG,DB,DW,EQU.
Write short note on the following. v) Interrupts in 8051: ii) Register banks in 8051 microcontroller: Register banks are sets of eight
i) Stepper motor: A stepper motor is a particular type of DC motor that general-purpose registers (R0-R7) that are used to store data and
does not rotate continuously. Instead, a full rotation is divided into a An interrupt is a signal that makes the CPU execute a special subroutine intermediate results during the execution of a program on the 8051
number of equal steps. A stepper motor consists of phases, which are (ISR). The 8051 has five interrupts: two external (INT0 and INT1), two microcontroller. There are four register banks in the 8051
multiple coils that are organized into groups. By applying the energy from timer (TF0 and TF1), and one serial (RI/TI). Each interrupt has a priority microcontroller, each occupying eight bytes of the internal RAM
the input voltage to each phase in a sequence, the stepper motor rotates and a memory location for its ISR. The IE register enables or disables the memory. The active register bank is determined by two bits of the
by taking one step at a time. Thus a stepper motor converts electrical interrupts. The IP register changes the priority levels. The external Program Status Word (PSW) register, which can be changed by the
energy or an input digital pulse into mechanical shaft rotation. A stepper interrupts are triggered by the pins P3.2 and P3.3. The timer interrupts are programmer. Register banks allow the programmer to switch between
motor works under the principle of electromagnetism. A permanent triggered by the timer registers overflow. The serial interrupt is triggered different sets of registers without affecting the data stored in them. This
magnet or soft iron is used as the rotor and is surrounded by by the serial port data. The RI and TI flags have to be cleared manually. can be useful for implementing interrupt service routines, subroutine
electromagnetic stators. The poles of the rotor and stator may be teethed. When an interrupt occurs, the CPU saves the PC on the stack and jumps to calls, and context switching1
When voltage is applied at the terminals, the rotor aligns itself with the the ISR. After the ISR, the CPU resumes the interrupted task. If multiple
stator or moves to have a minimum gap with the stator due to the magnetic interrupts occur, the CPU handles them by priority order.
effect. The stators are energized in a sequence and the rotor moves
accordingly, giving a full rotation that is divided into a discrete number of
iii) Data types used in 8051 ‘C’ program: unsigned char: This data type
is used to store single characters or small integers in the range of 0 to 255.
It occupies one byte of memory. signed char: This data type is also used
to store single characters or small integers, but in the range of -128 to 127.
It also occupies one byte of memory. unsigned int: This data type is used
to store large integers in the range of 0 to 65535. It occupies two bytes of
memory. signed int: This data type is also used to store large integers, but
in the range of -32768 to 32767. It also occupies two bytes of memory.
sbit (single bit): This data type is used to store a single bit value, either 0 or
1. It is useful for accessing and manipulating the individual bits of a byte or
a register. bit and sfr: These data types are used to declare special
function registers (sfr) and their bits. They are used to control and monitor
the various peripherals and features of the 8051 microcontroller.