### Addressing 5 ROM Chips, Each of 4 KB Using 74LS138 Decoder

Addressing 5 ROM Chips, Each of 4 KB Using 74LS138 Decoder:

The following diagram is representing the addressing of 5 ROM chips using 74LS138 where each chip is of 4 KB.

### How can we interface the microprocessor with analog world? Explain with necessary figure.

Interfacing the Microprocessor with Analog World: As computer used digital binary values whereas we have physical variables, a step by step process is used to convert the physical variable to binary data and again to physical variable. The figure is given below

### How can you control LEDs using microprocessor via 82C55A PPI? Draw the interface diagram & write the necessary assembly codes.

Controlling LEDs Using Microprocessor VIA 82C55A:

### What are the purpose of using command byte A and command byte B on 82C55A? Explain with suitable example.

Purpose of Using Command Byte A: Command byte A is used select modes, working functions of the ports. So the importance of using command byte A is that we can define on which mode it will be working on and which port will be used for which function such as input or output.

For example, consider the following bit format

### What will be the arrangement of ports on 82C55A PPI for the following bit format of command byte A, 10000010

The given bit format is as follows,

 7 6 5 4 3 2 1 0 1 0 0 0 0 0 1 0

Arrangement of Ports Due to Given Bit Format:

### What will be the bit format of command byte A in 82C55A PPI for these arrangement, (i) Mode 0, Port A as input, port B and port C as output. (ii) Mode 1, port A as output, port B as input.

(i) Required Bit Format of command byte A:

### Draw the command byte A and command byte B of 82C55A PPI.

Command Byte A and Command Byte B:

### Draw the pin-out diagram of 82C55A PPI. How many modes you can select on 82C55A PPI? Explain.

Pin-Out Diagram of 82C55A:

### Handshaking:

Handshaking is a I/O control method to synchronize I/O devices with the microprocessor. As many I/O devices accepts or release information at a much slower rate than the microprocessor, this method is used to control the microprocessor to work with a I/O device at the I/O devices data transfer rate.

### Write the differences between Isolated I/O and Memory Mapped I/O.

Memory Mapped I/O and Isolated I/O are two methods of performing input-output operations between CPU and installed peripherals in the system. Memory mapped I/O uses the same address bus to connect both primary memory and memory of hardware devices. Thus the instruction to address a section or portion or segment of RAM can also be used to address a memory location of a hardware device.

On the other hand, isolated I/O uses separate instruction classes to access primary memory and device memory. In this case, I/O devices have separate address space either by separate I/O pin on CPU or by entire separate bus. As it separates general memory addresses with I/O devices, it is called isolated I/O.

Port : A port is an adapter which enables a system to communicate with its input/output devices. Using port user can connect I/O devices and use them. There various types of port such as parallel port, serial port etc.

Differences Between Fixed Port and Variable Port Addressing

### Write about hamming technique of error detection and correction in the case of a 4-bit data.

Hamming Technique (7,4) : In this case, we will have 4 bits of data and we will add 3 bits of redundant with the data by calculating the 4-bit data. For example, taking a 4-bit data as,

The encoder will encode the data as follows

### Write about a way to detect error./a single bit error/Write about parity check method.

Error Detection or Parity Check Method : A general way to detect errors is to append a special bit to every word. One popular technique employs a single check bit called parity bit. The parity bit is append to an n-bit word X = x0, x1,....., xn-1  to

### What is error? Define error detection and correction.

Error : Various factors like manufacturing defects to environmental effects cause errors in computation. Such errors frequently appear when information is being transmitted between two relatively distant points within a

### Comparing Different Types of Memories in Terms of Cost & Performance:

The best way to measure the cost of a memory device is the purchase price of a complete unit of its. Let C be the price in dollars of a complete memory system with S bits of storage capacity. The cost c of the memory will be defined as follows,
The performance is determined by the rate at which data can be read or written from/ onto the device.

When taking reading time the parameter will be called read access time. This will depend on the storage and access mechanism used by the device.

Low cost and high performance is always demanded. But these can not be obtained at once, as the performance will increase along with the cost and vice versa. Considering the following given figure. It indicates several types of memories arranged on a graph showing access time and cost at a time.
Here it can be seen that, faster memory RAM will take very little access time but with a higher cost. On the other hand slow storage medium magnetic tapes will cost a little. Thus based on the necessity one will have to choose the memories. Such as, main memories are attached with overall performance of the computer system, so one will have to have sufficient RAM in one’s system. When considering for secondary memory, based on necessity of the user that is if the user is in a need to store huge amount of data he will have to choose magnetic disks is large amount. On the other hand for the use of safe removal storage the optical disks are great choice.

