Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Re: 4X DAC Design using Atmega16 and AD7528 IC

2007-12-10 by John Clymer

Nice work. 

If you have to ask about actual code with a fairly straight forward 
algorithm like that, then you either need to read your datasheets some 
more, or hire a programmer. 

If I assume you have the rest of the program done, then you must be 
struggling with AVR specific part of IO programming.  This is VERY easy 
for general pin functions - all VERY well described in the datasheet.  
If you are using GCC/WinAVR C compiler, the avr-libc has defined all IO 
registers needed to implement this - specifically DDRD, PORTD, DDRC and 
PORTC.  Depending on MCU clock speed, you may need to insert some delays 
between the steps of your algorithm to provide the necessary bus timing 
for the DAC.

If you haven't even started programming the remainder of your program, 
and need help writing a program from scratch, ask your instructor.  Or, 
start out by writing the embedded equivelent of Hello World - that is - 
hood a LED to one of the IO pins and start a program to toggle the pin.  
This would require a delay loop so as to slow the blinking down to the 
point of being visible.  Heck, you could even implement a delay routine 
that you could re-use later (like delay_ms - delay x # of milli-seconds, 
which could use delay_us - delay # of micro-seconds.)

If you are new to C and to the AVR, you may want to look to BASIC - use 
BASCOM, it has a nice library that would make your programming somewhat 
easier.  If your instructor insists on assembly or C, then you are on 
your own to do your homework.

John Clymer

huiyangdoh wrote:
>
> I have come out with the exact schematic and algorithm for DAC
> program using AD7528. Assume you connect to the following:
>
> 1. 8 x bit Data input you can connect to all of Atmega Port D,
> 2. For CS, DAC A/B & WRITE, you can connect to Port C [pin 0, 1,
> 2] respectively,
>
> For algorithm,
>
> 1. Set All of Port D to output mode, and
> 2, Port C [0,1,2] also to output mode and set to high.
> 3. To Write data ,
>
> - Write 8 output data to Port D,
> - Select DAC A/D, by write 1 bit data to Port C1,
> - Bring CS pin to low by write '0' to Port C0,
> - Bring WRITE pin to low by write '0' to Port C2.
>
> after that you bring the WRITE & CS pin to high by
> Write '1' to Port C2, and write '1' to Port 0.
>
> Any idea on the actual code?
>
> --- In AVR-Chat@yahoogroups.com <mailto:AVR-Chat%40yahoogroups.com>, 
> John Samperi <samperi@...> wrote:
> >
> > At 08:18 PM 9/12/2007, you wrote:
> > >11 ports lines of Atmega16 where PortC0-PortC7
> > >would be input to the 8-bit parallel AD7528 chip
> >
> > If you can avoid the use of portc2-portc5 for the chip,
> > then you will have the JTAG port available for debugging
> > or programming without too much messing around.
> >
> >
> > Regards
> >
> > John Samperi
> >
> > ********************************************************
> > Ampertronics Pty. Ltd.
> > 11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
> > Tel. (02) 9674-6495 Fax (02) 9674-8745
> > Email: john@...
> > Website http://www.ampertronics.com.au <http://www.ampertronics.com.au>
> > *Electronic Design * Custom Products * Contract Assembly
> > ********************************************************
> >
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.