24
1 Although the first half of this module is about analogue circuits and signals, we will nevertheless introduce the topic of digital representations and signals in this lecture. We will come back to digital in later lectures.

Although the first half of this module is about analogue

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

1

Although the first half of this module is about analogue circuits and signals, we will nevertheless introduce the topic of digital representations and signals in this lecture. We will come back to digital in later lectures.

2

Bywayofintroductiontodigitalelectronics,Iwillspendthenextperiodjustgoingthroughsomeofthebasicideasindigitalcircuits.Ifyouknowthisalready,justbepatient.Someofyourclassmatesmaynotbefamiliarwithatleastsomeaspectsofthis.Iwillbecoveringinthiscoursequiteabitofdigitalelectronics,butnotdowntotransistorlevel.However,youwillbelearningsomethingaboutwhat’sinsideadigitalcircuits,theideaofcombinationalandsequentialcircuits;somethingaboutdigitalcounters,microprocessors.Youwillalsolearnhowtogetdigitalhardwareandcomputersoftwareworkingtogethertodosomethinginteresting.

Althoughthislectureintroducesyoutodigitalcircuits,Iwillnotcomebacktodigitalagainuntilthesecondpartofthecourse.

3

Itisimportantforyoutoappreciatethehigh-levelviewofanelectronicsystem,end-to-end.Shownhereisamobilephonelinkedtoanothermobilephone.Thespeechsignal,likemanyelectricalsignalinthephysicalworld,areanalogueinnature.Thatis,thesignalvariescontinuouslyintimeandinamplitude.Amodernelectronicsystemconvertstheanaloguesignalintodigitalformintwosteps.Itsamplesthedataintodiscretetime,aprocessknownas“sampling”.Itthendigitizeeachsampleintodiscretelevels,aprocessknownas“quantization”.

YouwilllearninthesecondyearcourseinEEEthatthesamplingprocessingdoesNOTdestroyinformation.Weknowhowtorecovertheoriginalsignalwithoutloosinganyinformation.However,quantizationwillalwayslooseinformation–wewillonlyhaveanapproximationoftheoriginalsignal.

Oncethespeechisindigitalform,itgoesthroughmanydigitalcircuitswhichcompressesthespeechsignalsothatyoutrytosendaslittleinformationaspossible,thesearethenturnintoelectricalsignalsthataresuitablefortransmissionthroughair,cableoropticalfibre.Thisprocessiscalledmodulation.Formodernphones,thetransmissioncouldverywellbeviatheinternet(knownasVoiceoverIPorVoIP).Atthereceivingend,thereversehappens.

4

Digitalinformationarehandledinelectronicsabinarybits,i.e.0’sand1’s.Inelectricalsignalsforms,thesearerepresentedbyelectricalvoltageVLandVH.

Verycommoninelectronicsaretwostandardsofvoltagelevels:TTL(standsfortransistor-transistor-logic)and3.3VLowVoltage(3.3LV).ForTTL,thesupplyvoltage(VCC)is5Vwith0Vasthereference.For3.3Vlogic,thesupplyis3.3V.Inbothcases,thereferencevoltageis0VorGround(GND).

Forthiscourse,wewillexclusivelyuse3.3Vlogic.Thatmean

Logic0(False)is0Vandlogic1(True)is3.3V.

Inlogiccircuitswedefinefour“threshold”voltages:VOHistheguaranteedminimumvoltageFROMANOUTPUTNODEwhichisalogicHIGH.VIHistherequiredminimumvoltagebeforeANINPUTNODEwouldregardthesignaltobelogicHIGH.Similarlyforthelowthresholdvoltages.

ThereforeifyouareusingTTLlogic,thegapbetweenVOHandVIHis0.7V.Inotherwords,ahighoutputsignalcouldbe“corrupted”bynoiseupto0.7Vandthelogiccircuitshouldstillinterpretthesignalaslogicalhigh(or‘1’).Thisdifferenceiscalled“noiseimmunity”.

Theshadedregioninthevoltagescaleareillegal“no-man”zone.Alogicsignalnodeshouldnevertakeavoltagevalueinthisregion.

5

Adigitalwaveformisrealitydonothaveinfinitelyfastrisingandfallingedges.Shownhereisarealdigitalwaveformwiththemostimportantcharacteristics.

Oftenusedare:therisetime(timeittakestorisefrom10%to90%ofthefinalvalue)andthefalltime.Inrepetitivedigitalsignals,wealsoareinterestedinitsfrequency,periodanddutycycle.Dutycycleistheratiobetweenthetimethesignalishightothatoftheperiod.

