Linear Technology’s LTC2631A-LZ8 is an 8bit digital to analog converter (DAC) with an I2C interface. This DAC can output 255 different voltages, spaced evenly between 0 and 2.5volts. We previously demonstrated the LTC2640 with a three-wire SPI interface, but this version is controlled with only two signal wires.

Busz kalóz
LTC2631A (pin #)

ADAT
SDA (3)

ÓRA
SCL (2)

ADC
VOUT (7)


CA0/Address 0 (1)

+5volts
CA1/Address 1 (8)

+5volts
VDD (5)

Gnd
GND (4)


REF (6)

We used the Bus Pirate universal serial interface tool to work with the DAC, but the same basic principals apply to any customized implementation. The connections between the Bus pirate and the LTC2631A are described in the table. We powered the chip from the Bus Pirate’s 5volt supply, but it would also work fine at 3.3volts.

The I2C bus requires pull-up resistors on both bus wires. 5volts is supplied to the pull-up resistors by connecting a wire from the 5volt supply to the pull-up resistor input terminal. close the jumpers on the clock and data lines to supply the external voltage to the pull-up resistors.

Now, setup the Bus Pirate for I2C mode and activate the on-board power supply.

HiZ>m<–select mode 1. HiZ 2. 1-WIRE 3. UART 4. I2C … 9. PC AT KEYBOARD MODE>4<–I2C mode 900 mode SET 202 I2C READY I2C>p<–setup power supply W/w toggles 3.3volt supply? 1. NO 2. YES MODE>1<–don’t use 3.3volts W/w toggles 5volt supply? 1. NO 2. YES MODE>2<–use 5volt supply 9xx supply CONFIGURED, use W/w TO TOGGLE 9xx VOLTAGE MONITOR: 5V: 0.0 | 3.3V: 0.0 | VPULLUP: 0.0 | I2C>W<–capital ‘W’ activates the supply 9xx 5VOLT supply ON I2C>v<–check the voltage levels 9xx VOLTAGE MONITOR: 5V: 4.9 | 3.3V: 0.0 | VPULLUP: 5.0 |<–supply on I2C>

After configuring the Bus Pirate, the voltage monitor shows that the 5volt supply is active (4.9volts). Additionally, the monitor shows that 5volts is connected to the pull-up resistor supply terminal (VPULLUP).

I2C>(0)<–list available macros 0.Macro menu 1.7bit address search I2C>(1)<–search for I2C devices xxx searching 7bit I2C address space. Found devices at: 0x40 0xE6<–got reply from these addresses I2C>

The state of pin 1 and 8 identify the LTC2631A I2C address, according to the table on page 22 of the datasheet. instead of looking up the address in the datasheet, we used the Bus Pirate’s I2C address search macro to scan the entire I2C address range. The DAC responds to the set address (0X40) and a global address (0xE6). The global address is helpful for controlling multiple DACs at the same time over the same I2C bus.

I2C>d [0x40 0b00110000 0xff 0] d
9xx VOLTAGE PROBE: 0.0VOLTS<–output is 0volts 210 I2C start CONDITION<–start transaction 220 I2C WRITE: 0x40 got ACK: YES<–DAC address 220 I2C WRITE: 0x30 got ACK: YES<–set DAC output command 220 I2C WRITE: 0xFF got ACK: YES<–set DAC to full (255) 220 I2C WRITE: 0x00 got ACK: YES<–don’t care, extra byte 240 I2C stop CONDITION<–end transaction 9xx VOLTAGE PROBE: 2.5VOLTS<–output at full I2C>

Now we’re ready to interface the DAC. An initial voltage measurement (d) shows that the DAC is currently outputting 0volts.

An I2C start condition ([) notifies connected I2C devices to listen for their address. The first byte is the address (0x40) that identifies the device we want to access. The next byte is the LTC2631A command to update the DAC output (0x30 or 0b00110000), followed by the output setting (0xff or 255, 100% output). The final byte doesn’t matter for the 8bit DAC we’re using, but carries additional data bits for higher resolution versions of the DAC. The transaction is completed by sending the I2C stop condition (]).

After updating the DAC to 100%, a voltage measurement (d) shows that the output is 2.5volts.

I2C>d [0x40 0x30 0 0] d
9xx VOLTAGE PROBE: 2.5VOLTS<–DAC at 100% 210 I2C start CONDITION 220 I2C WRITE: 0x40 got ACK: YES 220 I2C WRITE: 0x30 got ACK: YES 220 I2C WRITE: 0x00 got ACK: YES<–set DAC to 0 220 I2C WRITE: 0x00 got ACK: YES 240 I2C stop CONDITION 9xx VOLTAGE PROBE: 0.0VOLTS<–DAC at 0% I2C>

A similar command sequence sets the DAC output back to 0. A voltage measurement confirms that the DAC output is now 0volts.

For a complete list of DAC features and command codes, see the extensive discussion of the LTC2640 SPI DAC at the end of the Bus Pirate version 1 how-to.

Are there any chips you’d like us to interface in future parts posts?

Leave A Comment

Recommended Posts

39 IOS alkalmazás az App Store -ban, amelyet malware -vel

fertőzöttek, új malware -törzset észleltek az iOS App Store néhány nagyon népszerű alkalmazásában. Az Xcodeghost – tekintettel a névre, mert az az Apple Xcode integrált fejlesztési környezetének rosszindulatú felépítésével terjed ki – az a jelenlegi rosszindulatú program, amely az Apple iOS alkalmazásboltjába […]

xgujw