PIC'ing the MAX5591: Interfacing a PIC Microcontroller to the MAX5591 Fast-Settling DAC
MAX5591 OverviewThe 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 18.104.22.168.
Hardware OverviewThe 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.
For Larger Image
Figure 1. MAX5591 application schematic.
Analog and Digital Ground PlanesIt 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 OverviewThe 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.
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.
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.