whenwe'resendingdatafromonecomputersystemtoanotherover a seriallinkwith a simpleclockanddataprotocollikethishaveshowedyouinpreviousvideoshowit's prettystraightforwardtobuild a circuitthatcomputestheparitybit.
Sowejusthaveourclockanddatacominginhere, andwejusthaveanexorgateand a D flipflop.
Andouttheothersidecomes a paritybitthatwecanusetovalidatethatourmessagewasreceivedcorrectly, oratleastthatcertaintypesoferrorsdidn't occurwhenwereceivedourmessage.
Soinothervideos, I showedyouthingslikechecksumsandseeourseasthataremuchbetteratcatchingallsortsofdifferenttypesofcommonerrorsthatmightoccurin a communicationnetworklikethis, butthedownsideofthoseisthatthey'remuchmorecomplex.
WethendividethatpolynomialbythisgeneratorPalinUMAthatwecomeupwithandthenthatdivision, Uh, afterwedoallthatlongdivisionthatresultsin a remainderandthenwesubtractthatremainderfromouroriginalmessage, andwegettheactualpolynomialthemessagethatwe'regoingtotransmit, andthenwecanusethemathematicalfactthatthattransmittedmessageis a multipleofourgenerator, andthereceivercandothemathontheothersidetodetermineifanyerrorsoccurred.
Nowthat's a lotmorecomplexthanoursimplelittleparitybithere.
Butwhat I wanttodointhisvideoisactuallylookatthemathand a littlemoredetailandlookforsomepatternsthatexistinthismaththatwe'redoingtocalculatetheCRCandshowhowwecanusethepatternsthatareinhere, too.
Andascomplicatedashismathmightseem, it's actually a fairlysimplealgorithmtogetfromourmessagedowntoRCRCofjustliningthisuphereandthenslidingoverandflippingandslidingandflipping.
Nowletmeshowyouthatsamemechanicsofslidingandflippingrepresented a littlebitdifferently.
Soherewehaveourmessageinbinary, andthenthisisthegeneratorpolynomialandanotherwaywecanthinkofitwiththatsameslidingandflippingsortofideaiswecanslideourmessagealonglikethisuntilthe X tothe 16 placelinesupwith a one.
Andactually, I'vealreadygotoneofthose 74 h c 2 73 isherethatweusedbecausewediduseone d flipflopforourparodycircuitsowecanactuallyreusethat.
Letmeactuallygetridofsomeofthepartsherefor a parody, andwecanreusethesamechipforRCRC.
Andsothefirstthing I'm gonnadoisactuallyhookup a bunchofledsowecanseethecontentsofeachofthe D flipflops.
Sobasically, what I'm gonnadois I'm gonnaconnecttheoutputsofeachofthese d flipflopsuptoanled.
Sothe Q p inherejustsowecanseebecauseeachofthese D flipflopsisgonnahold A isgonnastore a bit a zeroorone, andso, byhookingleduptoeachonewillbeabletoseewhetherit's storing a zeroorone.
Then I'm gonnaconnecttheothersideofeachoftheseladiestogroundthrough a currentlimitingresister.
Thinkthisisjust a 270 ohmresistors, somethinglikethat.
Whatyou'llseeisthatifyouhaveoneinput, saythe A inputhereiszero.
Thentheoutputofthe X orgateisgoingtobethesameasthebeeinput.
Sowhatevercomesintobeiswhatthe X orgateoutputs.
Butifthe A inputis a one, thenwhateverthe X oroutputsisgonnabetheoppositeofwhateverthebeinputis, anytimeyouthinkyoumightneed a conditionalinversion, X orgateisdefinitelythefirstplaceyoushouldlook.
Andthat's gonnabeusefulbecausewhatwewanttosayiswewanttosaywewanttoinvertthebitsthatareintheseotherpositionswheneverthere's a oneinthislastposition.
NowtheotherthingyoumighthavenoticedisthatourpolynomialgoesfromExodus 16 downtoone, whichisreally X tothezero.
Wejustput a zerooutonour T X dataandwepulsetheCRCclock 16 timesandthat'llpush 16 zeroesinhere, andthenwe'llactuallyhavetheCRCinourCRCcompetition, justlikewedohere.
Wecanjustkeeppushingthesebitsalong, readeachoneoutintotheArduino, andthentheArduinocouldjustpassthatalongtothetransmitdataandpulsethat t x clocktosendthe 16 bitsoftheCRCovertothereceiverhere.
Weknowhowever, thereis a littlebitof a problemwiththis, whichisthatoncewehave a validCRCinhere, wewannabeabletoshiftitoutwithoutmodifyingit.
Andthewaythiscircuitissetup, wecan't reallydothatbecausewe'veaddedthese X orgates.
Andsowhat's gonnahappenisasit's shiftingout, ifthere's ever a oneherethanthese, X orGatesaregonnastartinvertingthingsandit's gonnamessupourCRC, andwearen't actuallygoingtogetthecorrectCRCouttheotherend.
Sotofixthat, whatweneedtodoisweneedtohavesomewayofsortofturningoffthese X orgatestosaythatHey, wejustwanttoreadwhat's inhere.
Wedon't wannawedon't wantwedon't wanttodoanyofthisinversion, andsoweneed a littlebitofextralogicheretobeabletoinhibitthese X orgatesjustwhilewe'rereadingtheCRCout.
Andsince I don't reallyhaveanymoreroomonthebreadboardsforanymorelogic, I cameupwith a littleah, littlehackherewithsomedieodestodothelogicandeffectively.
What I'm doinghereis I'm justcreatinganandgatewithtodieodesand a resistor, butjust a walkthroughwhat's goingonhere?
Sojusttobackuphere a second, we'regonnasendthedatawhotransmitthedata.
ThenwefilltheCRCcircuitwith 16 zerosandnowweneedtoreadtheCRCfromthe C R.
C circuit.
Sotoreadfromthe C R C circuit, firstthingweneedtodoisputitintoreadmodethatwayswepullthedataout, it's notgonnakeepdoingthosethose X whoresorthoseinversions.
And I justwanttogothrough 16 bitsandwhoreadoutthedata.
Actually, what I'lldofornowisjustprinttheCRConthescreen.
Becauseessentially, whatwejustwanttodoiswanttotakewhateverwe'rereadingfromthe C R C circuitandsenditsotosenditwe'regonnado a digitalrightfor a TXdataandwewanttotrainourtransmitdatatobasicallyjustbethatsamebitfromRCRCAndtheninsteadofwhilenotinsteadof.
ButinadditiontoPaulsayingtheCRCclock, wealsowant a pulse, thetransmitclock.
whenwe'resendingdatafromonecomputersystemtoanotherover a seriallinkwith a simpleclockanddataprotocollikethishaveshowedyouinpreviousvideoshowit's prettystraightforwardtobuild a circuitthatcomputestheparitybit.
Subtitles and vocabulary
Click the word to look it upClick the word to find further inforamtion about it