您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > 实验五 信号发生器仿真设计实验
实验五信号发生器仿真设计实验一、实验目的1.掌握信号发生器的信号产生原理;2.掌握ADC0808、DAC0832芯片的工作原理。二、实验原理1.图1系统框图2.DAC0832引脚功能:(1)(chipselected芯片选择,片选):片选信号,低电平有效。(2):输入寄存器的写选通信号。(3)GND:第3脚的GND为模拟信号地,第10脚的GND为数字信号地(4)DI0~DI7(DI表示DigitalInput,数字输入):8位数据输入端,TTL电平。(5)VREF(Referencevoltageinput参考电压输入):基准电压输入引脚,要求外接精密电压源(-10~10V)(6)RFB(FeedBackResistor反馈电阻):反馈信号输入引脚,反馈电阻集成在芯片内部(7)IOUT1、IOUT2:电流输出引脚,电流IOUT1和IOUT2的和为常数(约为图3中的VREF/R),当输入全为1时Iout1最大,当输入为全0时,IOUT2最大。IOUT1和IOUT2随DAC寄存器的内容线性变化。单极性输出时,IOUT2通常接地。(8):数据传送信号,低电平有效。(9):DAC寄存器写选通信号,(10)ILE(inputlatchenable输入锁存使能):数据允许锁存信号,高电平有效。(11)VCC:电源输入引脚(+5V~+15V)D/A转换及放大电路输出电路AT89C51复位振荡电路按键电路图2DAC0832引脚排列3.DAC0832的三种工作方式⑴单缓冲方式:单缓冲方式是控制输入锁存器和DAC寄存器同时接收资料,或者只用输入锁存器而把DAC寄存器接成直通方式。此方式适用只有一路模拟量输出或几路模拟量异步输出的情形。⑵双缓冲方式:双缓冲方式是先使输入寄存器接收资料,再控制输入寄存器的输出资料到DAC寄存器,即分两次锁存输入资料。此方式适用于多个D/A转换同步输出的情节。⑶直通方式:直通方式是资料不经两级锁存器锁存,即、、、均接地,ILE接高电平。数字量一旦输入,就直接进入DAC寄存器,进行D/A转换。此方式适用于连续反馈控制线路,不过在使用时,必须通过另加I/O接口与CPU连接,以匹配CPU与D/A转换。(3)直通联接方式:数字量一旦输入,直接进入DAC寄存器,进行D/A转换。本实验以直通联接方式为例。片选信号、写信号、及传送控制信号的引脚全部接地。允许输入锁存信号ILE接高电平。图3直通连接方式4、波形产生原理:正弦波信号是利用matlab将正弦曲线均匀采样后,得到等间隔时刻的y方向上的二进制数值,然后通过查表法依次输出经D/A转换得到;方波信号是利用定时器中断,每次中断时,将输出的数字数量取反即可。三、实验步骤1.在PROTEUS平台中画出电原理图。2.在keil平台中进行编程、编译,生成目标文件(.HEX文件)3.在PROTEUS平台中加载目标文件(.HEX文件)并进行仿真调试,若达不到要求,则要修改程序,反复调试,直到成功。四、实验内容利用DA0832芯片搭建电路,编程实现正弦波、方波信号的输出。要求:按下key1,示波器显示正弦波形;按下key2,显示方波波形。Proteus电路设计参考1.元器件列表:AT89C51:MCU;BUTTON:按钮;CAP,CAP-ELEC:电容,电解电容;CRYSTAL:晶振;DAC0832:数模转换芯片;OPAMP:放大器;RES:电阻2.参考程序:#includereg51.hsbitwr=P3^6;sbitrd=P3^2;sbitkey0=P1^0;sbitkey1=P1^1;unsignedcharflag;unsignedcharconstcodeZXB_code[]={0x80,0x83,0x86,0x89,0x8D,0x90,0x93,0x96,0x99,0x9C,0x9F,0xA2,0xA5,0xA8,0xAB,0xAE,0xB1,0xB4,0xB7,0xBA,0xBC,0xBF,0xC2,0xC5,0xC7,0xCA,0xCC,0xCF,0xD1,0xD4,0xD6,0xD8,0xDA,0xDD,0xDF,0xE1,0xE3,0xE5,0xE7,0xE9,0xEA,0xEC,0xEE,0xEF,0xF1,0xF2,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFD,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFD,0xFD,0xFC,0xFB,0xFA,0xF9,0xF8,0xF7,0xF6,0xF5,0xF4,0xF2,0xF1,0xEF,0xEE,0xEC,0xEA,0xE9,0xE7,0xE5,0xE3,0xE1,0xDF,0xDD,0xDA,0xD8,0xD6,0xD4,0xD1,0xCF,0xCC,0xCA,0xC7,0xC5,0xC2,0xBF,0xBC,0xBA,0xB7,0xB4,0xB1,0xAE,0xAB,0xA8,0xA5,0xA2,0x9F,0x9C,0x99,0x96,0x93,0x90,0x8D,0x89,0x86,0x83,0x80,0x80,0x7C,0x79,0x76,0x72,0x6F,0x6C,0x69,0x66,0x63,0x60,0x5D,0x5A,0x57,0x55,0x51,0x4E,0x4C,0x48,0x45,0x43,0x40,0x3D,0x3A,0x38,0x35,0x33,0x30,0x2E,0x2B,0x29,0x27,0x25,0x22,0x20,0x1E,0x1C,0x1A,0x18,0x16,0x15,0x13,0x11,0x10,0x0E,0x0D,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0D,0x0E,0x10,0x11,0x13,0x15,0x16,0x18,0x1A,0x1C,0x1E,0x20,0x22,0x25,0x27,0x29,0x2B,0x2E,0x30,0x33,0x35,0x38,0x3A,0x3D,0x40,0x43,0x45,0x48,0x4C,0x4E,0x51,0x55,0x57,0x5A,0x5D,0x60,0x63,0x66,0x69,0x6C,0x6F,0x72,0x76,0x79,0x7C,0x7E};unsignedcharkeyscan(){unsignedcharkeyscan_num,temp;P1=0xff;temp=P1;if(~(temp&0xff)){if(key0==0){keyscan_num=1;}elseif(key1==0){keyscan_num=2;}else{keyscan_num=0;}returnkeyscan_num;}}voidinit_DA0832(){rd=0;wr=0;}voidZXB(){unsignedinti;do{P2=ZXB_code[i];i=i+1;}while(i256);}voidFB(){EA=1;ET0=1;TMOD=1;TR0=1;TH0=0xff;TL0=0x83;}voidmain(){init_DA0832();do{flag=keyscan();}while(!flag);while(1){switch(flag){case1:do{flag=keyscan();ZXB();}while(flag==1);break;case2:FB();do{flag=keyscan();}while(flag==2);TR0=0;break;default:flag=keyscan();break;}}}voidtime0(void)interrupt1{P2=~P2;TH0=0xff;TL0=0x83;TR0=1;}五、实验小结写出实验小结,内容包括实验心得(收获)、不足之处和今后应注意的问题。
本文标题:实验五 信号发生器仿真设计实验
链接地址:https://www.777doc.com/doc-2458929 .html