[ Pobierz całość w formacie PDF ]
.Consider the number 2510.In regular binary this would convert to110012.Alternatively, we could convert each digit separately to 4-bitor 8-bit numbers:2 = 00102 or 0000 001025 = 01012 or 0000 01012Putting these together, 2510 could be written using the 4-bit numbersas 0010 01012.This uses one byte and is called Packed BCD.Alternatively, we could use the 8-bit formats and express 2510 as 00000010 0000 01012 and would now use two bytes.This is calledUnpacked BCD.There are two disadvantages.Firstly, many numbers are of increasedlength after converting to BCD, particularly so if we use unpackedBCD or the numbers are very large like 25 1075.In addition,arithmetic is much more difficult although, generally, microprocessorsdo have the ability to handle them.The advantage becomes apparent when the microprocessor iscontrolling an external device like digits on displays at a filling stationor accepting inputs from a keyboard.The coding is simple and doesnot involve the conversion of the numbers to binary.47 Introduction to Microprocessors and MicrocontrollersOverallArithmetic ’! use binaryInputting and outputting numbers ’! use BCDQuiz time 4In each case, choose the best option.1 The number  3510, when expressed as an 8-bitbinary number in two s complement form, is:(a) 00100011.(b) 1111011101.(c) 11011101.(d) 00110101.2 The number 710 converted to an unpacked BCDformat would be written as:(a) 1110 0000.(b) 7H.(c) 0000 0111.(d) 0111.3 The signed magnitude number 110011002 isequivalent to:(a)  7610.(b) 20410.(c) CCH.(d) 121210.4 In the number 0.5 1024 the number:(a) 10 is the mantissa.(b) 24 is the exponent.(c) 0 is the sign bit.(d) 5 is the radix.5 A signed magnitude number that has a figure:(a) zero as the msb is a negative number.(b) one as the lsb is a negative number.(c) one as the msb is a negative number.(d) zero as the lsb is a negative number.48 5An introduction to logicgates and their usesOpening and closing gatesIn the last chapter the binary values zero and one are represented bytwo different voltages.Binary zero is a voltage close to 0 V and binaryone by a voltage close to +5 V (some logic circuits use other voltagelevels but this is a popular value and will serve as an example).A gate is a simple electronic circuit that has a single output voltage thatcorresponds to one of the two binary values.These gates are oftenreferred to as  logic gates and the output voltages as  logic 0 or  logic1 instead of binary 0 and 1.The distinction is just in the name.If youwere to ask a mathematician or a computer programmer, they willrefer to the outputs as binary values but an electronics engineer willcall them logic levels.It really doesn t matter.What decides the output voltage?We connect one or more voltages to the input of the gate.These inputvoltages are either logic 0 or logic 1 levels.The logic gate looks at theinput voltages and  decides , depending on its design, what voltage toproduce at the output of the circuit.There are only four basic designs of gate.They are called the NOT gate,the AND gate, the OR gate and the XOR gate.Notice how we use capitalletters for the names of the gates otherwise we can finish up with somealmost indecipherable sentences.Not not or and not and or not.49 Introduction to Microprocessors and MicrocontrollersA little reminder before we start.Logic gates are clever little chaps butthey are not magic.Just like any other electronic circuit, they needpower supplies to make them work.Now, because all gates andmicroprocessors need power supplies, we tend to assume thateveryone knows that.You will notice that power supplies are notshown in any of the diagrams in this chapter but that doesn t mean thatthey are not there!We will explore these gates now, starting from the simplest.The NOT gateIt has only one input and performs a very simple function.It simplyreverses the binary value.If we put a logic 1 into it, we get a logic 0 at theoutput.Similarly, a 0 at the input gives a 1 at the output.On a diagram,we represent a NOT gate by a symbol as shown in Figure 5.1.Figure 5.1Symbols for a NOT gateA truth tableThis is an alternative to the wordy description of how a gate works.Itsimply lists all the possible inputs to the gate together with thecorresponding outputs.The truth table for a NOT gate is really easy.There are only two possible inputs: 0 and 1 as we can see in Figure5.2 [ Pobierz caÅ‚ość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • personata.xlx.pl