PIC'ing the MAX5591: Interfacing a PIC Microcontroller to the MAX5591 Fast-Settling DAC
Abstract: A tutorial is presented on interfacing a PIC18F442 microcontroller to the MAX5591 fast-settling DAC, with an example program.
MAX5591 Overview
The MAX5591 is a 12-bit, fast-settling DAC featuring a 3-Wire SPI serial interface. The MAX5591 interface is capable of supporting SPI up to 20MHz, with a maximum settling time of 3µs. This application note contains descriptions of an application circuit and all the firmware required to interface the fastest line of PIC microcontrollers (the PIC18F core) to the MAX5591. The example assembly program was written specifically for the PIC18F442, using the free assembler provided in MPLAB® IDE version 6.10.0.0.
Hardware Overview
The application circuit utilizes the MAX5591EVKIT, which consists of the MAX5591, an ultra-high-precision voltage reference (MAX6126), two push-button switches, gain-setting resistors, and a proven PCB layout. The PIC18F442 is not present on the MAX5591EVKIT board, but it was added to the system here to complete the application schematic shown in Figure 1. The /CS\, SCLK, DIN and DOUT pads on the MAX5591EVKIT allow an easy connection for the SPI serial interface.
It is good practice to separate the analog and digital ground planes. An example of this is shown in Figure 2. Both ground planes should be connected together through a ferrite bead. Using a ferrite bead such as the TDK MMZ1608B601C to connect both grounds prevents the microcontroller's system clock and its harmonics from feeding into the analog ground. Knowing that the system clock of the PIC18F442 is 40MHz, the MMZ1608B601C was chosen for its specific impedance vs. frequency characteristics. Figure 3 shows the impedance vs. frequency curve for the MMZ1608B601C.
Figure 2. Separating analog and digital grounds.
Figure 3. Impedance vs. frequency curve for the TDK MMZ1608B601C ferrite bead.
Firmware Overview
The example assembly program shown in Listing 1 initializes the MAX5591 using the PIC18F442's internal MSSP SPI peripheral. The PIC18F442's 40MHz system clock allows the MSSP to provide an SPI clock (SCLK) up to 10MHz. Table 1 shows the only configuration word required after power. Once the MAX5591 is initialized, the program constantly loads the DAC output registers with zero scale followed by full scale, as shown in Table 2. This constant loop results in a square wave that demonstrates the fast settling time of the MAX5591.
Download Listing 1. This assembly example program interfaces to the MAX5591 using the PIC18F442's internal MSSP SPI peripheral.
Table 1. Configuration write command for setting the settling time to 3µs for all eight DACs.
SPI Line
C7
C6
C5
C4
C3
C2
C1
C0
D7
D6
D5
D4
D3
D2
D1
D0
DIN
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
1
Table 2. Load all DAC outputs commands. The first command sets all the DAC outputs to zero scale and the second command sets all the DAC outputs to full scale.
SPI Line
C3
C2
C1
C0
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
DIN (1st)
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
DIN (2nd)
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
의견을 보내주세요! 위 내용이 도움이 되셨나요? 여러분의 의견을 기다립니다 — Maxim은 보내주신 정정이나 제안사항을 반영하고 있습니다.
이 페이지를 평가하고 의견을 보내주십시오.