So the comparison concludes that the better performance will demand greater cost and vice versa. But one thing that should be kept in mind that main and secondary memory should be chosen differently as because main memory serves the processor to perform where the secondary memory will serve the user for storage.

### Organization of Multilevel Memory System:

A CPU should have rapid, uninterrupted access to its external memories to operate at or near at its maximum speed. But memories that operate at speed near to that of CPU are expensive. That’s why different level of memories is used in terms of performance and costs. Below is the flow-diagram of the conceptual organization of multilevel memories in a computer system.

### Describe the Von Neumann Architecture or IAS architecture.

Von Neumann Architecture: In 1947 John Von Neumann developed an architecture of a new stored-programmed electronic computer which is also referred as the IAS computer as the Institute for Advanced Studies in Princeton. Key concepts of that design are as follows

### Expanded Structure of Von Neumann Architecture

The expanded structure of the Von Neumann Architecture or the IAS computer is given below,

### Working Principles of 8086 Microprocessor

Execution of instructions can be used to explain the working principles of the microprocessor. This is given below,

### Purpose of using flag registers.

FLAGS : 8086 has 16 flag registers among which 9 are active. The purpose of the FLAGS register is to indicate the status of the processor. It does this by setting the individual bits called flags. There are two kinds of FLAGS;

### CS (Code Segment) :

Code segment (CS) is a 16-bit register containing address of 64 KB segment with processor instructions. The processor uses CS segment for all accesses to instructions referenced by instruction pointer (IP) register. CS register cannot be changed directly. The CS register is automatically updated during far jump, far call and far return instructions.

### Purposes of having general registers (AX,BX,CX,DX,SP,BP,SI,DI) and ALU (arithmetic and logic unit) in 8086

General Registers : All general registers of the 8086 microprocessor can be used for arithmetic and logic operations. The general registers are:

### Purpose of using Instruction Queue

Purpose of using Instruction Queue: BIU contains an instruction queue. When the EU executes instructions, the BIU gets up to 6 bytes of the next instruction and stores them in the instruction queue and this process is called instruction prefetch. This is a process to speed up the processor. A subtle advantage of instruction queue is that, as next several instructions are usually in the queue, the BIU can access memory at a somewhat "leisurely" pace. This means that slow-memory parts can be used without affecting overall system performance.

### Write short note on the Execution Unit (EU) and the Bus Interface Unit (BIU).

8086 microprocessor has two units; Execution Unit (EU) and Bus Interface Unit (BIU). They are dependent and get worked by each other. Below is a short description of these two units.

Execution Unit (EU) : Execution unit receives program instruction codes and data from the BIU, executes them and stores

### Draw the internal architecture of 8086 microprocessor.

Internal Architecture of 8086 Microprocessor : The figure given Below is the internal architecture of 8086 microprocessor

### My Works | Binary Tree is Sum tree or Not

Problem : Binary Tree is Sum tree or Not. [Problem was taken from this link]

Explanation: Write a function which returns True if the given binary tree is a Sum Tree, else False. A sum tree a is a binary tree where the value of a node is the summation of the subtree at both its left and right. An empty tree is also a sum tree and value of its sum can be considered as 0. A leaf node is also considered as sum tree. For example, following is a sum tree,

26
/    \
10     3
/  \    /
6   4  3

My Solution: Well, I decided some definitions here. Like, first of all, I used Complete Binary Tree in my solution.

### HTML | Tags and Attributes [Frame] [Knowing More Attributes]

Ü Knowing the attributes : Consider the following coding,
<FRAME NAME=”..” SRC=”..” FRAMEBORDER=”..” NORESIZE SCROLLING=”..”
BORDERCOLOR=”…”>
**To link the frame to a page we will give the location of the page as the value of the SRC attribute.
**To specify that there will be border around the frame or not, we will give the value of the FRAMEBORDER attribute.

### HTML | Tags and Attributes [Frame] [Subdividing the frames]

Ü Subdividing the frames : Now, again consider the following part of the above input,
<FRAMESET ROWS="250,250,*">
<FRAME NAME=”TOP”>
<FRAME NAME=”Middle”>
<FRAME NAME=”Bottom”>
</FRAMESET>
We have told that, each frame is a particular window to view a page. So we can also subdivide each frame. Consider the above input. We have fist of all divided the window into 3 rows and then gave them name.

### HTML | Tags and Attributes [Frame] [Create frames ]

Ü How to create frames ?
Frames are particular spaces of the browser window. We can divide the total browser window in different portions by any number of frames. Each of the portions of the window then called a frame. Each frame will contain a HTML page. Thus by creating frames we display more than one page at a time on a browser window.

To create frames we will use the tag <FRAMESET >……….</FRAMESET> tags after

### HTML | Tags and Attributes [Multimedia] [Add Video]

Ü Attaching video file : Attaching video file is similar the second process of attaching audio file.