6

ThebasiclogicelectroniccomponentsaretheNOTgate(outputistheinverseoftheinput),ANDgate(outputis1onlyifALLtheinputsare1’s),andtheORgate(outputis1ifANYoftheinputsare1).

Interestinglyitcanbeproventhatgiventhesethreegates,onecouldintheorybuildANYdigitalcircuits,includingaPentiumCPU!Wewillcomebacktothislateronthecourse.

7

Allelectronicintegratedcircuitscomeindifferentpackages,particularlyfordigitalelectronics.YouwillbeusingtheDualin-linepackagesinthelaboratory.However,ontheproject,youwillbeusingasmallmicrocontrollerboard(knownasthePyboard)whichcomesasprinted-circuitboard(PCB)withotherpackagessuchastheSOIC,FPandPLCC.

8

Wewillnowconsiderdigitalsignalsrepresenting“data”orinformation.1’sand0’saremeaninglessunlesswehaveawayofinterpretingwhattheymean.Forthat,weneedcontext.

9

Dataorinformationisactuallyquiteacomplexthing.Forexample,thecurrenthottopicforresearchiscalled“BigData”.Thisword,data,couldmeanmanythings:yourname(i.e.alphabets),yourage(i.e.numbers),yourpicture(imagedata),yourvoice(speech)orencodedsignalofyourspeechetc.

Indigitalelectronics,weusevoltagestorepresentsuchinformation.Thebasicdigitalbuildingblockisaswitchasimplementedinatransistor.Hereisasimpleschematicofaswitchwhichcanbeusedtopresentadigital1(switchopen)ordigital0(switchclosed).

10

Howtousesuchsimplecircuittorepresentorstoreinformation?Toanswerthis,weneedtoundernumbersystem.Hereisafamiliardecimalnumbersystemwithadecimalpointinthemiddle.Itsinterpretationisstraightforward.

11

Inthebinarysystem,wesimplyusebinaryinsteadofdecimalweighting.Notethatthebinarypointisalsointhemiddle.Allbinarydigits(bits)ontheleftofthebinarypointhaveweightinginincreasingpositivepowersof2(i.e.20,21…28etc.Ontherightofthebinarypoint,thepowerarenegative.

12

Convertingabinaryintegertodecimalissimplebuttedious.Anyonecandoit.

13

Hereisafractionalbinarynumberwith3bitsAFTERthebinarypoint.Thewholenumberishas8bits.ThisisknownasQ3format.Thisbinarynumberhasadecimalvalueof19.375.

Ifyouwanttorepresent19.376inthesame8-bitformat,youhaveaproblem.Youcan’t.19.375istheclosestyoucanuse.Thisisanexamplewhydigitalrepresentationofananaloguequantitymaygeneratequantizationerror.

14

Simple – no need to explain.

15

This is somewhat tedious. We will see how we can make this easier with hexadecimal (instead of binary) representation.

16

17

Onereasonwhydigitalcircuitisusefulisthatitcandocomputationsuchasadditionveryquickly.Binaryadditionissimilartodecimaladditionwithslightdifference.Inbinaryaddition,thecarryandthetwooperands(whichyouadd)arethesame–theyareallBINARY.Soinbinaryaddition,youhavethreeinputs(A,BandCarry)andtwobinaryoutputs(SUMandCarry).

18

In binary addition, the carry and the two operands (which you add) are the same – they are all BINARY. So in binary addition, you have three inputs (A, B and Carry) and two binary outputs (SUM and Carry).

19

Handlinglargebinarynumberistediousandpronetoerror.Wethereforeusuallyhandlebinarynumbersingroupsoffour,withvaluesgoingfrom0todecimal15.Werepresentthevalues10to15insinglealphabetAtoF.ThisisthehexadecimalnumbersystemorHEXforshort.Itisworthwhiletomemorisethat10102isdecimal1010andA16,and11112isdecimal1510andF16.Forallotherpatterns,youjustcountupfromA16ordownfromF16.

20

21

Thisisusing4-bitunitofbinaryrepresentationtorepresentdecimaldigits.Sincea4-bitbinarynumberhasarangeof0to15,anddecimaldigitonlygoesupto9,weareeffectivelyNOTusingtherange10102to11112.

22

23

24

Codes representing letters of the alphabet, punctuation marks, and other special characters as well as numbers are called alphanumeric codes. The most widely used alphanumeric code is the American Standard Code for Information Interchange(ASCII). The ASCII (pronounced “askee”) code is a seven-bit code.