Posts

Showing posts from September, 2020

Do an ALP programming to arrange numbers in ascending order.

ORG 0000H                                ;storing the program from 0000h location in ROM MOV R4,#05H                           ;load 05h in R5 AGAIN:                                       MOV DPTR,#9000H                 ;load 9000h in DPTR(initializing pointer) MOV R3,#05H                           ;load 05h in R3 BACK: MOVX A,@DPTR                   ;fetching data from XRAM MOV B,A                                  ;copy data of A to B INC DPTR             ...

Do programming for following task. Assume that bit P2.2 is used to control an outdoor light and bit P2.5 a light inside a building. Show how to turn on the outside light and turn off the inside one. Test result in SimHardware

ORG 0000H MOV A,#04H MOV P2,A END

Do an ALP programming to arrange numbers in decending order.

ORG 0000H MOV R4,#05H AGAIN:MOV DPTR,#9000H MOV R3,#05H BACK:    MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR MOV R1,A CJNE A,B,TARGET TARGET:  JC NOEXCHANGE MOV A,B MOVX @DPTR,A MOV A,R1 DEC DPL MOVX @DPTR,A INC DPTR NOEXCHANGE: DJNZ R3,BACK DJNZ R4,AGAIN END  

Do an ALP programming to find largest number in an array.

ORG 0000H MOV R5,#06H MOV DPTR,#4000H MOVX A,@DPTR MOV B,A BACK:INC DPTR MOVX A,@DPTR CJNE A,B,TARGET                                              ;COMPARE THE VALUE OF ACC AND B TARGET: JC NEXT                                                                 ;IF A IS SMALLER THAN B THEN JUMP MOV B,A                                                                ;IF A IS BIGGER THAN B THEN MOV DATA OF A INTO B NEXT:DJNZ R5,BACK  MOV DPTR,#4062H MOV A,B MOVX @DPTR,A END

Do an ALP programming to find smallest number in the array.

ORG 0000H MOV R5,#06H MOV DPTR,#4000H MOVX A,@DPTR MOV B,A BACK:INC DPTR MOVX A,@DPTR CJNE A,B,TARGET                                ;COMPARE THE VALUE OF A AND B TARGET: JNC NEXT                                                ;IF B IS SMALLER THAN A  THEN JUMP MOV B,A                                                   ;IF B IS BIGGER THAN A THEN MOV DATA OF A INTO B NEXT:DJNZ R5,BACK  MOV DPTR,#4062H MOV A,B MOVX @DPTR,A END 

Do an ALP programming to exchange a block of data from one external memory location to other.

Do programming for following task. A switch is connected to pin P1.7. Check the status of the switch and make the following decision. (a) If SW = 0, send “0” to P2 (b) If SW = 1, send “1“ to P2 Test result in SimHardware

ORG 0000H MOV 90H,#01H                              ;90H IS THE ADDRESS OF P1 PORT MOV A,P1 RRC A                                               ;WE CAN ALSO USED RLC INSTEAD OF RRC JC GO CLR A MOV P2,A SJMP L1 GO:MOV A,#0FFH MOV P2,A L1: END 

Do programming to see if the RAM location 37H contains an even value. If so, send it to P2. If not, make it even and then send it to P2. Test result in Simulator registers windows.

ORG 0000H MOV A,37H MOV B,#02H DIV AB MOV A,B CJNE A,00H,NEXT SJMP GO NEXT:INC 37H GO: MOV P2,37H END 

Do programming to toggle P1 a total of 200 times. Use RAM location 32H to hold your counter value instead of registers R0 –R7. Test result in SimHardware.

ORG 0000H MOV 32H,#0C8H MOV A,#0FFH AGAIN: MOV P1,A MOV R3,#08H BACK: DJNZ R3,BACK CPL A DJNZ 32H,AGAIN END 

Perform the subtraction of two 16-bit numbers using ALP.

;           F6 96 H  ;       -  C6 79 H  ;      =  30 1D H  ;R1=30H(MSB),    R0=1DH(LSB) ORG 0000H CLR C MOV A,#96H MOV R6,#79H SUBB A,R6 JNC GO CPL A INC A GO:MOV R0,A MOV A,#0F6H MOV R7,#0C6H SUBB A,R7 JNC GO1 CPL A INC A GO1:MOV R1,A END  

Perform the addition of two 16-bit numbers using ALP.

v ;   AF 88 H  ;+  89 7F H  ;= 139 07 H  ;R4=01H(MSB),R1=39H(LSB),R0=07H(LSB) ORG 0000H CLR C MOV A,#88H ADD A,#7FH JNC L1 INC R3 L1:MOV R0,A MOV A,#0AFH ADDC A,#89H JNC L2 INC R4 L2:MOV R1,A END 