<EMBED SRC=”…” AUTOSTART=”..” HEIGHT=”..” WIDTH=”..” LOOP=”..” ALIGN=”..” HIDDEN=”..  ”>

### HTML | Tags and Attributes [Multimedia] [Add Audio/Sound]

Ü Attaching sound file : There are two tags to add an audio file to a HTML document. First one is as follows,
<BGSOUND SRC="…..">
The value of the SRC attribute will be the location of the sound file. We will have to use that tag after the </HEAD> tag and before the <BODY> tag as follows,
<BGSOUND SRC="……">
<BODY>
</BODY></HTML>
When adding sound files like this, the sound will be playing at background; there will be no control on the sound.
Second process

### HTML | Tags and Attributes [Multimedia] [Add Image]

Ü Attaching image to a HTML document : To attach image to a HTML document one will have set the following code,
<IMG SRC=”..” BORDER=”..” HEIGHT=”..” WIDTH=”..” ALIGN=”..”>

 Attribute Description SRC=”..” The value of SRC attribute specifies the image file location. BORDER=”..” The value of BORDER attribute specifies the width of the border around the image. HEIGHT=”..” It specifies the height of the image WIDTH=”..” It specifies the width of the image ALIGN=”..” It is used to align the image, values are LEFT, RIGHT and CENTER
Now consider the following input and output.

### HTML | Tags and Attributes [TABLE] [Formatting] [Cell and Table Alignment & Border Color]

Ü Adjusting cell and table alignment and border color : To adjust the table alignment use the ALIGN attribute between the <TABLE> tag, whose values are LEFT, RIGHT and CENTER.
To align the contents or data of a cell, we will use the ALIGN and VALIGN attributes between the <TH> and <TD> tags. The value of the ALIGN attribute can be LEFT, RIGHT and CENTER. The value of the VALIGN attribute can be TOP, MIDDLE, BOTTOM and BASELINE.

### HTML | Tags and Attributes [TABLE] [Formatting] [Cell spacing and cell padding ]

Ü Adjust cell spacing and cell padding : The value of CELLSPACING specifies the amount of space between the cells and the value of CELLPADDING specifies the space between the border and the cell data. Use these tags between the <TABLE> tags. We can use them also in <TH> and <TD> tag for results in a particular cell. See the following image to understand, The above figures are the output of the following input,

### HTML | Tags and Attributes [TABLE] [Formatting] [Background color and images]

Ü Including background color and images : To include background color, we will need to add the attribute BGCOLOR in the <TABLE> tag as follows,
<TABLE BGCOLOR=”……”>
The value of the BGCOLOR attribute will be the background color of the table. But we can use that BGCOLOR attribute in the <TH> and <TD> tag also. Doing so, each cell can be colored differently

### HTML | Tags and Attributes [TABLE] [Captions]

ÜHow to use captions ?
To use caption, which is actually the title of the table, will be putted in the <CAPTION>….</CAPTION> tags just after the <TABLE> tag as follows,
<TABLE>
<CAPTION>……………</CAPTION>
Whatever we will write in between the <CAPTION>….</CAPTION> tags will be the caption of the table. Now, consider the following input for caption

### HTML | Tags and Attributes [TABLE] [Spanning]

Ü To span rows and columns, we will use the ROWSSPAN and the COLSPAN attributes respectively. These attributes are used in the <TH> and in the <TD> tags. To understand ROWSPAN consider the following input.

### HTML | Tags and Attributes [TABLE] [Width]

Ü To create a table of specific width, we will use the WIDTH attribute in the <TABLE> tag as follows,
<TABLE WIDTH=50>
Or
<TABLE WIDTH=75%>
When we will give the value of the attribute WIDTH in numbers, such as 50, the width of the table will be 50 pixels, and when we will give the value of in percentage, such as 75%, the width of the table will be 75% of the window.

Now we will create a table using these attributes

### HTML | Tags and Attributes [TABLE] [Basic Tags]

Look at the following table first,

 | Basic Table Tags Tag Use Use to form tables.
Each under a
Marks a heading cell within a row
Use to create a row in a table. creates a cell in a row.
From this chart we can understand the tags. Now using these tags we will create a simple table. Follow the following input and its output

### HTML | Tags and Attributes [FORM] [Select Fields or Option Fields]

Ü How we can include select fields or option fields?
A select field is a drop down list of options. Consider the following coding,
<SELECT NAME=”......” SIZE=”....”  MULTIPLE>
<OPTION VALUE=”.......” SELECTED>--------
<OPTION VALUE=”......”>---------
<OPTION VALUE=”......”>---------
<OPTION VALUE=”......”>---------
</SELECT>
First of all we will have to set a <SELECT> tag. In it, we will use the NAME attribute and its value may be any thing we want. The next attribute is SIZE. This is used to define the number of options will be displayed

