AN-759: 扩展ADuC8xxADuC702x系列的DAC输出数 (uC012) (Rev. 0)

AN-759
ᆌᆩԴऻ
One Technology Way t P.O. B ox 9106 t Norwood, MA 02062-9106 t Tel: 781/329-4700 t Fax: 781/326-8703 t www.analog.com
કቛADuC8xxतADuC702xဣଚ‫ڦ‬DAC๼‫؜‬ຕ
ፕኁǖAude Richard
०঻
AD53x4
ADIࠅິླྀ‫ڦ؜‬MicroConverter®ဣଚׂ೗ण‫ׯ‬କ‫ڇ‬ୟ‫ۉ‬უ
๼‫ܠࢅ؜‬ୟ‫ۉ‬უ๼‫ڦ؜‬DACă
AD53x4)཮1*๟ᅃဣଚ‫ټ‬๼‫ۉ؜‬უ࣐؋ഗ‫຺ڦ‬ཚ‫ڢ‬8-/10/12-࿋৛‫܈‬DACLj֑ᆩ10ᆅগ‫ྲڦ‬႙SOIC‫ހ‬ጎLj‫ۉڇ‬ᇸࠃ
‫ྷݔۉ‬2.5 V዁5.5 VLj3 V‫ۉ‬ᇸࠃ‫้ۉ‬ၩࡼ500 μA‫ୁۉ‬ăഄೌా
๼‫ٷݣ؜‬ഗీᅜ0.7 V/μs‫ڦ‬უӦ୲ํ၄ࡆ‫ڦࡆڟ‬๼‫؜‬Ӧ‫ޗ‬ă֑
ᆩᅃ߲ෙ၍๕‫ز‬ႜথ੨Lj้ዓ໏୲ፌߛ੗‫ٳ‬30 MHzLj൐ᇑ
ՔጚSPIথ੨ग़ඹă߸‫ၘܠ‬ဦాඹLj൩֖ለAD5304ຕ਍๮
֩ă
ሞగၵᆌᆩዐLj੗ీႴᄲ‫ڦྔܮ‬ఇె๼‫؜‬ཚ‫ڢ‬ăᅺُLj
MicroConverterՂႷྔথᅃ߲‫ݴ‬૬‫ܠڦ‬ཚ‫ڢ‬DACăॽMicroConverterᇑADI‫ڦ‬ၭ‫ހ‬ጎLjग़ඹSPI‫ܠڦ‬ཚ‫ڢ‬DAC၎૶੗ᅜ
࢔ඹᅟ‫ํڦ‬၄‫ۉ‬უ๼‫؜‬ཚ‫ڦڢ‬કቛă
ԨᆌᆩԴऻ௮ຎକසࢆཚࡗᅃ߲०‫ڦڇ‬ෙ၍๕SPIথ੨ํ၄
ADuC814ईADuC7020ᇑ຺ཚ‫ۉڢ‬უ๼‫؜‬8-/10-/12-࿋৛‫܈‬
DACׂ೗AD5304 / AD5314 / AD5324 (AD53x4)‫૶ڦ‬থă
VDD
REFIN
LDAC
SCLK
SYNC
INPUT
REGISTER
DAC
REGISTER
STRING
DAC A
BUFFER
VOUTA
INPUT
REGISTER
DAC
REGISTER
STRING
DAC B
BUFFER
VOUTB
INPUT
REGISTER
DAC
REGISTER
STRING
DAC C
BUFFER
VOUTC
INPUT
REGISTER
DAC
REGISTER
STRING
DAC D
BUFFER
VOUTD
INTERFACE
LOGIC
DIN
POWER-ON
RESET
AD5304/AD5314/AD5324
POWER-DOWN
LOGIC
GND
཮1. AD53x4ࠀీ઀཮
Rev. 0 | Page 1 of 4
AN-759
ᆘॲথ੨
SPIথ੨
཮2၂๖‫ڦ‬๟AD53x4ᇑMicroConverterኮक़‫زڦ‬ႜথ੨ă
ᆯᇀAD53x4ྺٗഗॲLjMicroConverterԥದዃྺዷഗॲLj
नྺAD53x4༵ࠃSCLKăMOSI)ዷ݀ٗ๭*ᆅগ૶থ዁DAC
‫زڦ‬ႜຕ਍၍(DIN)ăAD53x4‫ڦ‬SYNC๼෇Ljनೌ჋႑
ࡽLj੗ᇑADuC814‫ڦ‬ᅃ߲࿋੗Պ‫ײ‬ᆅগ၎૶LjԲසP3.4ă
ईኁᇑADuC7020‫ڦ‬ᅃ߲ཚᆩణ‫ڦ‬I/O၎૶LjԲසP1.7ă
t!!ADuC7020༵ࠃᅃ߲2.5 Vೌฉएጚ‫ۉ‬უLjঢ়߾‫׍‬ၯጚLjਨ
‫ܔ‬৛‫ྺ܈‬2.5 V ±10 mVăසࡕॽ޿ాևएጚ‫ۉ‬უᆩᇀ
AD53x4LjሶᆌሞVREFᆅগ‫ت‬৊ႜ࣐؋LjժႷᆩᅃ
߲470 nF‫ۉ‬ඹॽ޿ᆅগ૶থ዁AGNDă
ADuC814
CREF
AD53x4๼෇ᅎ࿋स٪ഗྺ16࿋Lj‫ړ‬SYNCྺ‫้گ‬Lj޿ഗॲ
ᄲথ๭ઠጲMicroConverter‫ڦ‬ଇጴবຕ਍ă
ADuC814ฉுᆶٗഗॲ჋ስईೌ჋๼‫؜‬LjՂႷ๑ᆩᅃ߲
GPIOă‫ܔ‬ᇀADuC7020LjSPIথ੨༵ࠃᅃ߲ٗഗॲ჋ስईೌ
჋๼‫؜‬Lj‫ڍ‬௅݀ྜᅃ߲ጴবLj‫ࣷۼ‬Վྺߛ‫ۉ‬ೝLjᅺܸႴᄲ
ᆩᅃ߲GPIOઠ੦዆ྔևDAC‫ڦ‬SYNC႑ࡽă݀ໃຕ਍้ံ
݀ໃߛ࿋ă
ADuC814
OR
ADuC7020
REFIN
AGND
཮3 ๑ᆩADuC814एጚ๼‫؜‬
ADuC814෉ॲথ੨
ଚ՗1๟ٗໜ޹‫پ‬ஓዐ჋ൽ‫ڦ‬ᇑAD53x4থ੨၎࠲‫ڦ‬ᅃ܎‫پ‬
ஓă
AD53X4
SPIথ੨ሞinit814ࡧຕా৊ႜ‫؛‬๔ࣅLj‫߳ܔ‬ዖఇ๕֖ຕ৊ႜ
ยዃLjᅜ஢ፁAD53x4‫ڦ‬SPI้Ⴞᄲ൱ă
P3.4 OR P1.7
SYNC
SCLOCK
SCLK
MOSI
AD53X4
ad53x4outྺথ੨ࡧຕLj๯ံLj‫ܔ‬ઠጲߴ֖ۨຕ‫ڦ‬16࿋ຕ਍
‫ߛڦ‬࿋ጴব৊ႜ‫ت‬૙Ljᅜሜ෇AD53x4๼෇ᅎ࿋स٪ഗ‫ߛڦ‬
࿋ ጴ ব (ᆶ ࠲ ຕ ਍ ߭ ๕ ా ඹ Lj ൩ ֖ ለ AD5304/AD5314/
AD5324ຕ਍๮֩)ă
DIN
཮2!AD53x4ᇑADuC814/ADuC7020থ੨
૧ᆩMICROCONVERTER‫ڦ‬एጚ‫ۉ‬უ
සᆶႴᄲLjAD53x4੗૧ᆩMicroConverterాև‫ڦ‬एጚ‫ۉ‬
უă
t"%V$༵ࠃᅃ߲ೌฉ2.5 V৛௢‫ټ‬ဤएጚă޿2.5 Vాև!
एጚ‫ۉ‬უঢ়߾‫׍‬ၯጚLjਨ‫ܔ‬৛‫ྺ܈‬2.5 V ±2.5%ăසࡕॽ
޿ ా և ए ጚ ‫ ۉ‬უ ᆩ ᇀ AD53x4Lj ሶ ᆌ ሞ CREFᆅ গ ዁
AGND‫ت‬৊ႜ࣐؋Ljස཮3໯๖ă֑ᆩ5 V‫ۉ‬ᇸࠃ‫้ۉ‬Lj޿
ాևएጚ‫ۉ‬უ‫ۆڦ‬႙ሯำႠీྺ150 nV/Hz@1 kHzLj኱
ୁሯำ‫ރރ‬ኵྺ100 mVă
඗ࢫཚࡗspiTxࡧຕ݀ໃ޿ጴবăໜࢫ݀ໃ‫گ‬࿋ጴবLjܸٗ
ྜ‫ׯ‬16࿋ຕ਍‫د‬๼ăጀᅪad53x4csLj৽๟AD53x4‫ڦ‬SYNC
႑ࡽLjሞSPI‫ڦ‬ଇ߲૶Ⴤጴব‫د‬๼ࡗ‫ײ‬ዐԍ‫׼‬փՎă
spiTxࡧ ຕ Lj ԥ ad53x4outۙ ᆩ Lj ཚ ࡗ ॽ ጴ ব ຕ ਍ ႀ ෇
SPIDATस٪ഗઠ݀ໃtxDAT֖ຕ໯ࡤጴবຕ਍ă޿ࡧຕ඗
ࢫ‫ځڪ‬ISPIՔኾ࿋ԥዃ࿋Ljᅜ๖‫د‬๼঳ຐăጀᅪLjሞ‫د‬๼
‫ ݏ‬஬ ้ Lj ᆘ ॲ փ ࣷ ጲ ‫ ۯ‬ዘ ዃ ISPI࿋ Lj ᅺ ُ Ղ Ⴗ ሞ ႀ ෇
SPIDATኮമཚࡗ෉ॲ৊ႜยዃăଷႴጀᅪ‫ڦ‬๟LjspiTxࡧ
ຕՂႷሞඓණ‫د‬๼঳ຐኮࢫ‫ۙڟ࣮ݓ‬ᆩࡧຕLjᅜඓԍۙᆩ
ࡧຕሞຕ਍‫د‬๼঳ຐࢫܸ‫ݥ‬ຕ਍‫د‬๼ࡗ‫ײ‬ዐ‫ܔ‬SYNC႑ࡽ
ൽ‫ݒ‬ă
Rev. 0 | Page 2 of 4
AN-759
sbit ad53x4cs = P3^4;
// Chip select for ad53x4 (PORT3.4)
void init814(void)
{
/* Initialize other peripherals here */
// Initialize internal peripherals
/* Initialize SPI to talk to AD53x4 */
CFG814 = 0x01;
SPICON = 0x38;
// Serial interface enable for P3.5..P3.7 pins
// Enable SPI I/F as master, SCLOCK idle H,
// advance MSB output, sclock=fcore/2=1.05Mhz
}
void spiTx(unsigned char txDat)
{
ISPI = 0;
SPIDAT = txDat;
while(!ISPI);
}
// Transmit a byte data over the SPI
void ad53x4out(unsigned char adrs,
bit pdN,
bit ldacN,
unsigned short dat)
{
unsigned char txDat;
//
//
//
//
// Clear ISPI bit
// Wait until tx complete
A1,A0 bit of the contents
PD bit of the contents
LDAC bit of the contents
12-bit output data
ad53x4cs = 0;
txDat = ((unsigned char) (dat>>8)) & 0x0f;
txDat |= ldacN ? 0x10 : 0x00;
txDat |= pdN ? 0x20 : 0x00;
txDat |= (adrs<<6);
spiTx(txDat);
// Tx the upper byte
txDat = (unsigned char) dat;
spiTx(txDat);
// Tx the lower byte
ad53x4cs = 1;
}
ଚ՗1 ቌጲໜ޹‫پ‬ஓ53x4forADuC814.C‫ڦ‬၎࠲‫پ‬ஓ܎
Rev. 0 | Page 3 of 4
AN-759
ଚ ՗ 2๟ ٗ ໜ ޹ ‫ پ‬ஓ ADuC7020toAD53x4.cዐ ჋ ൽ ‫ ڦ‬ᇑ
AD53x4ࢅADuC7020থ੨၎࠲‫ڦ‬ᅃ܎‫پ‬ஓă
SPIথ੨ሞinit702xࡧຕా৊ႜ‫؛‬๔ࣅLj‫߳ܔ‬ዖఇ๕֖ຕ৊
ႜยዃLjᅜ஢ፁAD53x4‫ڦ‬SPI้Ⴞᄲ൱ă
AD53x4outྺথ੨ࡧຕLj๯ံLj‫ܔ‬ઠጲߴ֖ۨຕ‫ڦ‬16࿋ຕ
਍‫ߛڦ‬࿋ጴব৊ႜ‫ت‬૙Ljᅜሜ෇AD53x4๼෇ᅎ࿋स٪ഗ‫!!ڦ‬
ߛ࿋ጴব)ᆶ࠲ຕ਍߭๕ాඹLj൩֖ለAD5304/AD5314/
AD5324ຕ਍๮֩Džă
void init702x(void){
GP1DAT = 0x80800000;
GP1SET = 0x00800000;
GP1CON = 0x02020000;
SPICON = 0x4B;
SPIDIV = 0x14;
}
඗ࢫཚࡗspiTxࡧຕ݀ໃ޿ጴবăໜࢫ݀ໃ‫گ‬࿋ጴবLjܸٗ
ྜ‫ׯ‬16࿋ຕ਍‫د‬๼ă
ጀᅪP1.7Lj৽๟AD53x4‫ڦ‬SYNC႑ࡽLjሞSPI‫ڦ‬ଇ߲૶Ⴤጴ
ব‫د‬๼ࡗ‫ײ‬ዐԍ‫׼‬փՎă
spiTxࡧຕLjԥad53x4outۙᆩLjཚࡗॽጴবຕ਍ႀ෇SPITX
स٪ഗઠ݀ໃtxDat֖ຕ໯ࡤጴবຕ਍ă޿ࡧຕ඗ࢫ‫ځڪ‬Lj
኱‫ڟ‬SPISTAस٪ഗ‫ڦ‬SPIRX஢Քኾ࿋)࿋4*ԥዃ࿋Ljᅜ๖‫د‬
๼঳ຐăጀᅪLjՂႷᆩ෉ॲཚࡗ‫܁‬ൽSPIRXस٪ഗઠൣ‫أ‬
SPIRX஢Քኾ࿋ă
// and pull /SYNC High
// Set the DIV to run at 1.05Mhz
void spiTx(unsigned char txDat){
SPITX = txDat;
while(!(SPISTA & 0x08));
txDat = SPIRX;
}
// Send txDat to the AD5304
// Wait of end of transfer
void ad53x4out(unsigned short address, unsigned short pdN, unsigned short ldacN, unsigned short dat){
txDat1 = 0;
txDat0 = 0;
// Reset txDat1 to 0
// Reset txDat0 to 0
txDat1 |= (address << 6);
txDat1 |= pdN ? 0x20 : 0x00;
//
//
//
//
Store the address in the upper 2 bits of txDat1 (8 bit)
If pdN is set, copy a logic 1 into the next space,
if not copy a logic 0
If ldacN is set, copy a 1 into the next space, if not copy a 0
//
//
//
//
Pull
Send
Send
Pull
txDat1 |= ldacN ? 0x10 : 0x00;
txDat1 |= (dat >> 4);
txDat0 |= (dat << 4);
txDat0 &= 0xf0;
//send the data
GP1CLR = 0x800000;
spiTx(txDat1);
spiTx(txDat0);
GP1SET = 0x800000;
/SYNC High
txDat1 to the SPI
txDat0 to the SPI
/SYNC Low
}
ଚ՗2 ቌጲໜ޹‫پ‬ஓADuC7020to53x4.c‫ڦ‬၎࠲‫پ‬ஓ܎
©2007 Analog Devices, Inc. All rights reserved. Trademarks and
registered trademarks are the property of their respective owners.
Rev. 0 | Page 4 of 4
AN05247–0–2/05(0)
ADuC7020෉ॲথ੨