Use assembly language program to sort an array of N = 06 h bytes of data in descending order stored from location 9000h.

ORG 0000H MOV R4,#06H AGAIN:MOV DPTR,#9000H MOV R3,#06H BACK:    MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR MOV R1,A CJNE A,B,TARGET TARGET:  JC NOEXCHANGE MOV A,B MOVX @DPTR,A MOV A,R1 DEC DPL MOVX @DPTR,A INC DPTR NOEXCHANGE: DJNZ R3,BACK DJNZ R4,AGAIN END  

Use assembly language program to sort an array of N = 06 h bytes of data in ascending order stored from location 9000h.

ORG 0000H MOV R4,#06H AGAIN:MOV DPTR,#9000H MOV R3,#06H BACK:    MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR MOV R1,A CJNE A,B,TARGET TARGET:  JNC NOEXCHANGE MOV A,B MOVX @DPTR,A MOV A,R1 DEC DPL MOVX @DPTR,A INC DPTR NOEXCHANGE: DJNZ R3,BACK DJNZ R4,AGAIN END   

Use assembly language program to find the largest element in a given array of N =_06_ h bytes at location 4000h. Store the largest element at location 4062h

ORG 0000H MOV DPTR,#4000H MOV R3,#05H MOVX A,@DPTR MOV B,A BACK:INC DPTR MOVX A,@DPTR CJNE A,B,TARGET TARGET: JC L1 MOV B,A L1: DJNZ R3,BACK MOV A,B MOV DPTR,#4062H MOVX @DPTR,A END  

Write an assembly language program to exchange N = ___h bytes of data at location A: _____h and at location B: _____h. Let N = 05h A: 30h B: 40h

ORG 0000H MOV R3,#05H MOV R0,#30H MOV R1,#40H BACK:MOV A,@R0 MOV R4,A MOV A,@R1 XCH A,R4 MOV @R1,A MOV A,R4 MOV @R0,A INC R0 INC R1 DJNZ R3,BACK END

Write an assembly language program to transfer N = ___ bytes of data from location A: _______h to location B: _______h. Let N = 05h, A: 30h B: 40h

ORG 0000H MOV R3,#05H MOV R0,#30H MOV R1,#40H BACK:MOV A,@R0 MOV @R1,A INC R0 INC R1 DJNZ R3,BACK END

Write a program to copy a block of 10 bytes of data from 35H to 60H

ORG 0000H MOV R3,#0AH MOV R0,#35H MOV R1,#60H BACK:MOV A,@R0 MOV @R1,A INC R0 INC R1 DJNZ R3,BACK END  

Write a program to clear 16 RAM locations starting at RAM address 60H

ORG 0000H MOV R3,#10H CLR A MOV R0,#60H BACK:MOV @R0,A INC R0 DJNZ R3,BACK END 

Do assembly language program to display 0 to 9 digit on seven segment LED display panel in 8051 MCU IDE

  ORG 0000H TARGET:MOV DPTR,#0100H BACK:CLR A MOVC A,@A+DPTR ACALL LOOP MOV P2,A INC DPTR CJNE A,00H,BACK SJMP TARGET ORG 0100H  DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,00H  LOOP: MOV R0,#003H  L2:MOV R1,#003H  L1:DJNZ R1,L1  DJNZ R0,L2  RET END

Do an assembly language programming to find whether given eight bit number is odd or even. If odd store 00h in accumulator. If even store FFh in accumulator

ORG 0000H MOV A,#31H MOV B,#02H DIV AB MOV R3,B CJNE R3,#00H,NEXT MOV A,#0FFH SJMP L1 NEXT: MOV A,#00H L1: END

Do an assembly language programming to count number of ones and zeros in a eight bit number.

  ;R5=ONES AND R4=ZEROS,R3=COUNTER ORG 0000H MOV R3,#08H MOV 20H,#0F0H MOV A,20H BACK: RRC A ;WE CAN USE RLC ALSO, BOTH WORK FOR THIS PROGRAM JC L1 INC R4 SJMP L2 L1:  INC R5 L2: DJNZ R3,BACK END

Do an ALP to compare two eight bit numbers NUM1 and NUM2 stored in external memory locations 8000h and 8001h respectively. Reflect your result as: If NUM1NUM2, SET MSB of location 2FH (bit address 7FH). If NUM1 = NUM2, then Clear both LSB & MSB of bit addressable memory location 2FH.

Do an ALP to compare two eight bit numbers NUM1 and NUM2 stored  in external memory locations 8000h and 8001h respectively. Reflect your  result as: If NUM1<NUM2, SET LSB of data RAM location 2FH (bit  address 78H). If NUM1>NUM2, SET MSB of location 2FH (bit address  7FH). If NUM1 = NUM2, then Clear both LSB & MSB of bit addressable  ORG 0000H MOV DPTR,#8000H MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR CJNE A,B,TARGET CLR 7FH CLR 78H SJMP BACK TARGET: JC NEXT SETB 78H SJMP BACK NEXT: SETB 7FH BACK: END

