0% found this document useful (0 votes)
37 views4 pages

Micro Controller

Uploaded by

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

Micro Controller

Uploaded by

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

Q) What is the size of address and data bus of 8051 Microcontroller?

→ The 8051 microcontroller has an 8-bit address bus and an 8-bit data bus.

Q) Which special function register is used to keep track of priority of interrupts?

→ To keep track of the priority of interrupts in the 8051 microcontroller, the Special
Function Register (SFR) called “IP” (Interrupt Priority) is used.

Q) Which Pin of LCD is used for controlling its contrast?

The contrast of an LCD can be controlled by adjusting the voltage level on the “V0” pin. By
varying the voltage applied to the V0 pin, you can change the contrast and visibility of the
characters displayed on the LCD.

Q) List any two assembler directives of 8051 microcontroller?

1. ORG: This directive is used to specify the memory address at which the program or
data should be located in the memory.
2. DB (Define Byte): This directive is used to define one or more bytes of data and
assign them initial values.

Q) State the role of C/T In TMOD register?

→ The C/T (Counter/Timer) bit in the TMOD (Timer Mode) register of the 8051
microcontroller determines whether the timer operates as a timer or as a counter. When
C/T is set to 0, it functions as a timer, and when set to 1, it operates as a counter.

Q) Explain the function of following pins of 8051 microcontroller.

1) ALE : The ALE (Address Latch Enable) pin in the 8051 microcontroller serves the purpose
of latching the address and data bus during external memory access. When the
microcontroller is accessing external memory, the ALE pin generates a pulse to indicate
that the address and data on the bus are stable and can be latched by external memory
devices.

2) PSEN : The PSEN (Program Store Enable) pin in the 8051 microcontroller is used during
the fetch cycle of the program execution. When the microcontroller needs to fetch an
instruction from external program memory, the PSEN pin is activated. This signal indicates
to the external memory that a program fetch operation is in progress.

3) EA : stands for External Access input. It is used to enable/disable external memory


interfacing. In 8051, EA is connected to Vcc as it comes with on-chip ROM to store
programs.
4) RESET : The RESET pin in the 8051 microcontroller is used to reset the microcontroller
and restore it to its initial state. When the RESET pin is activated by a low signal or a pulse, it
clears the program counter and restarts the program execution from the beginning. This pin
is commonly used during the initialization phase or in error recovery situations to ensure a
clean start for the microcontroller.

5) RXD : The RXD (Receive Data) pin in the 8051 microcontroller is used for serial
communication. It is the input pin for receiving data from an external device or another
microcontroller. When data is transmitted to the microcontroller, it is received through the
RXD pin.

Q) Explain addressing modes of 8051 microcontroller

1. Immediate Addressing Mode: In this mode, the data or operand is directly specified
in the instruction itself. For example, MOV A, #10h moves the immediate value 10h
into the accumulator A.
2. Register Addressing Mode: In this mode, the data or operand is stored in one of the
internal registers of the 8051 microcontroller. For example, MOV A, R0 moves the
value stored in register R0 into the accumulator A.
3. Direct Addressing Mode: In this mode, the address of the data or operand is directly
specified in the instruction. For example, MOV A, 20h moves the value stored at
memory location 20h into the accumulator A.
4. Indirect Addressing Mode: In this mode, the address of the data or operand is stored
in a register. The value of the register is then used as the address to access the data.
For example, MOV A, @R0 moves the value stored at the memory location pointed
by register R0 into the accumulator A.
5. Indexed Addressing Mode: In this mode, the address of the data or operand is
calculated by adding an offset to a base address. The offset is usually stored in a
register.

Q) Write 8051 C-program to generate 4 kHz square wave on port pin P12, using timer 0 in
auto reload mode? [Assume XTAL = 12 MHz].

→ To generate a 4 kHz square wave on port pin P12 using Timer 0 in auto reload mode.
Assuming XTAL is 12 MHz:

➔ #include <8051.h> → Void main() { → TMOD = 0x02; → TH0 = 0xFB;


➔ TL0 = 0xFB, → TR0 = 1; → While (1) { → P1 = ~P1; // Toggle port pin P12

}
In this program, we set Timer 0 in 8-bit auto reload mode (TMOD = 0x02). We load the initial
values for Timer 0 (TH0 and TL0) to generate a 4 kHz square wave. The specific values for
TH0 and TL0 are calculated based on the desired frequency and the XTAL frequency.
Finally, we start Timer 0 by setting TR0 to 1. Inside the infinite while loop, we toggle the
state of port pin P12 (P1 = ~P1) to generate the square wave.

Q) Explain the function of following instructions.

1) Mov A, @Ro : in a microcontroller like the 8051 is used to move the value stored at
the memory location pointed by register RO into the accumulator A.
2) CPL bit : is used to complement or invert the value of a specific bit in a register.
3) djNz R. Next : The “DJNZ” instruction in a microcontroller stands for “Decrement
and Jump if Not Zero.” It is used for looping and branching in microcontroller
programming.
4) RR A : The “RR A” instruction in a microcontroller stands for “Rotate Right A.” It is
used to rotate the bits of the accumulator register to the right.
5) SUBBA, B : The “SUBB A, B” instruction in a microcontroller is used to subtract the
value of register B from the value of register A, and store the result in register A.

Q) Write note on : *1) stepper motor : 1. Working Principle: Stepper motors work by using
electromagnetic fields to attract and repel the rotor’s teeth or poles. These
electromagnetic fields are generated by energizing different coils in a specific sequence,
causing the rotor to move in discrete steps. 2. Steps and Resolution: Stepper motors move
in fixed angular increments known as steps. The number of steps per revolution determines
the motor’s resolution. Higher step counts result in finer control and smoother motion.

*2) register banks in 8054 microcontroller : The register banks in the 8051 microcontroller
allow for efficient context switching and provide flexibility in managing data. By switching
between different register banks, the microcontroller can quickly access a different set of
registers without the need for additional memory operations. To select a specific register
bank, the 8051 microcontroller uses the PSW (Program Status Word) register. The PSW
register’s Bank Select (RS1 and RS0) bits determine which register bank is currently active.
By modifying these bits, you can switch between different register banks.

*3) Data types used for 8051 c-programming : 1. Char: Used to store single characters or
small integers. 2. Int: Used to store integers. 3. Unsigned int: Used to store positive integers
only. 4. Short: Used to store smaller integers than int. 5. Unsigned short: Used to store
positive smaller integers only. 6. Long: Used to store larger integers than int. 7. Unsigned
long: Used to store positive larger integers only. 8. Float: Used to store floating-point
numbers (decimal numbers). 9. Double: Used to store double-precision floating-point
numbers.

*4) Logical instructions : i) AND: The AND instruction performs a bitwise logical AND
operation between two operands and stores the result in a destination register or memory
location.

ii) OR: The OR instruction performs a bitwise logical OR operation between two operands
and stores the result in a destination register or memory location.

iii) XOR: The XOR instruction performs a bitwise logical XOR (exclusive OR) operation
between two operands and stores the result in a destination register or memory location.

iv) NOT: The NOT instruction performs a bitwise logical NOT operation on a single operand
and stores the result in a destination register or memory location.

*5) TCON register : The TCON register, short for Timer/ Counter Control register, is a special
register found in many microcontrollers, including the 8051 family. It is used to control and
configure the behavior of the timers and counters present in the microcontroller. The TCON
register typically consists of 8 bits, each of which is associated with a specific timer or
counter function.

You might also like