Anda di halaman 1dari 1

91

Chapter9
Introductionto8051Microcontrollers
SolutionstoThinkandAnswerExercises
1. Findthecontentsoftheflagsinthe8051afteraddingthebinarynumbers01011100B
and11000101B.
Resultis00100001BflagcontentsareP=0,OV=0,AC=1,andCY=1.
2. WritethebinarywordtobewrittenintothePSWofthe8051,toselecttheregister
bank2intheinternalRAM.
PSW CY AC F0 RS1 RS0 OV P
Bitaddress D7H D6H D5H D4H D3H D2H D1H D0H
X X X 1 0 X X X
ThedatatobewrittentothePSWforselectingtheregisterbank2is(00010000B)or
10H.
3. Giveatleasttwoexamplesofsituationsinwhichtheoverflowflagisset.
The conditions under which the OV flag is set after adding signed numbers are as
follows:
Positive+Positive=Negative
Negative+Negative=Positive
PositiveNegative=Negative
NegativePositive=Positive
4. Whatdoesa0inthezeroflagmean,afteranarithmeticoperation?
Azerointhezeroflagmeansthecontentoftheaccumulatorisallzero.
Microprocessors and Microcontrollers Kumar, Saravanan & Jeevananthan
Oxford University Press 2011

Anda mungkin juga menyukai