Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100)

Answers were Sorted based on User's Feedback



Design a circuit to detect when 3 and only 3 bits are set out of 8 bits.(eg. o0101100)..

Answer / gautam

Sorry thr was a bit mistake. Corrected :

MOV XAR1, #Data
MOV XAR0, #0
MOV XAR2, #0

Loop:
TBIT *XAR1, *XAR2
BF Loop1, NTC
INR *XAR0

Loop1:
INR *XAR2
MOV AL, *XAR0
CMP AL, #0x03
BF Loop3, EQ

MOV AL, *XAR2
CMP AL, #0x80
BF Loop, NEQ

Loop3:
EXIT

Is This Answer Correct ?    0 Yes 3 No

Design a circuit to detect when 3 and only 3 bits are set out of 8 bits.(eg. o0101100)..

Answer / gautam

I have modified it a bit,

MOVL XAR1, #Data
MOVL XAR0, #0x00
MOVL XAR2, #0x00

Loop:
TBIT *XAR1,#XAR2
BF Loop1, NTC
INR AR0

Loop1:
INR AR2
MOV AL, *XAR0
CMP AL, @0x03
BF Action, EQ

MOV AL, *XAR2
CMP AL, @0x08
BF Loop, NEQ

Loop3:
EXIT

Action:

Is This Answer Correct ?    0 Yes 5 No

Design a circuit to detect when 3 and only 3 bits are set out of 8 bits.(eg. o0101100)..

Answer / josh

3 input AND those 3 bits. No adder needed...

Is This Answer Correct ?    0 Yes 18 No

Post New Answer

More Embedded Systems AllOther Interview Questions

Advantages and disadvantages of using macro and inline functions?

0 Answers  


Explain what is semaphore?

0 Answers  


Do you know what is the use of volatile keyword?

0 Answers  


What is the volatile keyword used for?

0 Answers  


Are you still writing code? Do you love it?

0 Answers  






Explain me how does the interrupt architecture works?

0 Answers  


PROVIDE ME NOTES ON EMBEDDED TCHNLOGY

0 Answers   TCS,


What is the last programming book you read?

0 Answers  


Explain difference between risc and cisc processor?

0 Answers  


What's the difference between locking and lockless (optimistic and pessimistic) concurrency models?

0 Answers  


How does the addition of service orientation change systems? When is it appropriate to use?

0 Answers  


Whose blogs or podcasts do you follow? Do you blog or podcast?

0 Answers  


Categories