Microprocessor and Microcontrollers Q and A new
Microprocessor and Microcontrollers Q and A new
UNIT I CO
1 Question What are the functions of an accumulator? 1
Answer The accumulator is a register that is related with ALU and occasionally I/O
operations. It is an essential component of ALU. It stores one of the data sets
that the ALU will process. It also saves the outcome of the ALU's execution
temporarily.
2 Question List the register pairs of 8085. 1
Answer • B-C register pair
• D-E register pair
• H-L register pair
3 Question List out the categories of the 8085 instructions. 1
Answer • Data transfer group – MOV, MVI, LXI.
• Arithmetic group – ADD, SUB, INR.
• Logical group –ANA, XRA, CMP.
• Branch group – JMP, JNZ, CALL.
• Stack I/O and Machine control group – PUSH, POP, IN, HLT.
4 Question Explain the difference between a JMP instruction and CALL instruction. 1
Answer A JMP instruction permanently changes the program counter. A CALL
instruction leaves information on the stack so that the original program
execution sequence can be resumed.
5 Question Explain the purpose of the I/O instructions IN and OUT. 1
Answer The IN instruction is used to move data from an I/O port into the accumulator.
The OUT instruction is used to move data from the accumulator to an I/O port.
The IN & OUT instructions are used only on microprocessor, which use a
separate address space for interfacing.
6 Question Explain shift and rotate instructions? 1
Answer A rotate instruction is a closed loop instruction. That is, the data moved out at
one end is put back in at the other end. The shift instruction loses the data that
is moved out of the last bit locations.
7 Question List the four instructions which control the interrupt structure of the 8085 1
microprocessors.
Answer • DI ( Disable Interrupts )
• EI ( Enable Interrupts )
• RIM ( Read Interrupt Masks )
• SIM ( Set Interrupt Masks )
Question Explain priority interrupts of 8085. 1
8 Answer The 8085 microprocessor has five interrupt inputs. They are TRAP, RST 7.5,
RST 6.5, RST 5.5, and INTR. These interrupts have a fixed priority of interrupt
service. If two or more interrupts are active at the same time, the 8085 will
prioritise them. The TRAP has the highest priority followed by RST 7.5, RST
6.5, RST 5.5.
9 Question Explain the signals HOLD, READY and SID. 1
Answer HOLD shows that a peripheral, such as a DMA controller, wants to use the
address, data, and control buses. READY is used to delay the read or write
cycles of the CPU until a slow-responding peripheral is ready to deliver or
accept data. SID is a bit-by-bit serial data acceptor.
10 Question Mention the different type of addressing mode in 8085. 1
Answer The various formats of specifying the operands are called addressing modes, it
is used to access the operands or data. The different types are as follows
• Immediate addressing
• Register addressing
• Direct addressing
• Indirect addressing
• Implicit addressing
11 Question Calculate and draw the machine cycle, instruction cycle and time cycle for 1
instruction: MVI A, 65
12 Question Draw and explain the architecture of 8085 microprocessor. 1
13 Question What do you mean by conditional instructions? 1
14 Question What are the peripheral devices you can connect with 8085? 1
15 Question Draw the logic gate circuit to interface a I/O device with 8085 1
16 Question Draw the logic gate circuit to interface a Memory with 8085 1
17 Question Draw and explain the peripheral interfacing of 8251 with 8085. 1
18 Question What do you mean by Implicit addressing? 1
19 Question Calculate the maximum memory size you can have after connecting a 13- 1
bit external memory.
No. UNIT II CO
1 Question What are the special function register? 2
Answer The special function register are stack pointer, index pointer (DPL and DPH),
I/O port addresses, status (PSW) and accumulator.
2 Question What are the uses of accumulator register? 2
Answer The accumulator registers (A and B at addresses OEOh and OFOh,
respectively) are used to store temporary values and the results of arithmetic
operations
3 Question What is PSW? 2
Answer Program status word (PSW) is the set of flags that contains the status
information and is considered as one of the special function register.
4 Question What is stack pointer (sp)? 2
Answer The stack pointer (SP) is an 8-bit register that is incremented before data is
written to the stack using the PUSH or CALL instructions. It has an 8-bit top
stack address. It can be defined anywhere in the 128-byte RAM on the
microprocessor. The SP register is set to 07 after being reset. The 8-bit values
of the operand are placed onto the stack following each write to stack
operation, after incrementing the SP register by one. It isn't a data structure
that is built from the top down. In the special function register bank, it is
assigned an address.
5 Question What is data pointer (DTPR)?. 2
Answer It's a 16-bit register with the higher (DPH) and lower (DPL) bytes of a 16-bit
external data RAM address. It can be accessed as either a 16-bit or two 8-bit
register. For its two bytes DPH and DPL, it has been assigned two addresses
in the special function register bank.
6 Question What is the purpose of using instruction register? 2
Answer Instruction register is used for the purpose of decoding the opcode of an
instruction to be executed and gives information to the timing and control unit
generating necessary signals for the execution of the instruction.
7 Question Give the purpose of ALE/PROG signal 2
Answer ALE/PROG is an address latch enable output pulse that signals that the
associated pins have valid address bits. The ALE pulses are released at a
frequency that is one-sixth that of the oscillator. Only external memory
accesses are valid for this signal.
Question Give the addressing modes of 8051? 2
8 Answer There are six addressing modes in 8051.
• Direct addressing
• Indirect addressing
• Register instruction
• Register specific (register implicit)
• Immediate mode
• Indexed addressing
9 Question Explain the two power saving mode of operation. 2
Answer The following are the two power-saving modes of operation:
Idle mode: The oscillator continues to function in this mode, as do the
interrupt, serial port, and timer blocks, but the clock to the CPU is deactivated.
The status of the CPU is kept. A hardware interrupt or hardware reset signal
can be used to exit this mode. After that, the CPU picks up where it left off
with programme execution.
Power down mode: The on-chip oscillator is turned off in this mode. The
contents of RAM are used to hold all of the controller's functionality.
Hardware reset is the only way to exit this mode. The reset resets all of the
SFRs, but the RAM contents remain the same.
10 Question Differentiate between program memory and data memory. 2
Answer Program Memory:
• It keeps track of the programmes that will be run.
• It only stores programme code that will be executed and hence does
not require writing, it is implemented using EPROM. It keeps track of
the data, line intermediate results, variables, and constants needed to
run the programme.
Example.
MOV C, A @ A + DPTP JMP @ A + DPTR
16 Question List out some compare instructions. 2
Answer The compare instructions are:
a. CJNE
b. CLR
c. CPL
17 Question Write a program to save the status of bits p1.2 and p1.3 on ram bit 2
locations 6 and 7 respectively.
Answer MOV C, P1.2; save status of P1.2 on CY
MOV O6, C; save carry in RAM bit location 06
MOV C, p1.3; save status of p1.3 on CY
MOV 07, C; save carry in RAM bit location 07
18 Question Write a program to see if bits 0 and 5 of register b r1. If they are not, 2
make them so and save it in r0
Answer JNB OFOH, NEXT – 1; JUMP if B.0 is low
SET BOFOH; Make bit B.0 high
NEXT – 1:JNB OF5H, NEXT – 2; JUMP if B.5 is low
SETB OF5H; Make B.5 high
NEXT – 2: MOV R0, B; Save register B
19 Question List the features of 8051 microcontroller? 2
Answer The features are
Single supply +5 volt operation using HMOS technology.
4096 bytes program memory on chip(not on 8031)
128 data memory on chip.
Four register banks.
Two multiple mode, 16-bit timer/counter.
Extensive Boolean processing capabilities.
64 KB external RAM size
32 bidirectional individually addressable I/O lines.
8 bit CPU optimized for control applications
20 Question Compare Microprocessor and Microcontroller. 2
Answer Microprocessor Microcontroller
• Microprocessor contains • Microcontroller contains the
ALU, general purpose circuitry of microprocessor
registers, stack pointer, and in addition it has built in
program counter, clock ROM, RAM, I/O devices,
timing circuit and interrupt timers and counters
circuit • It has one or two instructions
• It has many instructions to to move data between
move data between memory memory and CPU.
and CPU. • It has many bit handling
• It has one- or two-bit instructions.
handling instructions. • Less access time for built-in
• Access times for memory and memory and I/O devices
I/O devices are more • Microcontroller based
• Microprocessor based system system requires less
requires more hardware hardware reducing PCB size
and increasing the reliability
Answer 12
9 Question How many types of macros are there? 3
Answer A macro is a constant variable that gets initialized in a program here with the
help of a preprocessor. There are two types of macros, namely object type
macros and function type macros. An object type macro is one which is simply
a variable name with a value attached to it while a function type macro is one
which is of the form of expression.
10 Question Can you run an Arduino code in Raspberry Pi or any other 3
microcontroller or embedded system?
Answer The Arduino code makes extensive use of pre-built libraries that are only
available on the Arduino platform and would not operate on any other.
However, as the original Arduino code is based on C++, one can delete the
lines of code containing the prebuilt libraries from their code and use it to run
on any other C++ platform while making minimal changes to the code.
11 Question What is the difference between an IDE and a compiler? 3
Answer According to the primary definitions of a compiler and an IDE, the job of
debugging and executing a piece of code falls on the compiler, while the job
of the IDE is to provide an easy to use environment for writing the code in the
first place.
12 Question Is it possible to load external generic C/C++ libraries into the Arduino 3
IDE and use them in the code?
Answer Yes, Arduino programming language is a subset of C++, any existing C/C++
library can be imported into an Arduino programme. Because the Arduino
environment is mostly open-source, there are no restrictions on using
additional libraries.
13 Question On each startup of the Arduino System, how many times does the loop() 3
function run?
Answer The loop() function is commonly used to perform the majority of the
calculations required to keep the Arduino project running. Once the Arduino
has been properly launched and the setup() code has been invoked once, it is
preprogramed to continue indefinitely.
14 Question What is the output of the output on the Serial Monitor for the program
given below if the input supplied to pin1 is of the form 0111?
1. int pin1=11;
2. void setup() {
3. pinMode(pin1,INPUT);
4. Serial.begin(9600);
5. }
6. void loop() {
7. if(digitalRead(pin1)==1) {
8. Serial.print(“1 0”);
9. }
10. else {
11. Serial.print(“-1 0”);
12. }
13. }
Answer -1 0 0 1 0 1 0
The above code prints a 1 and a 0 for every digital HIGH signal that it receives
and prints a -1 and 0 for every digital LOW that it receives. This is the premise
for the method of RZ Encoding. It is used in telecommunications for sending
and receiving signals.
15 Question How many times does the code give a digital HIGH signal at pin1? 3
1. int pin1=11;
2. int x=3;
3. void setup() {
4. pinMode(pin1,OUTPUT);
5. }
6. void loop() {
7. for(int i=x;i<6;i++) {
8. if(i%2==0) {
9. x=x+1;
10. loop();
11. }
12. else {
13. digitalWrite(pin1,HIGH);
14. digitalWrite(pin1,LOW);
15. }
16. }
17. }
Answer 2
The code uses the global variable 'x' to define the for-lower loop's limit or
beginning point. The control then returns to line 7 and begins running from
there anytime the value of 'x' hits an even number, incrementing the value of
'x' and then calling the loop() method again. This is a nested loop example that
uses both recursive and iterative methods.
16 Question Is it possible to utilise the loop() function in place of the setup() method? 3
Answer Yes, because both the loop() and setup() functions are custom predefined
functions in the Arduino Environment, the loop() function can theoretically
entirely replace the setup() function. However, the developer would have to
do extra work since he or she would have to figure out how to make
configuration code execute only once.
17 Question Can the loop() function be called recursively? 3
Answer The Arduino Programming Language is a subsystem of the C++ Programming
Language that works. Any function can be called recursively at any point in
the programme as a result of this. Because loop() is a custom predefined
function in the Arduino Ecosystem, it must adhere to the same rules.
18 Question Is it syntactically correct to write the loop() function over the setup() 3
function while writing an Arduino program?
Answer The Arduino programming language is a subset of the C++ programming
language, so therefore it supports a bottom-up approach and is an object-
oriented programming language, making it irrelevant where the functions are
declared.
19 Question Write a code in order to generate an output signal of the form given 3
below?
void Setup() {
pinMode(‘A0’,OUTPUT);
analogwrite(100,’A0’);
}
void loop() {
//Do Nothing
}
a) 1
Answer There are 3 errors in the code given above. They are present in lines 1 and 3.
Here, the setup() function’s name is spelled incorrectly with a capital ‘S’, in
line 3 the arguments of the analogWrite() function are swapped, and the
function’s name is again spelled incorrectly as the ‘w’ should be a capital
letter.
No. UNIT IV CO
1 Question Which instruction set architecture is used in Raspberry Pi? 4
Answer ARM assembler is used in Raspberry Pi. Machine language is built up from discrete statements
or instructions implemented by a particular processor.
2 Question Does Raspberry Pi need external hardware? 4
Answer The RPi can be used without additional hardware (except perhaps a power supply of some kind),
it won’t be much use as a general computer. As with any normal PC, it is likely you need some
additional hardware.
Steps:
12 Question Can Raspberry Pi be used as a server? 4
Answer The Raspberry Pi can be used as a web server on your main local network or the internet at large.
It is a great selection in cases where you want an intranet for the office or a web development
server. You can create a local Pi webserver to deliver various contents while you are surfing
over the internet. To make the webserver operational, the Raspberry Pi should be connected to
the local network.
13 Question Give a brief overview about Raspberry Pi components 4
Memory: The Raspberry Pi model Aboard has 256MB of SDRAM, whereas the Raspberry Pi
model B has 51MB. In comparison to other PCs, the Raspberry Pi is a small computer. The
RAM memory on most PCs is measured in gigabytes. However, the RAM memory on the
Raspberry Pi board is greater than 256MB or 512MB.
CPU (Central Processing Unit): The Raspberry Pi board's central processor unit (CPU) is
responsible for carrying out the computer's instructions through logical and mathematical
calculations. The Raspberry Pi is powered by an ARM11 processor.
GPU (Graphics Processing Unit): The GPU is a specialized component in the Raspberry Pi
board that is meant to accelerate picture calculating operations. This board features a Broadcom
video core IV with OpenGL support.
Ethernet Port: The Raspberry Pi's Ethernet port serves as the primary interface for
communicating with other devices. The Ethernet port on the Raspberry Pi is used to connect to
the internet via your home router.
Pins for GPIO: The Raspberry Pi's general-purpose input and output pins are used to connect
to other electrical boards. Based on raspberry pi programming, these pins can accept input and
output commands. Digital GPIO pins are available on the Raspberry Pi. Other electronic
components are connected to these pins. For example, you can connect it to the temperature
sensor to transmit digital data.
XBee Socket: The XBee socket is used for wireless communication on the Raspberry Pi board.
Power Source Connector: The power source connector is a little switch on the shield's side.
The power source connector's principal function is to enable an external power source.
Display: The Raspberry Pi board has two types of display connection options: HDMI and
Composite. Using an HDMI male cable and a low-cost adaptor, several LCD and HD TV
displays may be connected. HDMI versions 1.3 and 1.4 are supported, with the 1.4 version cable
being suggested. The Raspberry Pi's O/Ps support audio and video over HMDI, but not HDMI
I/p. Composite video can be used to connect older televisions. Audio is accessible from the
3.5mm jack socket and can be delivered to your TV when using a composite video connection.
A cable that adapts from 3.5mm to double RCA connectors is required to broadcast audio to
your TV.
14 Question Where is IoT Raspberry Pi’s used? 4
Answer IoT Raspberry Pi can be used in a wide variety of tasks. It’s ideal and best suitable for projects
where there is a computer requirement but you don’t require much processing power, you want
to keep the costs low and want to save on space.
No. UNIT V CO
1 Question Design a Raspberry pi google assistant. 5
2 Question Design a project for humidity and temperature measurement using Arduino. 5
3 Question Design a project for RFID technology using Arduino. 5
4 Question Design a project for RFID technology using Raspberry pi. 5
5 Question Design a project for smart home security using Arduino. 5
6 Question Design a project for object identification using Arduino. 5
7 Question Design a project for object identification using Arduino. 5
8 Question Design a project for LED blinking with Bluetooth module and Arduino. 5
9 Question Design a project for seven segment display using Arduino. 5
10 Question Design a project for playing tones and a melody using Arduino. 5
11 Question Design a project for playing tones and a melody using Raspberry pi. 5
12 Question Design a project for TV control using IR sensor and Arduino. 5