Odd-even program in 8051




















Register indirect addressing mode: The register indirect addressing uses only register R0 or R1 to hold address of the data in internal RAM, these two registers are also referred to as pointer registers or simply pointers. The symbol is used along with R0 or R1 to indicate indirect addressing.

The final address is formed by adding these two registers. It results in a forward reference of 0 to bytes from the base address. They are used to access only program memory internal as well as external Indexed addressing is used to access data tables lookup tables from the program memory and implementing jump tables. They are also suitable for multidimensional array operations. After reset, the contents of internal memory of with address 0AH and 0BH contains data 22H and 33H, respectively.

Write a subroutine which checks the content of 20H. What are assembler directives? Explain any four of them. The assembler directives are the statements that directs the assembler what to do during assembling. They reserve memory space for data, define constants, and tell assembler where to assemble program in a memory. They are also referred as pseudo instructions statements as they are effective only during the assembly of the program but they do not generate any machine code.

The number after the ORG can be in hex or decimal. If the number is decimal, the assembler will For the binary numbers B is as a suffix. Similarly, H is used after hexadecimal numbers. Irrespective of the type of the byte, the assembler will convert the byte to hex. The DB is also used to allocate memory in byte sized chunks.

Define Word- DW This directive defines 16 bit variable. END End directive tells the assembler to stop assembling. Programmer should refer documents or help for the assembler in use. Display the digital value on LEDs connected to Port SETB P3. What is the difference between timer and counter operation of ? Figure The clock source for the timer circuits is external pulses on pin T0 Pin 14 or T1 Pin 15 of microcontroller for timer 0 and timer 1 respectively.

The output of AND gate is used to control the switch which will connect clock signal to the timer stages for their operation. When output of AND gate is 1, the switch is closed and the clock signal is applied to the timer stage and the timer starts its operation.

See dotted line in the figure The hardware control of timers is achieved when Gate bit is programmed to one i. See dotted line in figure This feature allows the pulse width measurement i. Explain briefly the interrupts of , indicate their vector addresses.

Five interrupts are available in the Three of them are internal interrupts i. For each interrupt source there is a fixed location in a program memory that contains its interrupt service routine ISR. This part of memory which stores the ISRs is called the interrupt vector table. It is shown in Table Table When any interrupt is generated or asserted , it forces the microcontroller to jump to fixed address in vector table.

For example when INT0 is asserted, microcontroller will automatically jump to memory address H, similarly for timer1 interrupt, it will jump to address BH in interrupt vector table. Since program execution is transferred to fixed location corresponding to each interrupt source, the interrupts in the are also referred as vectored interrupts.

The interrupt vector table of the is shown in figure When INT0 interrupt is asserted, it will force the program execution to start at address H, at this address LJMP instruction is written which in turn divert the program execution at address H see figure This approach will increase the interrupt response time. For detail Discussion refer topic Assume XTAL frequency as What is the minimum frequency that can be generated?

For mode 1 The minimum count is , the delay that can be generated is cycles for half cycle. Therefore, the time for one cycle is x 2x 1. The minimum count is 00, the delay that can be generated is cycles for half cycle.

Explain the function of the pins of 9-pin RS connector. The nine signals of DB9 connector are shown in the following Table. Then the modem at the other end receiver end is dialed. This modem usually in answer mode replies by sending a signal at Then we need two pointers one for source second for destination.

Mov r7, 0Ah ; initialize counter by 10d. Mov r0, 20h ; get initial source location. Mov dptr, h ; get initial destination location. Nxt: Mov a, r0 ; get first content in acc. Movx dptr, a ; move it to external location. Inc r0 ; increment source location. Inc dptr ; increase destination location. Djnz r7, nxt ; decrease r7. Statement 6: — find out how many equal bytes between two memory blocks 10h to 20h and 20h to 30h. Solution: — here we shall compare each byte one by one from both blocks.

Increase the count every time when equal bytes are found. Mov r0, 10h ; get initial location of block1. Mov r1, 20h ; get initial location of block2. Mov r6, 00h ; equal byte counter.

Starts from zero. Nxt: Mov a, r0 ; get content of block 1 in acc. Mov a, r1 ; get content of block 2 in acc. Cjne a, b, nomatch ; compare both if equal. Inc r6 ; increment the counter. Nomatch: inc r0 ; otherwise go for second number. Inc r1. Statement 7: — given block of h to h. Find out how many bytes from this block are greater then the number in r2 and less then number in r3.

Store the count in r4. Solution: — in this program, we shall take each byte one by one from given block. Now here two limits are given higher limit in r3 and lower limit in r2.

So we check first higher limit and then lower limit if the byte is in between these limits then count will be incremented. Mov dptr, h ; get initial location.

Mov r7, 0FFh ; counter. Mov r4, 00h ; number counter. Mov 20h, r2 ; get the upper and lower limits in. Mov 21h, r3 ; 20h and 21h. Nxt: Movx a, dptr ; get the content in acc. Cjne a, 21h, lower ; check the upper limit first. Sjmp out ; if number is larger. Lower: jnc out ; jump out. Cjne a, 20h, limit ; check lower limit. Sjmp out ; if number is lower. Limit: jc out ; jump out. Inc r4 ; if number within limit increment count.

Out: inc dptr ; get next location. Djnz r7, nxt ; repeat until block completes. Statement the crystal frequency is given as 12 MHz. Make a subroutine that will generate delay of exact 1 ms. He believes that hav Q: Simplify the following Boolean functions with the Karnaugh map and tabulation method, then construct Q: Design a project to calculate S , depending on the value of C , and according to the given equatio A: According to the expression given:- We have to validate is it true or not.

Q: Q3. Convert the following C code into ARM64 assembly code, add comments to some critical assembly li A: We are given a c code and we need to convert it into ARM64 assemble code. O To make sure the physical security of an organization is suf Q: Powershell command only! Q: Q2 Deign a project to calculate the value of the series S. A: Note: Answering the code in VB as no programing language is mentioned.

Task : Calculate the value o A: in matlabs a marker is used to put a point in plot or surface to represent a point. These markers co What is the height of this rooted tree?

A: The height of a tree is the maximum number of edges that are present from root node to the leaf node. Q: What are some of the various ways to implement an awareness program? A: Answer : Some of the various ways to implement an awareness program are : Provide a course for the r Q: Part 2: Use the following relations to answer question 4.

A: a is join b Projection give attributes and union give without duplicates. Q: What is the influence of the Sarbanes-Oxley Act on the job of information technology personnel? A: The Sarbanes Oxley Act had a direct influence on the corporate governance by strengthening audit com A: According to the Bartelby guideline we are suppose to answer one question at a time. Kindly repost t Q: write a method that will take the file name string as a parameter that is a file of jumbere and ret A: Answer: I have done code and also I have attached code as well as screenshot code.

A: Answer: I have done code and also I have attached code as well as code screenshot and output. A 7,4 linear block code, the generated matrix G and checking matrix H are 10 11 1 l10 rl A: The question is to find the codeword and checking a given codeword is correct or not. Q: Experiment 3 resource allocation management Aim: deepen the understanding and grasp of the concept o A: The above problem concerns with Banker's Algorithm in operating system which is used to allocate res Use s A: Answer: I have done code and also I have attached code as well as code screenshot.

Q: Define a rectangle class with length, witdh, coor x , coor y. Then write the following methods



0コメント

  • 1000 / 1000