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

Comments

Popular posts from this blog

Wire wound strain gauge

SemiConductor type strain gauge

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.