微机原理及其应用报告数模转换器DAC0832双缓冲输出设计
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
本科生实验报告
实验名称:数模转换器DAC0832双缓冲输出设计 一、实验目的
1)了解DAC0832芯片引脚、内部结构及工作原理;
2)掌握应用单片机I/O 端口控制DAC0832实现数模转换的方法; 3)掌握DAC0832单缓冲和双缓冲控制技术及编程设计方法; 二、实验原理
DAC0832是8位分辨率的数模转换集成芯片,内部采用倒T 形网络,电流型 输出模式,电流输出稳定时间为1us ,采用单电源供电。
片内部由一个8位输入锁存器、一个8位DAC 寄存器和一个8位D/A 转换器构成,内部具有双缓冲结构,可以实现单缓冲、双缓冲数字输入。
双缓冲同步控制方式 :
针对多个模拟量需要同时输出的控制系统,可以采用双缓冲同步控制方式。D/A 转换数据的输入锁存和D/A 转换输出分两步完成。首先,CPU 分时向各路D/A 转换器输入要转换的数字量并锁存在各自的输入锁存器中,然后,CPU 同时对所有D/A 转换器发出输入所存数据打入DAC 寄存器的控制信号,即可实现
VREF IOUT2 IOUT1
DGND
VCC
AGND RFB
多通道的同步模拟量数据输出。
应用双缓冲方式,可以在输出模拟信号的同时采集下一个数字量,有效地提高转换速度。另外,可以在多个D/A转换器同时工作时,利用双缓冲模式实现多路D/A的同步输出。
三、实验内容
通过单片机I/O端口控制两路DAC0832实现数模转换,控制方式采用双缓冲控制方式。
1.阅读理解双缓冲控制电路图,分析双缓冲模式下DAC0832与单片机接口电路的设计及两次DA转换实验在控制电路上的异同。
2.设计程序,实现双缓冲模式下DA转换的同步输出。
首先,CPU分时向各路D/A转换器输入要转换的数字量并锁存在各自的输入锁存器中,然后,通过按键控制,同时对两个DAC0832锁存数据进行数模转换,同步产生三角波、正弦波模拟输出信号。
四、实验过程
1,实验原理图
2,实验源程序
#include
sbit DAC1_WR1=P2^0;
sbit DAC2_WR1=P2^1;
sbit DAC_SW1=P2^2;
sbit DAC_SW2=P2^3;
sbit DAC_WR2=P2^7;
unsigned char code sine_tab[256]={
0x80,0x83,0x86,0x89,0x8d,0x90,0x93,0x96,0x99,0x9c,0x9f,0xa2,0xa5,0xa8,0xab,0x ae,0xb1,0xb4,0xb7,0xba,0xbc,0xbf,0xc2,0xc5,0xc7,0xca,0xcc,0xcf,0xd1,0xd4,0xd6,0 xd8,0xda,0xdd,0xdf,0xe1,0xe3,0xe5,0xe7,0xe9,0xea,0xec,0xee,0xef,0xf1,0xf2,0xf4,0 xf5,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,0xde,0xdd,0xda,0xd8, 0xd6,0xd4,0xd1,0xcf,0xcc,0xca,0xc7,0xc5,0xc2,0xbf,0xbc,0xba,0xb7,0xb4,0xb1,0xa e,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,0x 51,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,0 x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x02,0x01,0x00,0x00,0x00,0x 00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02 ,0x02,0x03,0x04,0x05,0x0 6,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,0x 43,0x45,0x48,0x4c,0x4e,0x51,0x55,0x57,0x5a,0x5d,0x60,0x63,0x66 ,0x69,0x6c,0x6 f,0x72,0x76,0x79,0x7c,0x80};
unsigned char code triangle_tab[]={
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54, 56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106, 108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146 ,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,18 6,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,2 26,228,230,232,234,236,238 ,240,242,244,246,248,250,252,254,255,255,254,252,250 ,248,246,244,242,240,238,236,234,232,230,228,226,224,222,220,218,216,214,212,21 0,208,206,204,202,200,198,196,194,192,190,188,186,184,182,180 ,178,176,174,172, 170,168,166,164,162,160,158,156,154,152,150,148,146,144,142,140,138,136,134,13 2,130,128,126,124,122,120,118,116 ,114,112,110,108,106,104,102,100,98,96,94,92, 90,88,86,84 ,82,80,78,76,74,72,70,68,66,64,62,60,58,56,54,52,50,48,46,44,42,40,38,3 6,34,32,30,28,26,24,22,20 ,18,16,14,12,10,8,6,4,2,0};