数字硬件习题word版

数字硬件习题word版

ID:1671106

大小:475.50 KB

页数:31页

时间:2017-11-13

数字硬件习题word版_第1页
数字硬件习题word版_第2页
数字硬件习题word版_第3页
数字硬件习题word版_第4页
数字硬件习题word版_第5页
资源描述:

《数字硬件习题word版》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、Tut07Q1-CDevelopmentEnvironmentStatethestepsandthetoolstodevelopaCprogramfortheAtmelAVRmicrocontroller.Step1:CreateAVRStudioproject:projectname;projecttypeC;selectsimulatoranddeviceStep2:EnteraCprogram.Step3:CompiletheCprogramtoproduceaHEXfile.Step4:DownloadandtestHEXfileonAtmelAVRmic

2、rocontroller.Tools:AtmelAVRStudioandWinAVRQ2-AtmelAVR-Specifics(a)WhatistheroleoftheheaderfileinaCprogramfortheAtmelAVR?(1)Dependingonwhatdeviceselectedfortheproject,willredirecttoaspecificheaderfile.(2)ThespecificheaderfilecontainstheCdefinitionsforallregistersoft

3、heAVRmicrocontroller.(3)ForATmega16,thespecificheaderfileis(seeLabNotesAppendixA).b)WriteaCcodeexamplethatusesinlineassemblycoding.(1)Wecanuse__asm__directive.(2)Forexample,tocreateadelayusingassemblyinstructionnop:__asm____volatile__("nop");(3)The__volatile__directiveforcest

4、heCcompilertokeeptheorderofCinstructions.Thatis,nocodeoptimizationisperformed.Q3-CLanguageElementsa)NametheCkeywordthatcanbeusedtoquitafunctionimmediately.return;b)NametheCkeywordthatcanbeusedtoterminatealoopimmediately.break;c)NametheCkeywordthatcanbeusedtoforcethenextiterationofaloo

5、ptostartimmediately.continue;d)Statetherolesofthekeywords'break'and'default'intheC'switch-case'construct.(1)Keyword'break'isusedtoterminatetheC'switch-case'constructafteracasehasbeenhandled.(2)Keyword'default'isusedtospecifytheinstructionstorunwhennocaseismatched.switch(a)case'0':PORT

6、B=0b00111111;break;…case'9':PORTB=0b01101111;break;default:PORTB=0b00000000;e)DifferentiatebetweenthetwoCoperators&and&&.(1)&isbit-wiseoperatorforAND,usedonanyintegerdatatype.(2)&&islogicaloperatorforAND,usedwithlogicaldatatypesandconditionalstatements.f)DifferentiatebetweenthetwoCope

7、rators~and!=.(1)~isbit-wiseoperatorforinversion,usedonanyintegerdatatype.(2)!=isacomparisonoperatorforNOTEQUAL,e.g.if(a!=b)(g)DifferentiatebetweenthetwoCoperators=and==.(1)=isassignmentoperator,e.g.PORTB=0b00111111(2)==isacomparisonoperatorforEQUAL,e.g.if(a==b)Q4)Bit-wiseOperatorsCons

8、idert

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。