Professional Documents
Culture Documents
Important Questions MCQs MA 21EE1405 KSDS (Diploma) English KPGU Summer-2024 HSP
Important Questions MCQs MA 21EE1405 KSDS (Diploma) English KPGU Summer-2024 HSP
Q.4 In 8051 Microcontroller, the Program Counter (PC) and Data pointer (DPTR) is ____ Register.
(a) 8-bit (b) 4-bit (c) 32-bit (d) 16-bit
ANSWER: (d) 16-bit
Q.4 8051 માઇક્રોકન્ટ્રોલરમાં, પ્રોગ્રામ કાઉન્ટર (PC) અને ડેટા પોઇન્ટર (DPTR) એ ____ રજીસ્ટર છે .
(b) 8-bit (b) 4-bit (c) 32-bit (d) 16-bit
જવાબ: (d) 16-bit
Q.8 The RPM rating given for the DC Motor is for ___________.
(a) Semi-Load, (b) Full Load, (c) No-Load, (d) none of these.
ANSWER: (c) No-Load
Q.10 If the voltage is greater than _____, then the Arduino will destroy.
(a) 10, (b) 30, (c) 20, (d) none of these.
ANSWER: (c) 20
Answer. 001
CPU (Central Processing Unit): CPU acts as the mind of any processing machine. It
synchronizes and manages all processes that are carried out in a microcontroller. User has no
power to control the functioning of the CPU. It interprets the program stored in ROM and carries
out from storage and then performs its projected duty. CPU manage the different types of
registers available in 8051 microcontrollers.
Interrupts: Interrupts is a sub-routine call that is given by the microcontroller when some other
program with high priority is requested for acquiring the system buses then interrupts occur in
the current running program.
Interrupts provide a method to postpone or delay the current process, perform a sub-routine task
and then restart the standard program again.
Types of interrupt in 8051 Microcontroller:
Memory: For operation Microcontroller required a program. This program guides the
microcontroller to perform the specific tasks. This program installed in the microcontroller
required some on chip memory for the storage of the program.
Microcontroller also required memory for storage of data and operands for a short duration. In
microcontroller 8051 there is code or program memory of 4 KB that is it has 4 KB ROM and it
also comprises data memory (RAM) of 128 bytes.
Bus : Bus is a group of wires which is used as a communication canal or acts as means of data
transfer. The different bus configuration includes 8, 16 or more cables. Therefore, a bus can bear
8 bits, 16 bits all together.
● Data bus: 8051 microcontroller consists of 8 bits data bus. It is generally used for
transferring the data from one peripheral position to other peripherals.
Oscillator: As the microcontroller is a digital circuit therefore it needs a timer for their
operation. To perform timer operation inside a microcontroller it required an externally
connected or on-chip oscillator. Microcontroller is used inside an embedded system for
managing the function of devices. Therefore, 8051 uses the two 16 bit counters and timers. For
the operation of these timers and counters the oscillator is used inside the microcontroller.
The Microcontrollers are used in small applications like toys to very high end applications like
robotics and image processing. The microcontrollers are available in 4-bit to 32-bit size and their use are
targeted as:
4-Bit Microcontrollers
8-Bit Microcontrollers
(1) Most widely used.
(2) Used in many control and monitoring applications like temperature control, monitoring
some parameters in plant etc.
(3) Well suited for devices like modems, home appliances like VCRs, microwave ovens,
TVs, etc.
(4) Useful also for high-speed machine controls.
16-Bit Microcontrollers
(1) Used for high speed control applications involving faster calculations. e.g. controlling
motor speed.
32-Bit Microcontrollers
(1) High speed, high performance microcontrollers which can be used also at supervisory
level.
(2) Typical applications are robotics, highly intelligent instrumentation, image processing,
avionics, telecommunications, automobiles etc.
Q.004 State advantages of microcontroller compared to microprocessor.
Ans. 004
The inbuilt memory and I/O functions within the microcontroller provides following advantages
in designing microcontroller based systems (specifically dedicated systems) over the microprocessor
based system.
(1) Cost of the system is low as most components are integrated in a single chip.
(2) Product is small in size and highly reliable as the external interface is very small.
(3) System development life cycle is small as design requires very less time.
(4) System maintenance is easy.
(5) Security of software is high as stored in internal ROM.
(6) Possibility to connect external RAM/ROM as well as external I/O functions also satisfies the need
for large and complex systems.
Q.005 Compare Microprocessor (8085) and Microcontroller (8051).
Ans. 005
→The Microprocessors are used to design → The Microcontrollers are used generally
general purpose or sometimes dedicated for real time instrumentations and
systems by connecting it to external industrial applications and performs
hardware devices like RAM, ROM and dedicated Functions. So, they required less
Peripheral Devices. external hardware as μC has almost
everything in-built.
→ The μP instruction set has many → While the μC instructions are most of the
instructions performing external move time perform only internal move operation
operation. There are only few instructions to perform
external moves.
→The Microprocessors are not bit oriented → The Microcontrollers contain no. of bit
and hence they have no instructions or few oriented instructions which are useful to
instructions performing bit operations. perform operations like switching.
Bit operations are useful in performing control operations with a speed or in real time
manner which is primary requirement of industrial control applications.
As a result, Programmers need more effot and time to develop programs using the μC
instruction set. But this problem can be solved by using more software tools.
Module-2 8051 Hardware
Q.001 Explain Pin Function diagram of 8051 Microcontroller.
Ans. 001
Q.002 Write a short note: Architecture of the 8051 Microcontroller.
Ans. 002
Q.003 Explain the 8051 Flag register or Program Status Word (PSW).
Ans.003
Q.004 Differentiate between PC and DPTR in 8051 Microcontroller.
Ans.004
Q.005 What is SFRs? Give its list and functions. Also explain in brief: SP (Stack Pointer).
Ans.005
Q.006 Explain Internal RAM Organization in 8051 Microcontroller.
Ans.006
Q.007 Write a short note on 8051 I/O ports.
Ans.007
Q.008 Explain 8051 Timer/Counters.
Ans.008
MODULE-3: 8051 Programing
Q.001 Write an ALP (Assembly Language Program) based on Data Transfer Instruction.
(The data in the memory address d:40H is transferred to d:50H)
Answer.001
Q.004 Write an ALP (Assembly Language Program) based on Looping, counting and indexing
Concept.
(a) Multiply 25 by 10 using the technique of repeated addition.
(b) Write a program to add the first 10 natural numbers.
Answer.004
(a) Multiply 25 by 10 using the technique of repeated addition.
E.g. 25 * 10 = 250 (FAH)
25 + 25 + 25 + 25 + 25 + 25 + 25 + 25 + 25 + 25 = 250
******************************************************************************
MODULE-4: 8051 Interfacing
Q.001 Explain External Memory Interfacing with the 8051.
Ans.001
Q.002 Explain ADC0804 (Analog to Digital Converter) chip Interfacing with the 8051.
Ans.002
➔ The ADC0804 is an 8-bit parallel ADC. It works on +5 volts VCC and has a resolution of
8 bits.
➔ The conversion time varies depending on the clocking signals applied to the CLK IN pin,
but it cannot be faster than 110 Microseconds.
➔ The speed at which an analog input is converted to the digital output depends on the
speed of the CLK input. Also, the typical operating frequency is approximately 640 kHZ
at 5 volts.
Q.003 Explain Stepper Motor Interfacing with the 8051.
Answer.003
➔ Here we are going to interface 6 wires Unipolar Stepper Motor with an 8051 controller.
➔ Only four wires are required to control the stepper motor.
➔ Two common wires of the stepper motor are connected to the 5V supply.
➔ ULN2003 driver is used to driving the stepper motor.
➔ Note that to know the winding coil and their center tap leads measure resistance in
between leads. From center leads, we will get half the resistance value of that winding.
Q.004 Explain DC Motor Interfacing with the 8051.
Answer. 004
Let’s interface the DC motor with the AT89S52 microcontroller and control the DC motor speed
by using the Speed Increment Switch and Speed Decrement Switch connected to the
Microcontroller port and direction by using Direction Switch.
We are going to use the L293D motor driver IC to control the DC motor movement in both
directions. It has an in-built H-bridge motor drive.
➔ As shown in the above figure we have connected two toggle switches on the P1.0 and
P1.1 pin of the AT89S52 microcontroller to change the speed of the DC motor by 10%.
➔ One toggle switch at pin P1.2 controls the motor's rotating direction.
➔ P1.6 and P1.7 pins are used as output direction control pins. It provides control to motor1
input pins of the L293D motor driver which rotate the motor clockwise and anticlockwise
by changing their terminal polarity and Speed of the DC Motor is varied through PWM
Out pin P2.0.
➔ Here we are using the timer of AT89S52 to generate PWM.
Q.005 Explain LEDs Interfacing with the 8051.
Answer: 005
LEDs (Light Emitting Diodes) are components most commonly used for displaying pin digital state.
The 32 LEDs connected to the microcontroller ports P0, P1, P2 and P3. The extra port P4 is
connected with 6 extra LEDs which represent the SW2 (Switch Group).
LEDs are arranged in Five groups. Each groups expect LEDs belonging to port P4 consists of eight
LEDs that can be enabled or disabled using switches of the switch group SW2.
LEDs are enabled when the corresponding switch of the SW2 is on. When enabled, LEDs display the
state of the corresponding microcontroller pin. Otherwise, the LEDs are always off, no matter what
port state is, since no current can flow through them.
Note: LEDs are activated by logic zero (0), which means that if LED is ON, the appropriate
microcontroller pin’s voltage is low (0). If LED is OFF, the appropriate microcontroller pin’s
voltage is high (1).
Figure12 illustrates the connection between port P1 pins and the corresponding LEDs. A resistor is
serially connected to LEDs in order to limit current through them. In this case the resistor value is 1K.
Q.006 Explain 7 segment LED display Interfacing with the 8051.
Answer.006
This simple circuit illustrates two things. How to setup simple 0 to 9 up counter using
8051 and more importantly how to interface a seven segment LED display to 8051 in
order to display a particular result.
The common cathode seven segment display D1 is connected to the Port 1 of the
microcontroller (AT89S51) as shown in the circuit diagram. R3 to R10 are current
limiting resistors. S3 is the reset switch and R2,C3 forms a debouncing circuitry. C1, C2
and X1 are related to the clock circuit. The software part of the project has to do the
following tasks.
➔ The system requires a 8x5x microcontroller with internal program memory and RS232
level converter like MAX 232. A quartz crystal and a reset circuit should be connected to
the microcontroller.
➔ The program for serial communication can be stored permanently in internal ROM and so
there is no need for external memory. In case if 8031 controller is used then an external
EPROM has to be interfaced for program storage.
➔ The serial bus is formed by using only three lines TxD, RxD and Vss (Ground).
➔ The signals TxD and RxD will have TTL logic levels and they can be converted to
standard RS232 logic levels using bidirectional level converter MAX 232.
➔ The RS232 level serial port signal can be terminated on a standard 9-pin D-type
connector, so that any standard serial device can be connected to an 8051 controller for
serial communication.
➔ The parallel data transfer can be achieved through ports. The parallel input data is
received through port-2 and parallel output data is sent through port-1.
➔ The controller can receive parallel data from an ADC and convert it to serial and transmit
via serial port to another serial device. Also the controller can receive serial data from
another serial device via serial port and convert to parallel, and then output through
port-1 to a parallel device like DAC.
➔ The 8051 controller supports full duplex communication and so the transmission and
reception can be performed simultaneously.
Q.008 Explain Digital Thermometer (DS1820) Interfacing with the 8051.
Answer.008
➔ It must be properly placed in the 3-pin socket provided on the kit or development board,
with its rounded side oriented as marked on the board (as shown in the above Figure).
➔ Otherwise, the DS1820 could be permanently damaged. DS1820 data pin can be
connected to either P3.3 or P1.2 Selection is performed by Jumper J7.
************************************************************************
MODULE-5: Applications based on Arduino Programming
→ You can tell your board what to do by sending a set of instructions to the
microcontroller on the board. To do so you use the Arduino programming
language (based on Wiring), and the Arduino Software (IDE), based on
Processing.
→ Over the years Arduino has been the brain of thousands of projects, from
everyday objects to complex scientific instruments.
Fig.1
→ One thing that makes Arduino unique is that it provides not only boards but also
other electronics kits such as sensors, robotics arms, meters, etc. that makes it
very useful to assemble IoT(Internet of Things) devices quickly.
Q.2 Explain interfacing of Sensors and Actuators with Arduino.
Answer.002
In this chapter, we will learn about the different components on the Arduino
board. We will study the Arduino UNO board because it is the most popular board
in the Arduino board family. In addition, it is the best board to get started with
electronics and coding. Some boards look a bit different from the one given below,
but most Arduinos have the majority of these components in common.
Power USB
Arduino board can be powered by using the USB cable from your computer. All you
need to do is connect the USB cable to the USB connection (1).
Crystal Oscillator
The crystal oscillator helps Arduino in dealing with time issues. How does Arduino
calculate time? The answer is, by using the crystal oscillator. The number printed on top
of the Arduino crystal is 16.000H9H. It tells us that the frequency is 16,000,000 Hertz or
16 MHz.
Arduino Reset
You can reset your Arduino board, i.e., start your program from the beginning. You can
reset the UNO board in two ways. First, by using the reset button (17) on the board.
Second, you can connect an external reset button to the Arduino pin labelled RESET (5).
Analog pins
The Arduino UNO board has six analog input pins A0 through A5. These pins can read
the signal from an analog sensor like the humidity sensor or temperature sensor and
convert it into a digital value that can be read by the microprocessor.
Main microcontroller
Each Arduino board has its own microcontroller (11). You can assume it as the brain of
your board. The main IC (integrated circuit) on the Arduino is slightly different from
board to board. The microcontrollers are usually of the ATMEL Company. You must
know what IC your board has before loading up a new program from the Arduino IDE.
This information is available on the top of the IC. For more details about the IC
construction and functions, you can refer to the data sheet.
ICSP pin
Mostly, ICSP (12) is an AVR, a tiny programming header for the Arduino consisting of
MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred to as an SPI (Serial
Peripheral Interface), which could be considered as an "expansion" of the output.
Actually, you are slaving the output device to the master of the SPI bus.
TX and RX LEDs
On your board, you will find two labels: TX (transmit) and RX (receive). They appear in
two places on the Arduino UNO board. First, at the digital pins 0 and 1, to indicate the
pins responsible for serial communication. Second, the TX and RX led (13). The TX led
flashes with different speed while sending the serial data. The speed of flashing depends
on the baud rate used by the board. RX flashes during the receiving process.
Digital I/O
The Arduino UNO board has 14 digital I/O pins (15) (of which 6 provide PWM (Pulse
Width Modulation) output. These pins can be configured to work as input digital pins to
read logic values (0 or 1) or as digital output pins to drive different modules like LEDs,
relays, etc. The pins labeled “~” can be used to generate PWM.
AREF
AREF stands for Analog Reference. It is sometimes, used to set an external reference
voltage (between 0 and 5 Volts) as the upper limit for the analog input pins.
Q.003 Explain in short the Programming Structure in Arduino.
Answer.003
In this chapter, we will study in depth, the Arduino program structure
and we will learn more new terminologies used in the Arduino world. The
Arduino software is open-source. The source code for the Java environment is
released under the GPL and the C/C++ microcontroller libraries are under
the LGPL.
Sketch − The first new terminology is the Arduino program called
“sketch”.
Arduino programs can be divided into three main parts:
01.Structure,
02.Values (variables and constants), and
03.Functions.
In this tutorial, we will learn about the Arduino software program, step
by step, and how we can write the program without any syntax or compilation
error.
Let us start with the Structure. Software structure consist of two main
functions −
(a) Setup( ) function
(b) Loop( ) function
Fig.2
Void setup ( ) {
}
PURPOSE − The setup() function is called when a sketch starts. Use it to
initialize the variables, pin modes, start using libraries, etc. The setup function will
only run once, after each power up or reset of the Arduino board.
INPUT − -
OUTPUT − -
RETURN − -
Void Loop ( ) {
}
PURPOSE − After creating a setup() function, which initializes and sets the
initial values, the loop() function does precisely what its name suggests, and loops
consecutively, allowing your program to change and respond. Use it to actively
control the Arduino board.
INPUT − -
OUTPUT − -
RETURN − -
Q.004 Explain the phenomenon of Signal Storage and its analysis using Arduino.
Answer.004
→ Extensible and open source hardware boards, such as Arduino, make it feasible to add
on the other hardware capabilities as you need to supplement the hardware resources.
→ One such extension that you could possibly do is to add a hardware module for storing
and processing data through either a micro-SD or a regular SD-Card.
→ The following snapshot shows a micro-SD module.
VCC pin provides power to the module and should be connected to the Arduino’s 5V pin.
MISO (Master In Slave Out) is the SPI output from the microSD card module.
MOSI (Master Out Slave In) is the SPI input to the microSD card module.
SCK (Serial Clock) pin accepts clock pulses from the master (an Arduino in our case) to
synchronize data transmission.
SS (Slave Select) pin is a control pin that is used to select one (or a set) of slave
devices on the SPI bus.
→ The micro-SD module has power ground and SPI (Serial Peripheral Interface) pins. Serial
Peripheral Interface (SPI) is a synchronous serial data protocol used for communicating with
one or more peripheral devices. In SPI connection, there is usually one master device and one
or more slave devices.
→ This micro-SD module could be connected to an Arduino board for storing signal data and
processing data from the micro-SD card.
Q.005 Write a program to Blink the LED for 1(one) second using Arduino.
Answer.005
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
*/
// the setup function runs once when you press reset or power the board
void loop() {
digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
*************************************************************************