Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•Microchip is willing to work with the customer who is concerned about the integrity of their code.
•Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
K
rfPIC and UNI/O are registered trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
logo, REAL ICE, rfLAB,
Select Mode, Total Endurance, TSHARC, WiperLock and
ZENA are trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
T empe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
devices, Serial EEPROMs, microperipherals, nonvolatile memo ry and
analog products. In addition, Microchip’s quality system for the desig n
and manufacture of development systems is ISO 9001:2000 certified.
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the page number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB
Select the Help menu, and then Topics to open a list of available on-line help files.
®
IDE on-line help.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
MCP4728 Evaluation Board. Items discussed in this chapter include:
• Document Layout
• Conventions Used in this Guide
• Recommended Reading
• The Microchip Web Site
• Customer Support
DOCUMENT LAYOUT
This document describes how to use the MCP47 28 Evalu a tio n Boa rd with PICkitTM
Serial Analyzer. The manual layout is as follows:
• Chapter 1. “Quick Start Instructions” – this chapter provide s an overview of the
MCP4728 Evaluation Board and instructions on how to use the MCP4728
Evaluation Board with the PICkit
• Appendix A. “Schematic and Layouts” – shows the schematic and layout
diagrams for the MCP4728 Evaluation Board.
• Appendix B. “Bill Of Materials (BOM)” – lists the parts used to build the
MCP4728 Evaluation Board.
• Appendix C. “MCP4728 Read/Write Commands” – shows the read/write commands for the MCP4728 Evaluation Board.
This manual uses the following documentation conventions:
DOCUMENTATION CONVENTIONS
DescriptionRepresentsExamples
Code (Courier font):
Plain charactersSample code
Filenames and paths
Angle brackets: < >Variables<label>, <exp>
Square brackets [ ]Optional argumentsMPASMWIN [main.asm]
Curly brackets and pipe
character: { | }
Lowercase characters in
quotes
Ellipses...Used to imply (but not show) addi-
0xnnnA hexadecimal number where n is a
Italic charactersA variable argument; it can be either a
Interface (Arial font):
Underlined, italic text
with right arrow
Bold charactersA window or dialog button to clickOK, Cancel
Characters in angle
brackets < >
Documents (Arial font):
Italic charactersReferenced booksMPLAB
Choice of mutually exclusive argu-
ments; An OR selection
Type of data
tional text that is not relevant to the
example
hexadecimal digit
type of data (in lowercase characters)
or a specific example (in uppercase
characters).
A menu selection from the menu barFile > Save
A key on the keyboard<Tab>, <Ctrl-C>
#define START
c:\autoexec.bat
errorlevel {0|1}
“filename”
list
[“list_option...,
“list_option”]
0xFFFF, 0x007A
char isascii (char,
ch);
®
IDE User’s Guide
RECOMMENDED READING
This user's guide describes how to use MCP4728 Evaluation Board. Other useful
documents are listed below. The following Microchip documents are available and
recommended as supplemental reference resources.
PICkit™ Serial Analyzer User’s Guide, DS51647
Consult this document for instructions on how to use the PICkit Serial Analyzer
hardware and software.
MCP4728 Data Sheet, “12-Bit, Quad Digital-to-Analog Converter with EEPROM
Memory” DS22187
This data sheet provides detailed information regarding for the MCP4728
Digital-to-Analog Converter.
Microchip provides online support via our web site at www.microchip.com. This web
site is used as a means to make files and information easily available to customers.
Accessible by using your favorite Internet browser , the web site contains the following
information:
• Product Support – Data sheets and errata, application notes and sample
programs, design resources, user’s guides and hardware support documents,
latest software releases and archived software
• General Technical Support – Frequently Asked Questions (FAQs), technical
support requests, online discussion groups, Microchip consultant program
member listing
• Business of Microchip – Product Selector Guide, latest Microchip press
releases, listing of seminars and events, listings of Microchip sales offices,
distributors and factory representatives
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
• Development Systems Information Line
Customers should contact their distributor, representative or field application engineer
(FAE) for support. Lo cal sales offices are also available to help customers. A listing of
sales offices and locations is included in the back of this document.
Technical support is available through the web site at: http://support.microchip.com
The following sections provide an overview of the MCP4728 Evaluation Board and
instructions on how to program the DAC register and the EEPROM of the MCP4728
using the PICkit
• Description of the MCP4728 Evaluation Board
• How to use the MCP4728 Evaluation Board with the PICkit Serial Analyzer
1.2DESCRIPTION OF THE MCP4728 EVALUATION BOARD
The purpose of the MCP4728 Evaluation Board is to provide an easy way o f evaluating
the MCP4728’s performance and functionality with a minimum of work.
The MCP4728 Evaluation Board contains a MCP4728 (which is a 4-channel, 12-bit
Digital-to-Analog Converter), an interface conn ector for the PICkit Serial Analyzer, and
2
I
C test point terminals.The user can evaluate this board by using the PICkit Serial
Analyzer or by providing the I
terminals.
Using the MCP4728 Evaluation Board, the user can evaluate the functionality of the
MCP4728 device, such as: (a) Writing and reading the DAC registers and EEPROM of
each channel, (b) Selecting the reference voltage, (c) Measuring the DAC output
voltage, (d) Checking the LDAC
The MCP4728 Evaluation Board is designed to work friendly with the PICkit Serial
Analyzer (DV164122). The PICkit Serial Analyzer (P/N: DV164122) is used for writing
and reading the DAC configuration and register data. The PICkit Serial Analyzer
consists of hardware and PC GUI. It is highly recommended that the users order this
MCP4728 Evaluation Board and the PICkit Serial Analyze r at same tim e.
• The MCP4728 supports sta ndard mode (100kHz), fast mode (400 kHz), and high
speed mode (3.4 MHz) of the I
has 5 kΩ for the I
needs to evaluate the device with high speed mode (3.4 MHz), please replace the
R1 and R2 with lower values (less than 1 kΩ).
TM
Serial Analyzer. The following sections cover the topics:
2
C serial communication signals through the I2C test
pin feature, etc.
2
2
C pull-up resistors and supports up to the fast mode. If the user
C serial communications. This evaluation boar d
Note:The MCP4728 Evaluation Board can be used without the PICkit Serial
Analyzer as long as the V
connector. This board does not include MCU.
The MCP4728 Evaluation Board has test points for SDL, SDA, and DAC outputs. By
connecting an oscilloscope to these I
communications through the I
V
terminals) using a multimeter. Refer to Appe ndix A. “Schematic and Layouts”.
7. Select the VDD voltage of the MCP4728 Evaluation Board and click the Next
button.
Case 1: When you use VDD from the PICkit Serial Analyzer:
If you choose PICkit Serial will power your device and 5 V olt s as shown below,
the MCP4728 Evaluation Board is powered by the 5V DC from the PICkit Serial
Analyzer through the JP1 jumper. In this case, make sure that the JP1 jumper on
the MCP4728 Evaluation Board is connected.
Case 2: When you use your own VDD:
You can also provide your own VDD voltage by applying a VDD voltage at VD1
test point. In this case, make sure that the JP1 jumper is disconnected.
FIGURE 1-7:Step 4 - Voltage Source Selection Window.
8. Click the OK button. You have made all of the PICkit Serial Analyzer
Configuration Setups. You are now ready to read/write MCP4728 registers and
EEPROM.
A script file that is running on the PICkit Serial PC GUI is needed for the
communications between the PICkit Serial Analyzer and the MCP4728 Evaluation
Board. The following steps show how to create script files and h ow to use them. Refer
to the PICkit Serial Analyzer User’s Guide (DS51647) for creating the Script file.
•Select Communication -----> Script ---> Script Builder
FIGURE 1-9:Creating a Script File with Script Builder.
02 --------> This means there are two bytes to send.
C0 --------> Address byte = 1100-0000 (See Note).
80 --------> 1’st byte (000-0000) selecting external V
REF
.
I2CSTOP *
• Modify the parameters in the Script Detail column as below:
Note:All 6 parameters above must be listed in order. The parameters with * are
not modifiable. The MCP4728 device on the evaluation board has I
2
C
address bits (A2, A1, A0) = (0,0,0).
1.3.2.3SAVE THE SCRIPT FILE AND PROGRAMMING THE MCP4728 DAC
REGISTERS
1. Type in a script file name (i.e., MCP4728_W_VrfSel) in the space below the
Script Name menu.
2. Click Save Script button.
3. Click Execute Script button.
Note:At this point, the PICkit Serial Analyzer transmits the I2C Write Command
to the MCP4728 device. The saved file name will appear in the Users I2C Scripts column, and can be re-used any time by selecting the file name.
4. You can also see the SCL and SDA waveforms using an Oscilloscope.
Note:When you click on the “Execute Script” menu, the “Busy” LED on the PICkit
Serial Analyzer will momentarily turn on and then turn off. If the LED
remains ON, a communications problem has occurred. Remove the PICkit
Serial Analyzer from your computer and recheck the parameter values,
including the order of parameters und er the “Script Detail” column including
2
the I
C address of the device, and try again until the “Busy” LED turns OFF
of each DAC channel. In this example, Gain of 1 is
REF
2
C
Quick Start Instructions
1.3.2.5SAVE THE SCRIPT FILE AND PROGRAMMING THE MCP4728 DAC
REGISTERS
1. Type in any scrip t name (i.e., MCP4728_W_GainSl) in the space below the
Script Name menu.
2. Click Save Script button.
3. Click Execute Script button.
Note:At this point, the PICkit Serial transmits the I
MCP4728 device. The saved file name will appear in Users I2C Scripts
column, and can be re-used any time by selecting the file name.
4. You can also see the SCL and SDA waveforms using the Oscilloscope.
Note:When you click on the “Execute Script” menu, the “Busy” LED on the PICkit
Serial Analyzer will momentarily turn on and then turn off. If the LED
remains ON, a communications problem has occurred. Remove the PICkit
Serial Analyzer from your computer and recheck the parameter values
including the order of parameters under the “Scr ipt Detail” column including
the I2C address of the device, and try again until the “Busy” LED turns OFF
immediately after sending the I
• Select the box and
right click the mouse
button for options
available
3.Make sure the listed
parameters in “script
Detail” are in the exact
order as shown here.
1.3.2.6EXAMPLE 3: WRITING DAC REGISTERS WITH A FAST WRITE
COMMAND
Note:Please refer to the MCP4728 data sheet for the Fast Write Command
structure before excising this example.
Figure 1-12 shows an example of writing a script file on PICkit Serial PC GUI for a Fast
Write Command. This command writes to the DAC input registers and power-down
selection bits. The data are sent sequentially from channel A to the channel D.
EEPROM is not affected. This device updates the DAC output registers (V
LDAC
pin is low.
OUT
) when
FIGURE 1-12:Writing Script File to Write Each DAC Register with a Fast Write Command Using the
PICkit Serial Analyzer.
09 -------> This means there are nine bytes to send.
C0 -------> Address byte = 1100-0000 (See Note).
0F -------> 1st byte of DAC A Register (Channel A) = 0000-1111
FF -------> 2nd byte of DAC A Register (Channel A) = 1111-1111
07 -------> 1st byte of DAC B Register (Channel B) = 0000-0111
FF -------> 2nd byte of DAC B Register (Channel B) =1111-1111
03 -------> 1st byte of DAC C Register (Channel C) = 0000-0011
FF -------> 2nd byte of DAC C Register (Channel C) = 1111-1111
01 -------> 1st byte of DAC D Register (Channel D) = 0000 -0001
FF -------> 2nd byte of DAC D Register (Channel D) = 1111-1111
I2CSTOP *
• Parameters in the Script Detail column:
Note:All parameters above must be listed in order. The parameter above with *
are not modifiable. The MCP4728 device on the evaluation board has I
2
address bits (A2, A1, A0) = (0,0,0).
1.3.2.7SAVE THE SCRIPT FILE AND PROGRAMMING THE MCP4728 DAC
REGISTERS
1. Type in any script name (i.e., MCP4728_W_Fast) in the sp ace below the Script
Name menu.
2. Click Save Script button.
3. Click Execute Script button.
Note:At this point, the PICkit Serial transmits the I2C Write Command to the
MCP4728 device. The saved file name will appear in Users I2C Scripts
column, and can be re-used any time by selecting the file name.
4. You can also see the SCL and SDA waveforms using the Oscilloscope.
Note:When you click on the “Execute Script” menu, the “Busy” LED on the PICkit
Serial Analyzer will momentarily turn on and then turn off. If the LED
remains ON, a communications problem has occurred. Remove the PICkit
Serial Analyzer from your computer and recheck the parameter values
including the order of parameters und er the “Script Detail” column including
2
the I
C address of the device, and try again until the “Busy” LED turns OFF
immediately after sending the I
2
C command.
C
5. Read the V
voltage at the V
OUT
In order to update the DAC output register, the LDAC pin must be “Low”.
• Press “S1” button in the MCP4728 Evaluation Board.
The device will update the V
as soon as the LDAC pin switch S1 is pressed.
OUT
You can now measure the DAC output voltages (V
using a voltmeter. When Examples 1, 2, and 3 ar e executed seq uenti ally, all channels
use an internal reference. Figure 1-13 shows the expectation of each DAC channel outputs.
• Select the box and
right click the mouse
button for options
available
3.Make sure the listed
parameters in “script
Detail” are in the exact
order as shown here.
1.3.2.8EXAMPLE 4: MULTI-WRITE COMMAND FOR DAC INPUT REGISTERS
This command writes to the multiple DAC input registers, one regi ste r at a tim e. The
writing channel register is defined by the DAC selection bits (DAC1, DAC0). EEPROM
is not affected by this command.
Figure 1-14 shows an example of creating the PICkit Script file. In this example, the the
PICkit Serial Analyzer sends a write command to the DAC input registers A and B.
FIGURE 1-14:Writing Script file to Write Channel A for FFFh and Channel B for 800h Using a
Multi-write Command.
07 -------> This means there are seven bytes to send.
C0 -------> Address byte = 1100-0000 (See Note).
40 -------> Command Type and Selecting Channel A DAC
0F -------> Configuration register bits and data nibble
FF -------> Data byte
02 -------> Selecting Channel B DAC
08 -------> Configuration register bits and data nibble
00 -------> Data byte
I2CSTOP *
• Parameters in the Script Detail column:
Note:All parameters above must be listed in order. The parameters above with *
are not modifiable. The MCP4728 device on the evaluation board has I
address bits (A2, A1, A0) = (0,0,0).
1.3.2.9SAVE THE SCRIPT FILE AND PROGRAMMING THE MCP4728 DAC
REGISTERS
1. Type in any script name (i.e., MCP4728_W_MDAC) in the space below the
Script Name menu.
2. Click Save Script button.
3. Click Execute Script button.
Note:At this point, the PICkit Serial transmits the I2C Write Command to the
MCP4728 device. The saved file name will appear in Users I2C Scripts
column, and can be re-used any time by selecting the file name.
4. You can also see the SCL and SDA waveforms using the Oscilloscope.
Note:When you click on the “Execute Script” menu, the “Busy” LED o n the PICkit
Serial Analyzer will momentarily turn on and then turn off. If the LED
remains ON, a communications problem has occurred. Remove the PICkit
Serial Analyzer from your computer and recheck the parameter values
including the order of parameters und er the “Script Detail” column including
2
the I
C address of the device, and try again until the “Busy” LED turns OFF
immediately after sending the I
2
C command.
2
C
5. Read the V
voltage at the V
OUT
Since the UDAC bit is set to “0” in the command, the device will update the V
V
B as soon as the command is executed regardless of the condition of the LDAC
• Select the box and
right click the mouse
button for options
available
3.Make sure the listed
parameters in “script
Detail” are in the exact
order as shown here.
Script Detail
I2CSTART *
I2CWRTBYT *
04 -------> This means there are four bytes to send.
C0 -------> Address byte = 1100-0000 (See Note).
58 -------> Command Type and selection of Channel A.
0F -------> Configuration register bits and data nibble for Channel A.
FF -------> Data byte for Channel A (register and its EEPROM).
I2CSTOP *
1.3.2.10EXAMPLE 5: SINGLE WRITE COMMAND FOR DAC INPUT REGISTER
AND EEPROM
This command writes to a single DAC input register and its EEPROM. Both input
register and EEPROM are written at the acknowledge pulse of the input dat a byte. The
EEPROM program activity can be monitored through the RDY/BSY
MCP4728 data sheet for details.
Figure 1-16 shows an example of writing a script file. In this example, the PICkit Serial
Analyzer sends a single write command to the MCP4728 for the DAC A (Channel A)
input register.
.
bit and pin. See the
FIGURE 1-16:Writing Script File to Write the Channel A Register and its EEPROM with FFFh Using
a Single Write Command. The Channel A output is updated immediately with the ACK Pulse. This example
uses UDAC
Bit, instead of using LDAC pin, to update the DAC output.
Note:All parameters above must be listed in order. The parameter above with *
are not modifiable. The MCP4728 device on the evaluation board has I
address bits (A2, A1, A0) = (0,0,0).
2
C
Quick Start Instructions
1.3.2.11SAVE THE SCRIPT FILE AND PROGRAMMING THE MCP4728 DAC
REGISTERS
1. Type in any script name (i.e., MCP4728_W_SingEE) in the space below the
Script Name menu.
2. Click Save Script button.
3. Click Execute Script button.
2
Note:At this point, the PICkit Serial transmits the I
MCP4728 device. The saved file name will appear in Users I2C Scripts
column, and can be re-used any time by selecting the file name.
4. You can also see the SCL and SDA waveforms using the Oscilloscope.
Note:When you click on the “Execute Script” menu, the “Busy” LED on the PICkit
Serial Analyzer will momentarily turn on and then turn off. If the LED
remains ON, a communications problem has occurred. Remove the PICkit
Serial Analyzer from your computer and recheck the parameter values
including the order of parameters und er the “Script Detail” column including
the I2C address of the device, and try again until the “Busy” LED turns OFF
immediately after sending the I
2
C command.
C Write Command to the
5. Read the V
Since the UDAC
(V
A) output as soon as the command is executed regardless of the condition of the
OUT
LDAC
pin switch S1.
voltage at the V
OUT
test pins:
OUT
bit is set to “0” in the command, the device will update the channel A
• Select the box and
right click the mouse
button for options
available
3.Make sure the listed
parameters in “script
Detail” are in the exact
order as shown here.
1.3.2.12EXAMPLE 6: SEQUENTIAL WRITE FOR DAC INPUT REGISTERS AND
EEPROM
This command writes to the DAC input registers and EEPROM sequentially from a start
channel to the channel D. The input register is writte n at the ACK pulse of the input data
byte of each register. However, the EEPROM are written altogether at the same time
sequentially at the end of the last byte. The EEPROM writing activity can be monitored
through the RDY/BSY
Figure 1-18 shows an example of writing a script file on PICkit Serial PC GUI for this
command.
.
bit and pin. See the MCP4728 data sheet for details.
FIGURE 1-18:Writing Script file to write the Channel B to Channel D. This command writes to both
the input registers and EEPROM: (a) Channel B Settings: V
Settings: V
= Internal (2.048V), Gain = 1. (c) Channel D Settings: V
REF
The DAC outputs are updated imm ediately with th e ACK pulse. This example uses the U
08 -------> This means there are eight bytes to send.
C0 -------> Address byte = 1100-0000 (See Note).
52 -------> Command Type and Ch. B is a starting channel
0F -------> Configuration register bits and data nibble for Ch. B
FF -------> Data byte for Ch. B
FF -------> Data byte for Ch. C
90 -------> Configuration register bits and data nibble for Ch. D
I2CSTOP *
FF -------> Data byte for Ch. D
8F -------> Configuration register bits and data nibble for Ch. C
• Parameters in the Script Detail column:
Note:All parameters above must be listed in order. The parameter above with *
are not modifiable. The MCP4728 device on the evaluation board has I
2
address bits (A2, A1, A0) = (0,0,0).
1.3.2.13SAVE THE SCRIPT FILE AND PROGRAMMING THE MCP4728 DAC
REGISTERS
1. Type in an y script name (i.e., MCP4728_W_SeqB) in the sp ace below the Script
Name menu.
2. Click Save Script button.
3. Click Execute Script button.
Note:At this point, the PICkit Serial transmits the I2C Write Command to the
MCP4728 device. The saved file name will appear in Users I2C Scripts
column, and can be re-used any time by selecting the file name.
4. You can also see the SCL and SDA waveforms using the Oscilloscope.
Note:When you click on the “Execute Script” menu, the “Busy” LED o n the PICkit
Serial Analyzer will momentarily turn on and then turn off. If the LED
remains ON, a communications problem has occurred. Remove the PICkit
Serial Analyzer from your computer and recheck the parameter values
including the order of parameters und er the “Script Detail” column including
2
the I
C address of the device, and try again until the “Busy” LED turns OFF
immediately after sending the I
2
C command.
C
5. Read the V
voltage at the V
OUT
Since the UDAC bit is set to “0” in the command, the device will update the V
and D outputs as soon as the command is ex ecuted rega rdless of the co ndition of the
LDAC
The device will upload the EEPROM data to both input and output DAC registers (a)
during power-up sequence or (b) when it receives the General Call Reset command.
One of these conditions makes the analog outputs available immediately with their
current EEPROM settings. Note that the Power-Down bit must be cleared for the
output.
• Testing Procedure:
a. Write to the EEPROM with one of the examples shown earlier (i.e.,
Section 1.3.2.12 “Example 6: Sequential Write for DAC Input Registers and
EEPROM”).
b. Measure and record the analog voltage of each channel (V
multimeter.
c. Turn-off the V
Analyzer, disconnect JP1 connect.
d. Turn-back on the V
channel again. Confirm the V
1.3.2.15EXAMPLE 8: READING DAC REGISTERS AND EEPROM
This example shows how to read back the DAC input registers and EEPROM data.
Figure 1-20 shows the PICkit Serial script file to read all DAC input registers and
EEPROM data. Once this file is executed, the PC GUI will show you the contents of the
registers and EEPROM.
.
of the device. If you are using the VDD from the PICkit Serial
DD
again and measure the analog voltage (V
DD
is the same as in Step (b).
OUT
) using a
OUT
) of each
OUT
FIGURE 1-20:Reading the DAC Registers and its EEPROM with a Read Command. See
Note:In Figure 1-20, the script file called “MCP4728_Read” was created, saved
and executed.
.
FIGURE 1-21:The contents of the Registers and EEPROM. The order of the
contents: Channel A Register and EEPROM, and Channel B Register and EEPROM,
and so on sequentially. See the Read Command and Device Output details in
MCP4728 Data Sheet.
• Select the box and
right click the mouse
button for options
available
3.Make sure the listed
parameters in “script
Detail” are in the exact
order as shown here.
Script Detail
I2CSTART *
I2CWRTBYT *
03 -------> This means there are three bytes to send.
C0 -------> Address byte = 1100-0000 (See Note).
AF -------> Command Type and Power-Down bits for Chs. A and B.
FF -------> Power-Down bits for Channels C and D.
I2CSTOP *
1.3.2.16EXAMPLE 9: WRITE POWER-DOWN SELECTION BITS IN DAC INPUT
REGISTER
This command writes power-down bits to the DAC input registers.
Figure 1-22 shows an example of writing a new script file for Power-Down mode.
.
FIGURE 1-22:Writing Scr ipt file to write the power-down bits. The channel outputs are updated
immediately with the ACK pulse. This command does not require UDAC
• Parameters in the Script Detail column:
Note:All parameters above must be listed in order. The parameter above with *
are not modifiable. The MCP4728 device on the evaluation board has I
address bits (A2, A1, A0) = (0,0,0).
1.3.2.17SAVE THE SCRIPT FILE AND PROGRAMMING THE MCP4728 DAC
REGISTERS
1. Type in any script name (i.e., MCP4728_W_PDown) in the space below the
Script Name menu.
2. Click Save Script button.
3. Click Execute Script button.
2
Note:At this point, the PICkit Serial transmits the I
MCP4728 device. The saved file name will appear in Users I2C Scripts
column, and can be re-used any time by selecting the file name.
4. You can also see the SCL and SDA waveforms using the Oscilloscope.
Note:When you click on the “Execute Script” menu, the “Busy” LED on the PICkit
Serial Analyzer will momentarily turn on and then turn off. If the LED
remains ON, a communications problem has occurred. Remove the PICkit
Serial Analyzer from your computer and re-check the parameter values
including the order of parameters und er the “Script Detail” column including
2
the I
C address of the device, and try again until the “Busy” LED turns OFF
immediately after sending the I
2
C command.
C Write Command to the
5. Read the V
voltage at the V
OUT
test pins:
OUT
Once this command is executed, all analog voltage outputs (V
the analog output pins (V
Table summarizes the write comma nd type s an d th eir fun ctio ns . Th e writ e com m a nd
is defined by using three write command type bits (C2, C1, C0) and two write function
bits (W1, W0). Writing and reading the I
PICKit Serial Analyzer. Plea se see the MCP4728 data sheet for more details on th e
commands.
TABLE C-1:WRITE COMMAND TYPES
Command Field
C2C1C0W1W0
Fast Mode Write
00XNot UsedFast Write for DAC
Write DAC Input Register and EEPROM
01000Multi-Write for DAC
Write I2C Address Bits (A2, A1, A0)
0 11Not UsedWrite I2C Address
Note 1: The analog output is upd ated when LDAC pin is (or changes to) “Low”. UDAC bit is not used for this
command.
2: The DAC output is updated when LDAC
3: The device starts writing to the EEPROM on the acknowledge clock pulse of the last channel. The device
does not execute any command until RDY/BSY
4: The input and output registers are updated at the acknowledge clock pulse of the last byte. The update
does not require LDAC
Write
Function
10Sequential Write for
11Single Write for
Command NameFunction
Input Registers
Input Registers
DAC Input Registers and EEPROM
DAC Input Register
and EEPROM
Bits
pin or UDAC bit conditions. EEPROM is not affected.
This command writes to the DAC input registers sequentially
with limited configuration bits. The data is sent sequentially
from channels A to D. The input registe r is written at the
acknowledge clock pulse of the channel’s last input data byte.
EEPROM is not affected. (Note 1)
This command writes to multiple DAC input registers, one DAC
input register at a time. The writing channel register is defined
by the DAC selection bits (DAC1, DAC0). EEPROM is not
affected. (Note 2)
This command writes to both the DAC input registers and
EEPROM sequentially. The sequential writing is carried out
from a starting channel to channel D. The starting channel is
defined by the DAC selection bits (DAC1 and DAC0).
The input register is written at the acknowledge clock pulse of
the last input data byte of each register. However, the
EEPROM data is written altogether at the same time sequentially at the end of the last byte. (Note 2),(Note 3)
This command writes to a single selected DAC input register
and its EEPROM. Both the input register and EEPROM are
written at the acknowledge clock pulse of the last input data
byte. The writing channel is defined by the DAC selection bits
(DAC1 and DAC0). (Note 2),(Note 3)
This command writes new I2C address bits (A2, A1, A0) to the
DAC input register and EEPROM.