mechatronics unit II by ffMGVii.pptxfinal - Copy
mechatronics unit II by ffMGVii.pptxfinal - Copy
Module-II
Microprocessor &Microcontrollers
By
Input and output interfaces to handle communications between the computer and
outside world the term port is used for the interface.
•For relatively larger control applications more than a hundred and comparatively
less number of actuators used and this again depends on control at hand.
• RD goes high for data read operations.WR in similar context goes high for data write
operations. CE (enable) signal has to be given for a chip solutions. The memory chip must
be selected if read (or) write operations are to be carried out.
• Memory space is the range of memory locations that a microprocessor can address. The
number of address lines determines the memory space. Microprocessor with 16 bit and 24
bit address lines have 216 = 64K and 224= 16M of memory space respectively.
Maruthi G Venkat, Assistant 21
professor, STJIT Ranebennur.
INPUT AND PERIPHERAL DEVICES
• I/O stands for input and output. I/O and peripheral devices are sensors, actuators,
switches, A/D converters, D/A converter PWM (pulse width modulators), ports,
• I think you already know that data flows in and out of the CPU. The data may come
from the A/D converter (which may been obtained from the transducer (or) sensor) (or)
from some other locations within the microprocessor based systems. This is called data
transaction.
•The CPU requires some temporary storage cells so that intermediate data can be stored
temporarily either for data transactions (or) for later use, The temporary storage cells are
called temporary registers.
•Program Counter, called PC, is a register that holds the next address of the instruction. At the
end of the execution of the current instruction, the content one of the PC (the next address) is
transferred to the memory and decoded ln order to get the next item of the executable code.
The next item could be a data or an instruction.
•PC is the main functional unit of microprocessor. If the entire program (executable code) is 16
bytes long and is stored in a location starting from 2000H to 200F, then the PC starts
addressing 2000H to 200F sequentially in order make it possible to fetch program bytes from
these locations one-by-one The address of the next location of the memory location is being
addressed at the end of the current cycle.
• Currently the microprocessor has just completed the execution of the program byte located at
200B, while the PC at this instant holds the address of the next location, which is 200C via the
on buffer.
Maruthi G Venkat, Assistant 30
professor, STJIT Ranebennur.
Program Counter
•The flag register in the microprocessor is a special purpose register in which the individual bit values
represents the standing of a result byte. The flag bits are automatically modified in accordance with the
result and the type of operation performed.
•The result byte could be a positive or negative number (after mathematical operation is over), and a
dedicated flag bit implies this piece of information, i.e. whether the result is positive or negative.
•In another situation , the result byte could be indicates this information i.e. whether the result is zero.
The microprocessor tests the result of the operation, and the test result is thus stored in the flag register.
•The flag bits in many situations are more important than result itself. The programmer, when
necessary, uses the tested and recorded flag bits.
• Following flag bits are common within the design and construction of most of the microprocessor and
micro controllers.
Maruthi G Venkat, Assistant 32
professor, STJIT Ranebennur.
Fetch Cycle
•The microprocessor fetches the OPCODE or data from the memory or input devices as follows. The
content o1 the PC, the address is placed in the MAR.
• The content of the MAR is then transferred to the decoder, which is interfaced or in built with the
memory device . The decoder decodes the address, and selects the appropriate location according to the
address supplied to it.
•The content of the specified address is read and transferred into the microprocessor.
If the item read is an OPCODE, then it is placed in the Instruction Register, and if the item read is data,
then it is placed in the Data Register. This is a fetch cycle or memory read cycle.
•During writing operation, the microprocessor transfers the content of the PC to the
memory decoder through the MAR. Microprocessor uses WR (Write) signal for writing into
the memory.
OPCODE, operands and address bytes are transferred through bus. A bus is a transmitting media
consisting of group of lines. The number of lines are usually 8, 16, 32, etc. They connect each
and every unit within the microprocessor. Some buses are bi-directional and some are
Unidirectional meaning the bi-directional buses transfers data in both directions,
where as unidirectional buses carries data in only one direction. Buses, which carry address
and data are called Address bus and data -bus, respectively. They may be external or internal.
Some buses are used in multiplexed mode. For example, in one occasion they are used as address
bus, and in another occasion they are used as data bus. Time Division Multiplexing (TDM) is
used with regard to multiplexed mode operation.
The accumulator is 8-bit register (can store 8 bit data). It is a part of arithmetic/logic unit (ALU). In general,
after performing logical or arithmetical operations, result is stored in accumulator. Accumulator is also
identified as Register A.
Figure 3.2.2 shows a 8-bit flag register, adjacent to the accumulator. It is not used as a
register. Out of eight bit-positions, five positions are used to store the outputs of five
flip-flops.
These flags play an important role in decision-making process of the
microprocessor.
G. Control Generator
In microprocessor, the Control Generator generates a signal that executes the operations in accordance to
the decoded instructions. In fact it creates a signal (information) which have details about connections
between different blocks of the microprocessor so that data reaches to the respective place.