### HTML | Tags and Attributes [FORM] [Text Area]

Ü how to create text area?
Text areas are areas where user can write a large amount of text (depend on the coding). Actually in web sites, text areas are use to take comment or feedback from the viewers. To create text areas consider the following code,
<TEXTAREA NAME=”.....” ROWS=”......” COLS=”.......”>-----</TEXTAREA>
That is, to create text area we will

### HTML | Tags and Attributes [FORM] [Password Fields]

Ü How we can create password fields ?
To create password fields, we will use the <INPUT> tag in between the <FORM>...</FORM> tags. First of all, consider the following example,
<INPUT TYPE=”.........” NAME=”.....” SIZE=”...” MAXLENGTH=”......”>
Here the TYPE will be obviously PASSWORD

### HTML | Tags and Attributes [FORM] [Checkbox]

Ü How to include Checkboxes ?
To create Check Box’s, in the above input replace RADIO with CHECKBOX. The values of NAME and VALUE attributes all can differ. We can use the CHECKED attribute in any number of options. A simple example with output is given below

### HTML | Tags and Attributes [FORM] [Radio Buttons]

Ü How to include Radio Buttons?
Radio buttons mainly offer to choose an option from many. That is, user can select only one option. First, consider the following code,
<INPUT TYPE=”...” NAME=”...” VALUE=”...” >
Here in the case of radio buttons the TYPE will be RADIO. For all of the options we will have to give same value of the NAME attribute. That is for a group

### HTML | Tags and Attributes [FORM] [Text and Input Box]

Ü How to include Text Fields or Input Fields?
To include a text field we will input the <INPUT> tag in between the <FORM>....</FORM> tags. Consider the following,
<INPUT TYPE=”....” NAME=”....” VALUE=”....” SIZE=”...” MAXLENGTH=”....” >
The uses of the various attributes in the above code are given below

### HTML | Tags and Attributes [FORM] [BUTTON]

Ü How to create button in a form ?

To create a form we use <FORM>...</FORM> tags. To create a form with buttons we need to use the following,
<INPUT TYPE=”....” VALUE=”......”>
We can use three values of the attribute TYPE, they are SUBMIT, RESET, IMAGE. What we give as the value of the VALUE attribute

### Problem:

We hope we are all known with the game Tic-Tac-Toe. Well, if we are not, we will be soon. You will not have to build any artificial intelligence for the game as the game will be played by two human, I mean users. Lets get into it.....

In a Tic Tac Toe game there will be a board with minimum 9 cells as follows.

### Problem:

In a given matrix all the cells will contain a value of 1 or 0. Change the value of a cell to 1 if the summation of its 8 adjacent cells are 3 or greater than 3, otherwise change the value to 0. Boundary cells can have 3 or 5 or less adjacent cells depending on the size of the matrix, so for boundary cells you will have to calculate over them. The number of rows and columns will be equal. For example, you might be given a 8x8 matrix. The values will be given by the user. You can keep the number of cells 8x8 or you can make it variable or user inputted.

### My Works | Matrix Problem 01

Problem: Set all cells of row i and column j to 0.

Given a matrix of 1s and 0s. Implement an algorithm that sets all cells of row i and column j to 0 if the original matrix has a 0 in cell(i,j). Would the algorithm change if you have to set it to 1 instead of 0?

Solution: The algorithm is as follows,

Mat_one_0_all_0(row,col,mat)
supposing a two dimensional array mat is containing the matrix which is mat[row,col]. Here row is the number of rows and col is the number of column. i, j, m are three loop counter variable.

01. For i = 1 to row
For j = 1 to col
If mat[i,j] = 0 Then
For m = 1 to col
mat[i,m] := 0           |Line 01|
Next m
For m = 1 to row
mat[m,j] := 0           |Line 02|
Next m
End If
Next j
Next i

This will do the job.  Now, this algorithm has to change at Line 01 and Line 02 as,

mat[i,m] := 1
mat[m,j] := 1

respectively if we want to set 1 instead of 0. But, if we have to take decision from the user that what we will have set (1 or 0) when we get a 0, then the algorithm will be changed a little like the following.

Mat_one_0_all_0(row,col,mat)
supposing a two dimensional array mat is containing the matrix which is mat[row,col]. Here row is the number of rows and col is the number of column. i, j, m are three loop counter variable. 'change' is the variable to store the user's choice.

01. Take input in 'change'

02. For i = 1 to row
For j = 1 to col
If mat[i,j] = 0 Then
For m = 1 to col
mat[i,m] := change
Next m
For m = 1 to row
mat[m,j] := change
Next m
End If
Next j
Next i

I hope it will do.