




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
基于JAVA的掃雷小游戲引言本次課程設(shè)計(jì)目的在于設(shè)計(jì)開發(fā)一個(gè)類似windows自帶掃雷游戲的小游戲,實(shí)現(xiàn)基本的掃雷面板及掃雷的游戲功能、游戲數(shù)據(jù)存儲、游戲計(jì)時(shí)等功能。設(shè)計(jì)采用Windows下的eclipse開發(fā)工具由本人獨(dú)立完成。系統(tǒng)設(shè)計(jì)本游戲采用快速原型模型的軟件開發(fā)方法設(shè)計(jì),總共經(jīng)歷了八個(gè)版本的修改最終完成設(shè)計(jì)要求。在第一個(gè)版本中,實(shí)現(xiàn)如下功能:基于JFrame的掃雷框架的建立:使用JFrame建立起如圖的所示的程序框架,雷區(qū)為12*12,添加JPanel和JButton,采用setBounds的布局方式而非內(nèi)置的布局方法?;赗andom方法的虛擬雷盤的建立和動態(tài)修改:通過Random產(chǎn)生出一個(gè)14*14的數(shù)組,其中,二維數(shù)組邊緣對應(yīng)邊框標(biāo)記值為2,產(chǎn)生的雷點(diǎn)標(biāo)記為1,普通點(diǎn)標(biāo)記為0。再次建立一個(gè)12*12的數(shù)組對應(yīng)實(shí)際的游戲面板,初始值為0,遍歷14*14的數(shù)組中非邊緣的元素,將每個(gè)格子周圍的地雷數(shù)目賦值給對應(yīng)的12*12數(shù)組,地雷仍然用-1來表示,最后遍歷12*12的數(shù)組同時(shí)把數(shù)組中非0非-1的數(shù)繪制到JPanel上,值為-1的元素向面板對應(yīng)位置添加一個(gè)地雷的圖片(注:地雷圖片來自Windows7自帶掃雷游戲的截圖)。基于Button的雷區(qū)覆蓋面板建立以及虛擬雷盤的ActionListener的連接:將生成好的底板覆蓋上12*12的Button并且為每個(gè)Button添加ActionListener,實(shí)現(xiàn)點(diǎn)擊后隱藏對應(yīng)的Button功能。結(jié)果如下圖:重新開始及其按鍵功能的實(shí)現(xiàn):通過“重新開始”按鍵重新生成雷區(qū)以及重新覆蓋Button到所有格子。關(guān)于按鍵及其功能:通過“關(guān)于”按鍵彈出一個(gè)MessageDialog。在第二個(gè)版本中,實(shí)現(xiàn)如下功能:新增利用遞歸算法實(shí)現(xiàn)的一次點(diǎn)開一片區(qū)域功能:通過數(shù)據(jù)結(jié)構(gòu)中的走迷宮算法在按鍵監(jiān)聽中加入了連鎖點(diǎn)亮的算法,點(diǎn)亮該格,然后依次遍歷12*12表的周圍9格,發(fā)現(xiàn)為空格即遞歸調(diào)用遍歷算法,發(fā)現(xiàn)數(shù)字即點(diǎn)亮該格并return,初步實(shí)現(xiàn)了如圖所示的功能:新增虛擬訪問判定表的建立和刷新及修改:即通過查找已標(biāo)記的正確的雷并且計(jì)數(shù),如果達(dá)到了設(shè)定了雷的最大值即執(zhí)行游戲結(jié)束的方法。新增失敗提示框和自動刷新功能:即點(diǎn)亮了地雷的區(qū)域后,自動彈出對話框提示失敗并且執(zhí)行游戲結(jié)束的方法。對原boom表進(jìn)行了改動,解決了虛擬表和實(shí)際表的下標(biāo)錯(cuò)位問題將原12*12的數(shù)組擴(kuò)充到14*14。在第三個(gè)版本中,實(shí)現(xiàn)如下功能:修復(fù)了一個(gè)導(dǎo)致重新開始后第一行雷點(diǎn)位置不變的BUG:重寫游戲結(jié)束的算法,改變循環(huán)的起始點(diǎn),使其可以正確生成虛擬的雷點(diǎn)。新增了右鍵標(biāo)記、取消雷點(diǎn)的功能:為每個(gè)Button添加了MouseListener從而實(shí)現(xiàn)了當(dāng)點(diǎn)擊鼠標(biāo)右鍵時(shí)可以修改Button上文字,顯示為雷,并且當(dāng)該Button已經(jīng)顯示了雷的時(shí)候再次右鍵該Button可以取消文字顯示。在第四個(gè)版本中,實(shí)現(xiàn)如下功能:調(diào)整了按鍵監(jiān)聽的點(diǎn)亮區(qū)域算法,當(dāng)且僅當(dāng)點(diǎn)擊處周圍沒有地雷時(shí)才會觸發(fā)openButton()算法,否則僅顯示當(dāng)前區(qū)域,提高了游戲性:重寫了Button的ActionListener,按條件區(qū)分是否執(zhí)行遞歸點(diǎn)亮算法,當(dāng)且僅當(dāng)單擊區(qū)域?yàn)榭盏臅r(shí)候才執(zhí)行點(diǎn)亮算法,否則僅點(diǎn)亮該區(qū)域。新增了基于System.currentTimeMillis()的計(jì)時(shí)器功能,計(jì)時(shí)器與重新開始游戲?qū)?yīng)同步更新:通過在游戲開始時(shí)獲取一個(gè)currentTimeMillis()以及實(shí)時(shí)監(jiān)控并刷新計(jì)時(shí)器窗口的值為當(dāng)前時(shí)間減去初始時(shí)間除以1000,為節(jié)約內(nèi)存,單獨(dú)為計(jì)時(shí)器開辟了一個(gè)線程,每工作一次該線程休息0.5秒。在第五個(gè)版本中,實(shí)現(xiàn)如下功能:更改了獲勝和失敗后的提示信息:將本次游戲時(shí)間加入了游戲結(jié)束時(shí)的提示窗口。新增了“記錄”窗體的框架和面板:增加了一個(gè)新的JFrame,對應(yīng)“記錄”按鈕。在第六個(gè)版本中,實(shí)現(xiàn)如下功能:再次改進(jìn)了按鍵監(jiān)聽的點(diǎn)亮區(qū)域算法:進(jìn)行遞歸遍歷時(shí)將正相鄰和斜相鄰兩種情況分開,使斜相鄰的地雷值為0的格子不再會被自動點(diǎn)亮,提高了游戲性,至此版本為止,該算法已經(jīng)完全符合預(yù)期要求。游戲后臺新加入了recordlist類,用來存儲和處理光榮榜的數(shù)據(jù):該類擁有10條記錄以及插入新數(shù)據(jù)到對應(yīng)位置的功能。對記錄窗體的改動:通過取消設(shè)定recordFrame類的mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);以及設(shè)定recFrame.hide();方法解決了關(guān)閉窗口時(shí)導(dǎo)致的程序異常終止的錯(cuò)誤。在第七個(gè)版本中,實(shí)現(xiàn)如下功能:記錄的讀取與存儲:通過ObjectOutputStream和ObjectInputStream成功實(shí)現(xiàn)了對光榮榜文件的存取功能。并且重新定義了上一版本的光榮榜信息控件,增加了獲勝時(shí)修改光榮榜并且自動保存文件的功能,同時(shí)新增nameInput窗口類到游戲結(jié)束時(shí)并且成績足以進(jìn)入光榮榜時(shí)調(diào)用的方法中,用于輸入獲取進(jìn)入光榮榜的玩家信息。在最終版本中,實(shí)現(xiàn)如下功能:記錄與游戲的同步措施:通過更改FileOutputStream的實(shí)現(xiàn)位置到nameInputer中的actionListener中并且將recordlist和usedTime以參數(shù)形式通過構(gòu)造函數(shù)傳入nameInputer類中成功實(shí)現(xiàn)了光榮榜數(shù)據(jù)文件的存取。系統(tǒng)實(shí)現(xiàn)Sweeper類:importjava.awt.event.*;importjavax.swing.*;importjava.awt.*;importjava.util.Random;importjava.io.*;publicclasssweeper{Buttonboom[][]=newButton[14][14]; intvisualBoom[][]=newint[14][14]; intvisitTest[][]=newint[14][14]; intnumOfBoom=0; LabeltimeLabel=newLabel(); timeRunnablerunnable=newtimeRunnable(); ThreadtimeThread=newThread(runnable); longstartTime; longusedTime; JFramemainframe; myPanelpanel; ImageboomImage=newImageIcon("boom.jpg").getImage(); recordlistlist=newrecordlist(); JButtonstartButton; JButtonaboutButton; JButtonrecordButton; //類的屬性 voidcreateWindow(){ //創(chuàng)建基礎(chǔ)框架 mainframe=newJFrame("掃雷"); panel=newmyPanel(); //框架及面板 startButton=newJButton(); startButton.setText("重新開始"); startButton.setFont(newFont("楷書",Font.ITALIC,15)); startButton.setFocusPainted(false); startButton.addActionListener(newstartListener()); aboutButton=newJButton(); aboutButton.setText("關(guān)于"); aboutButton.setFont(newFont("楷書",Font.ITALIC,15)); aboutButton.setFocusPainted(false); aboutButton.addActionListener(newaboutListener()); recordButton=newJButton(); recordButton.setText("記錄"); recordButton.setFont(newFont("楷書",Font.ITALIC,15)); recordButton.addActionListener(newrecordListener()); recordButton.setFocusPainted(false); //按鈕 timeLabel.setBounds(350,220,30,30); timeLabel.setBackground(Color.white); startTime=System.currentTimeMillis(); timeThread.start(); panel.setLayout(null); panel.setBackground(Color.BLACK); startButton.setBounds(320,40,100,30); panel.add(startButton); recordButton.setBounds(320,100,100,30); panel.add(recordButton); aboutButton.setBounds(320,160,100,30); panel.add(aboutButton); panel.add(timeLabel); mainframe.setSize(450,340); mainframe.setVisible(true); mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainframe.add(panel); //框架布局 } voidsetBoom() //生成虛擬雷盤的雷區(qū) { for(introw=0;row<14;row++) for(intcol=0;col<14;col++) { boom[row][col]=newButton(); visualBoom[row][col]=0; } //初始化雷區(qū) for(inti=0;i<14;i++) { visualBoom[0][i]=-2; visualBoom[i][0]=-2; visualBoom[i][13]=-2; visualBoom[13][i]=-2; } //虛擬雷盤封邊 intx,y; Randomr=newRandom(); for(intcount=0;count<16;) { x=r.nextInt(12); y=r.nextInt(12); if(visualBoom[x+1][y+1]==0) { visualBoom[x+1][y+1]=-1; count++; } } } //生成地雷,邊緣:-2雷點(diǎn):-1正常點(diǎn):0 voidhandleBoom(){ //炸彈信息轉(zhuǎn)化 inttemp[][]=newint[14][14]; for(introw=0;row<14;row++) for(intcol=0;col<14;col++) { temp[row][col]=visualBoom[row][col]; } for(introw=1;row<13;row++) for(intcol=1;col<13;col++) { temp[row][col]=countBoom(row,col); } numOfBoom=0; visualBoom=temp; } intcountBoom(intx,inty){ //周圍炸彈計(jì)數(shù)器 intcount=0; if(visualBoom[x][y]!=-1) { if(visualBoom[x-1][y-1]==-1) count++; if(visualBoom[x][y-1]==-1) count++; if(visualBoom[x+1][y-1]==-1) count++; if(visualBoom[x+1][y]==-1) count++; if(visualBoom[x+1][y+1]==-1) count++; if(visualBoom[x][y+1]==-1) count++; if(visualBoom[x-1][y+1]==-1) count++; if(visualBoom[x-1][y]==-1) count++; }else count=-1; returncount; } //雷:-1雷數(shù):(int) voidshowButton() //加入雷區(qū)按鈕到面板上 { for(introw=1;row<13;row++) for(intcol=1;col<13;col++) { boom[row][col].setBounds((row-1)*25,(col-1)*25,25,25); boom[row][col].setFocusable(false); boom[row][col].addActionListener(newbuttomListener(row,col)); boom[row][col].addMouseListener(newrightClick(row,col)); panel.add(boom[row][col]); } } classmyPanelextendsJPanel{ //面板內(nèi)部類 publicvoidpaintComponent(Graphicsg) { g.setColor(Color.gray); g.fillRect(0,0,300,300); g.setColor(Color.black); for(intline=0;line<=300;line+=25) g.drawLine(line,0,line,300); for(introw=0;row<=300;row+=25) g.drawLine(0,row,300,row); //繪制基本格 g.setFont(newFont("楷書",Font.ITALIC,13)); g.drawString("MineSweeperVer3.0",305,20); //繪制版本信息 g.drawString("時(shí)間",310,240); for(introw=1;row<13;row++) for(intcol=1;col<13;col++) { if(visualBoom[row][col]!=-1&&visualBoom[row][col]!=0) g.drawString(Integer.toString(visualBoom[row][col]),(row-1)*25+8,(col-1)*25+20); elseif(visualBoom[row][col]==-1) { g.drawImage(boomImage,(row-1)*25,(col-1)*25,25,25,this); } } } } //面板繪圖 classbuttomListenerimplementsActionListener{ //各種監(jiān)聽器 introw,col; buttomListener(intx,inty) { row=x; col=y; } publicvoidactionPerformed(ActionEvente){ if(visualBoom[row][col]==0) { refreshVisitTest(); openButton(row,col); }elseif(visualBoom[row][col]!=-1) { boom[row][col].setVisible(false); }else { boom[row][col].setVisible(false); gameOver(0); } numOfBoom=0; for(introw=1;row<13;row++) for(intcol=1;col<13;col++) if(boom[row][col].getLabel()=="雷") numOfBoom++; if(numOfBoom==16) gameOver(1); } } classrightClickimplementsMouseListener{ introw,col; rightClick(intx,inty) { row=x; col=y; } @Override publicvoidmouseClicked(MouseEvente){ //TODOAuto-generatedmethodstub if(e.getButton()==MouseEvent.BUTTON3) { if(boom[row][col].getLabel()!="雷") { boom[row][col].setLabel("雷"); numOfBoom=0; for(introw=1;row<13;row++) for(intcol=1;col<13;col++) if(boom[row][col].getLabel()=="雷") numOfBoom++; if(numOfBoom==16) gameOver(1); } else boom[row][col].setLabel(""); } } @Override publicvoidmouseEntered(MouseEvente){ //TODOAuto-generatedmethodstub } @Override publicvoidmouseExited(MouseEvente){ //TODOAuto-generatedmethodstub } @Override publicvoidmousePressed(MouseEvente){ //TODOAuto-generatedmethodstub } @Override publicvoidmouseReleased(MouseEvente){ //TODOAuto-generatedmethodstub } } voidrefreshVisitTest(){ //重置訪問標(biāo)記表 for(introw=1;row<13;row++) for(intcol=1;col<13;col++) { visitTest[row][col]=0; } //訪問標(biāo)記置0 for(inti=0;i<14;i++) { visualBoom[0][i]=1; visualBoom[i][0]=1; visualBoom[i][13]=1; visualBoom[13][i]=1; } //邊緣訪問標(biāo)記置1 } classstartListenerimplementsActionListener{ publicvoidactionPerformed(ActionEvente){ for(introw=1;row<13;row++) for(intcol=1;col<13;col++) { boom[row][col].setVisible(true); boom[row][col].setLabel(""); visualBoom[row][col]=0; } intx,y; Randomr=newRandom(); for(intcount=0;count<16;) { x=r.nextInt(12); y=r.nextInt(12); if(visualBoom[x+1][y+1]==0) { visualBoom[x+1][y+1]=-1; count++; } } handleBoom(); startTime=System.currentTimeMillis(); panel.repaint(); System.out.println(""); System.out.println(""); System.out.println(""); System.out.println(""); for(introw=1;row<13;row++) { System.out.println(""); for(intcol=1;col<13;col++) { if(visualBoom[col][row]!=-1) System.out.print(visualBoom[col][row]+""); else System.out.print("*"); } } } } classrecordListenerimplementsActionListener{ @Override publicvoidactionPerformed(ActionEventarg0){ recordFramerec=newrecordFrame(); rec.createWindow(); } } classaboutListenerimplementsActionListener{ publicvoidactionPerformed(ActionEvente){ JOptionPane.showMessageDialog(mainframe.getContentPane(),"制作人:濱江學(xué)院2011級軟件工程1班王琢","關(guān)于",JOptionPane.INFORMATION_MESSAGE); } } voidopenButton(intx,inty){ //響應(yīng)鼠標(biāo)事件 visitTest[x][y]=1; //訪問標(biāo)記置1 boom[x][y].setVisible(false); if(visualBoom[x][y]!=-1) { if(visualBoom[x-1][y-1]!=-1) boom[x-1][y-1].setVisible(false); if(visualBoom[x][y-1]==0&&visitTest[x][y-1]==0) openButton(x,y-1); elseif(visualBoom[x][y-1]!=-1) boom[x][y-1].setVisible(false); if(visualBoom[x+1][y-1]!=-1) boom[x+1][y-1].setVisible(false); if(visualBoom[x+1][y]==0&&visitTest[x+1][y]==0) openButton(x+1,y); elseif(visualBoom[x+1][y]!=-1) boom[x+1][y].setVisible(false); if(visualBoom[x+1][y+1]!=-1) boom[x+1][y+1].setVisible(false); if(visualBoom[x][y+1]==0&&visitTest[x][y+1]==0) openButton(x,y+1); elseif(visualBoom[x][y+1]!=-1) boom[x][y+1].setVisible(false); if(visualBoom[x-1][y+1]!=-1) boom[x-1][y+1].setVisible(false); if(visualBoom[x-1][y]==0&&visitTest[x-1][y]==0) openButton(x-1,y); elseif(visualBoom[x-1][y]!=-1) boom[x-1][y].setVisible(false); }else{ gameOver(0); } } classtimeRunnableimplementsRunnable{ //計(jì)時(shí)器專用線程 @Override publicvoidrun(){ while(true) { timeLabel.setText(Long.toString((System.currentTimeMillis()-startTime)/1000)); usedTime=(System.currentTimeMillis()-startTime)/1000+1; try{ Thread.sleep(500); }catch(Exceptionex){ } } } } voidgameOver(intisWin){ //游戲結(jié)束 if(isWin==0) { JOptionPane.showMessageDialog(mainframe.getContentPane(),"勝敗乃兵家常事,大俠請重新來過!\n本次游戲用時(shí):"+usedTime+"秒","YouLose!",JOptionPane.INFORMATION_MESSAGE); startButton.doClick(); }else{ JOptionPane.showMessageDialog(mainframe.getContentPane(),"恭喜您!沒有什么地雷能逃過您的火眼金睛\n本次游戲用時(shí):"+usedTime+"秒","YouWin!",JOptionPane.INFORMATION_MESSAGE); try { ObjectInputStreamin=newObjectInputStream(newFileInputStream("record.wz")); list=(recordlist)in.readObject(); in.close(); if(usedTime<=list.getLowestScore()); nameInputernameinputer=newnameInputer(list,usedTime); }catch(Exceptione) { } startButton.doClick(); } } publicstaticvoidmain(String[]args){ sweepermain=newsweeper(); main.setBoom(); main.handleBoom(); main.createWindow(); main.showButton(); for(introw=1;row<13;row++) { System.out.println(""); for(intcol=1;col<13;col++) { if(main.visualBoom[col][row]!=-1) System.out.print(main.visualBoom[col][row]+""); else System.out.print("*"); } } }}recordFrame類:importjava.awt.Graphics;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.io.*;importjavax.swing.*;publicclassrecordFrameimplementsSerializable{ JFramerecFrame; recPanelrecpanel; JButtonclose=newJButton("關(guān)閉"); recordlistlist; voidcreateWindow(){ recFrame=newJFrame("光榮榜"); recpanel=newrecPanel(); recpanel.setLayout(null); close.addActionListener(newcloseListener()); close.setBounds(50,230,80,20); recpanel.add(close); recFrame.setSize(200,300); recFrame.setVisible(true); recFrame.add(recpanel); } classcloseListenerimplementsActionListener{ @Override publicvoidactionPerformed(ActionEventarg0){ recFrame.hide(); } } classrecPanelextendsJPanel{ publicvoidpaintComponent(Graphicsg){ g.drawString("姓名",25,20); g.drawString("耗時(shí)",125,20); try{ ObjectInputStreamin=newObjectInputStream(newFileInputStream("record.wz")); list=(recordlist)in.readObject(); in.close(); for(intpos=0;pos<10;pos++) { g.drawString([pos],25,20*(pos+2)); g.drawString(Long.toString(list.score[pos]),125,20*(pos+2)); } }catch(Exceptione){ e.printStackTrace(); } } }}recordList類:importjava.io.*;publicclassrecordlistimplementsSerializable{ //光榮榜存儲類 publicStringname[]; publiclongscore[]; publicrecordlist(){ //構(gòu)造函數(shù) name=newString[10]; score=newlong[10]; for(inti=0;i<10;i++) { name[i]="王琢"; score[i]=999; } } longgetLowestScore(){ //返回榜內(nèi)最長時(shí)間 returnscore[9]; } longgetHighestScore(){ returnscore[0]; } voidinsertValue(Stringn,longs){ //插入新元素 inti=0; longtemp; Stringntemp; while(s>score[i]){ i++; } do{ temp=score[i]; ntemp=name[i]; score[i]=s; name[i]=n; s=temp; n=ntemp; i++; }while(i<10); }}nameInputer類:importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.io.FileOutputStream;importjava.io.ObjectOutputStream;importjavax.swing.*;publicclassnameInputer{ JFrameframe; JPanelpanel; JTextFieldtext; JButtonbutton; JLabellabel; Stringname; recordlistmylist; longusedtime; nameInputer(recordlistlist,longtime){ frame=newJFrame("新紀(jì)錄"); frame.setSize(300,180); panel=newJPanel(); text=newJTextField(); text.setBounds(145,30,60,20); button=newJButton("確定"); button.addActionListener(newbuttonlistener()); button.setBounds(80,70,100,20); label=newJLabel("請留下您的尊姓大名:"); label.setBounds(20,30,120,20); panel.setLayout(null); panel.add(text); panel.add(button); panel.add(label); frame.add(panel); frame.setVisible(true); mylist=list; usedtime=time; } StringgetName(){ return; } recordlistgetList(recordlistlist){ returnlist; } classbuttonlistenerimplementsActionListener{publicvoidactionPerformed(ActionEvente) { name=text.getText(); mylist.insertValue(name,usedtime); try{ ObjectOutputStreamout=newObjectOutputStream(newFileOutputStream("record.wz")); out.writeObject(mylist); out.close(); }catch(Exceptionex){ } frame.hide(); } }}PAGE1PAGE16軟件截圖:結(jié)束語經(jīng)過了近一周的不斷努力和改進(jìn),終于完成了這個(gè)掃雷的小游戲,通過這次程序設(shè)計(jì)我深切體會了JAVA相對于C語言的便捷性以及多態(tài)與封裝的優(yōu)越性,同時(shí)也深深體會到軟件工程基礎(chǔ)知識對軟件開發(fā)的重要性,親身體會了一次從策劃到初步實(shí)施到不斷完善的開發(fā)程序過程,為今后的程序開發(fā)積累的寶貴的經(jīng)驗(yàn)。另外,我也深深體會到數(shù)據(jù)結(jié)構(gòu)的重要性,一個(gè)好的數(shù)據(jù)結(jié)構(gòu)可以提高算法效率,節(jié)省大量寶貴的資源,提升程序運(yùn)行效率。這次課程設(shè)計(jì)提高了我對程序開發(fā)的興趣,體會到了在開發(fā)過程中發(fā)現(xiàn)問題,解決問題的樂趣,為今后的學(xué)習(xí)樹立了信心。哈爾濱理工大學(xué)軟件學(xué)院課程設(shè)計(jì)報(bào)告課程微電子電路(雙語)題目帶有源負(fù)載的CS放大器與帶有源負(fù)載的cascode放大器班級集成-4班專業(yè)集成電路設(shè)計(jì)與集成系統(tǒng)學(xué)生學(xué)號指導(dǎo)教師20年11月8日目錄課程設(shè)計(jì)目的課程設(shè)計(jì)題目描述和要求3.課程設(shè)計(jì)報(bào)告內(nèi)容3.1、帶有源負(fù)載的CS放大器3.2、帶有源負(fù)載的cascode放大器心得體會參考書目一.課程設(shè)計(jì)目的熟悉并掌握Orcad中的captureCIS,Hspice與cosmosScope軟件的使用。掌握使用captureCIS建立帶有源負(fù)載的CS放大器與帶有源負(fù)載的cascode放大器的電路并導(dǎo)出網(wǎng)表。熟練應(yīng)用Hspice仿真網(wǎng)表并修改分析網(wǎng)表,學(xué)會用comosScope查看分析波形。在扎實(shí)的基礎(chǔ)上強(qiáng)化實(shí)踐能力,把微電子理論實(shí)踐化。二.課程設(shè)計(jì)題目描述和要求分析如圖這樣的帶有源負(fù)載的共源極放大器與帶有源負(fù)載的cascode放大器的開環(huán)增益,3dB頻寬,單位增益頻率。其中負(fù)載電容為3PF,電源電壓為5V,要求CS放大器的開環(huán)增益大于30dB,cascode放大器的開環(huán)增益大于60dB。對仿真結(jié)果進(jìn)行分析,功耗小于2mW。NMOSPMOSk(μA/V2)11169Vt(V)0.7231-0.906Va’um)52.65三.課程設(shè)計(jì)報(bào)告內(nèi)容1.設(shè)計(jì)過程:A、理論分析對2種放大器分別進(jìn)行分析,設(shè)定初值,查找參數(shù)值,進(jìn)行推測和計(jì)算、記錄各個(gè)節(jié)點(diǎn)的電流值,電壓值,電阻值。a.CS放大器:,,假設(shè),由功耗小于可假設(shè)從而推出.b.1cascode放大器的第一種理論計(jì)算:,,,假設(shè),由功耗小于可假設(shè)從而推出。由推出20b.2cascode放大器第二種理論計(jì)算:假設(shè),既,由可知均相同,且,。所以由可推出,其中.利用電流公式,::推出,理論推得B、軟件的使用首先使用captureCIS畫出電路原理圖,完成后導(dǎo)出網(wǎng)表;然后用Hspice仿真網(wǎng)表,檢查無錯(cuò)后用CosmoScope查看波形。使用Hspice工具時(shí),對不同的點(diǎn)做掃描可得出精確的結(jié)果。2.設(shè)計(jì)內(nèi)容:A、帶有源負(fù)載的CS放大器的網(wǎng)表及原理圖1.cs*sourceDESIGN1C_C10N003063pV_V1N0035705VdcM_Q4N00357N00312N00306N00357NVP+L=2u+x+AD=80p+AS=80pM_Q1N00312N00312N00357N00357NVP+L=2u+x+AD=80p+AS=80pM_Q3N00306N0077000NVN+L=5u+W=9u+AD=80p+AS=80pI_I1N003120DC50uAdcV_V2N007700DC1.55VdcAC1Vac.lib'C:\lib\h05hvcddtt09v01.lib'tt.acdec1011gsweepx1u100u1u.end2.網(wǎng)表仿真截圖管子飽和程度:3.給定n管的寬長比掃描P管的寬長比4.調(diào)試W/L的網(wǎng)表*sourceDESIGN1C_C10N003063pV_V1N0035705VdcM_Q4
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 特價(jià)房買賣合同模板
- 會議音響租賃合同
- 食品供應(yīng)鏈服務(wù)合同范文
- 搪瓷化工容器的安全標(biāo)準(zhǔn)考核試卷
- 戶外帳篷批發(fā)考核試卷
- 助動車行車記錄儀使用與維護(hù)考核試卷
- 摩托車ABS系統(tǒng)傳感器檢測考核試卷
- 工業(yè)機(jī)器人的智能電源管理考核試卷
- 體育運(yùn)動心理承受能力測試考核試卷
- 家裝整裝合同范本
- 房建市政項(xiàng)目全過程工程咨詢招標(biāo)文件范本
- 整體形象設(shè)計(jì)課件
- 硬筆書法全冊教案共20課時(shí)
- 中醫(yī)針灸治療肋間神經(jīng)痛病案分析專題報(bào)告
- 防止化學(xué)污染管理制度
- 小學(xué)夢想開《去遠(yuǎn)方》教學(xué)設(shè)計(jì)
- Q∕SY 06349-2019 油氣輸送管道線路工程施工技術(shù)規(guī)范
- CEO自戀及其經(jīng)濟(jì)后果研究:以格力電器為例
- 六鑫伺服刀塔說明書LS系列
- 19.骨折術(shù)后內(nèi)固定取出臨床路徑
- 腎內(nèi)科臨床診療規(guī)范(南方醫(yī)院)
評論
0/150
提交評論