Summary of 3 channel, 8 bit EEPROM DAC with DS interface using ATtiny12 microcontroller
### Summary This article describes a low-cost, low-power 3-channel 8-bit PWM DAC project using the ATtiny12 microcontroller. It features an internal EEPROM for autonomous operation, storing DAC values that auto-load on power-up without a host microcontroller. The device allows manual loading via a DS interface and includes hardware considerations for RC filters to manage ripple and oscillator frequency stability at varying voltages.
Parts used in the 3 channel 8 bit EEPROM DAC:
- ATtiny12 microcontroller
- EEPROM memory (16 bytes)
- DS interface pins
- RC filter components (resistors and capacitors)
- Brownout detector
- Internal oscillator
- Low power.
- EEPROM memory for autonomous operation, 16 bytes available for general purpose use.
- Low cost.
This device provides three channels of 8 bit pulse-width modulation. Output pulse duty cycle ranges from 0 to 255/256 in 255 steps. DACs may be loaded by the DS interface. DAC values may also be copied into the on-chip EERPOM and then automatically be loaded into the DACs when power is applies, making it useful for automatic set up of circuits that do not contain microcontrollers. This replaces more expensive EEPROM DACs and EEPROM pots in many applications, owing to its use of a small area high volume integrated circuit microcontroller. Additionally, one page of 16 bytes of on-chip EEPROM storage is accessible via the DS interface.
Pinouts of the DAC. Avoid long parallel traces or flat ribbon cable runs with the PWM0 and Attention line signals in parallel in such a way that the PWM0 signal couples heavily into the Attention line as this signal could make the interface hang up .
Downloads
Code
AVRStudio assembler source (HTML -copy and paste to assembler editor)
AVRStudio hex file
MACAVRpa hex file
When programming the chip it is recommended elect internal oscillator and set the brownout detector to the high voltage consistent with your application.
Short form user guide dsdacmap.pdf (36k file)
Hardware considerations
With the values for the RC (resistor-capacitor) filters given on the schematic above, the worst case ripple will be about 1/2 lsb at 5V. Lower power supply voltages casue the ATtiny12’s osciallator frequency to dorp. Thus to maintain 1/2 lsb ripple. It would be necessary to increase the resistors or the capcaitors in the output filter.
If during reset initialization, the EEPROM checksum is found to be correct, the DAC values stored in EEPROM will be loaded into the DACs. As such, the DS interface pins can be permanently tied to ground if the situation calls for it. Similarly, if the reset input is not used, the 100k resistor may be omitted and pin 1 tied directly to VCC. If the reset input is tied directly to VCC check the final assembly language code carefully to make sure that DDRB bit 5 is never set as an output and PB5 is never driven low because port B bit 5 is an alternative function of pin 1.
This DS slave device does not have any internal pull-ups. This chip uses the same PWM generation method as the 8 channel 8 bit DAC. See this page for details of operation.
It should be noted that the VCC of the PWM DAC needs to be close to the VCC of the host. Check the device’s respective data sheets for details.
For more detail: 3 channel, 8 bit EEPROM DAC with DS interface using ATtiny12 microcontroller
- What is the primary function of this device?
It provides three channels of 8 bit pulse-width modulation with autonomous operation capabilities. - How are DAC values loaded automatically?
DAC values can be copied into on-chip EEPROM and automatically loaded when power is applied. - Can the DS interface pins be permanently tied to ground?
Yes, if the EEPROM checksum is correct during reset initialization, the pins can be tied to ground. - What happens if the power supply voltage is lowered?
Lower voltages cause the ATtiny12 oscillator frequency to drop, requiring larger resistors or capacitors in the output filter. - Why should long parallel traces be avoided?
Avoiding them prevents the PWM0 signal from coupling heavily into the Attention line, which could hang the interface. - Does this chip have internal pull-ups?
No, this DS slave device does not have any internal pull-ups. - What is the recommended setting for the brownout detector?
It is recommended to set the brownout detector to the high voltage consistent with your application. - What must be checked if the reset input is tied directly to VCC?
You must check the assembly code to ensure DDRB bit 5 is never set as an output and PB5 is never driven low. - How close should the VCC of the PWM DAC be to the host VCC?
The VCC of the PWM DAC needs to be close to the VCC of the host system.