Do assembly language program for displaying 0 to 9 on seven segment display in MCU IDE 8051 virtual hardware

ORG 0000H TARGET: MOV DPTR,#0400H AGAIN: CLR A MOVC A,@A+DPTR MOV P1,A ACALL DELAY INC DPTR CJNE A,0,AGAIN  SJMP TARGET DELAY: MOV R4,#0FH BACK: DJNZ R4,BACK RET ORG 0400H DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,00H END

SemiConductor type strain gauge

Image
Semiconductor type strain gauge In this type of strain gauge we use doped silicon or  germanium as a sensing element. When we apply stress to this type of material its Resistance is changed, by measuring the  resistance change we can  measure the stress applied on this material. Gauge factor of this type of strain gauge is well around 100. Unlike other strain gauges, semiconductor strain gages are based upon the piezoresistive effects of silicon or germanium and measure the change in resistance with stress as opposed to strain. The semiconductor bonded strain gage is a wafer with the resistance element diffused into a substrate of silicon. No backing is provided for the wafer element and bonding it to the strained surface needs extra care since only a thin layer of epoxy is used to attach it. Size of a semiconductor strain gauge is much smaller and the cost much lower than for a metallic foil sensor.

Foil type strain gauge

Image
Foil type strain gauge In Foil type strain gauge we use thin sheets or foils of 5 micro metre thick. by photo etching or masked vacuum deposition process , based on our requirement or application we can shaped the strain gauge. The end turns are made fat so as to reduce the contribution from the transverse strain which is a superiors input. Metal Foil Strain Gauge The arrangement consists of the following; The metal foil of 0.02mm thick is produced using the printed circuit technique. This metal foil is produced on one side of the plastic backing. Leads are soldered to the metal foil for electrically connecting the strain gauge to a measuring instrument (wheat stone bridge). Operations of Metal foil Strain gauge With the help of an adhesive material, the strain gauge is pasted/bonded on the structure under study. Now the structure is subjected to a force (tensile or compressive). Due to the force, the structure will change the dimension. As the strain gauge is bonded to the structure, ...

Wire wound strain gauge

Image
Wirewound strain gauge There are two types of wirewound strain gauge  bonded and unbonded. Bonded strain gauge It consists of specimen surface  Gauge is directly bonded with the surface of the specimen  surface being tested. The thin layer of adhesive cement is also there this cement is  not only serve to transmit the strain from the specimen to the gauge wire but also act as an insulator. Depending upon the application the bonded strain gauge have various structure so we can use this structure as our application. Unbonded strain gauge These strain gauges are not directly bonded onto the surface of the structure under study. Hence they are termed as unbounded strain gauges. Description of the Unbonded Strain gauges: The arrangement of an unbonded strain gauges consists of the following. Two frames P and Q carrying rigidly fixed insulated pins as shown in diagram. these two frames can move relative with respect to each other and they are ...

Resistance strain gauge

Image
Resistance strain gauge The working principle of strain gauge is based on Piezoresistive Effect. This is why it is also often called Pizoresistive Gauge. Astrain  gauge   is  sensor  whose  resistance  varies with applied force; It converts force, pressure, tension, weight, etc into a change in electrical  resistance  which can then be measured. So by measuring the change in resistance we can measure force Pressure tension, weight etc. Types (1) wirewound (2)Foil (3) semiconductor In wirewound type (a) bonded (b) unbonded What is gauge factor? The fractional change in resistance, (ΔR/R), divided by the fractional change in length, (Δl/l), is called the  gauge factor , G. Note that G is a unitless number. Accordingly, the  gauge factor  provides sensitivity information on the expected change in resistance for a given change in the length of a strain  gauge . Gauge Factor: Gauge Factor is defined as the ratio of per unit change i...

Strain measurement

Image
Strain measurement What is Stress? In mechanics, stress is defined as a force applied per unit area. It is given by the formula σ = F A where, σ  is the stress applied F  is the force applied A   is the area of force application The unit of stress is  N / m 2 Stress applied to a material can be of two types. They are: ●  Tensile Stress : It is the force applied per unit area which results in the increase in length (or area) of a body. Objects under tensile stress become thinner and longer. ●  Compressive Stress : It is the force applied per unit area which results in the decrease in length (or area) of a body. The object under  compressive stress  becomes thicker and shorter. What is Strain? The strain is the amount of deformation experienced by the body in the direction of force applied, divided by initial dimensions of the body. The relation for deformation in terms of length of a solid is given below. ϵ = δ l L where, ϵ  is the strain due ...