# dds_ad9833

Analog Devices AD9833 DDS Chip library

Author | Tijs van Roon@RedSam, Copyright © 2010, all rights reserved.
Adapted-by |
Compiler | >=2.4m

Description

      Analog Devices AD9833 Direct-Digital-Synthesis (DDS) chip library.

      The library assumes that the AD9833 chip is clocked 25Mhz (MCLK). If not, read the
    last section to know how to change the constants to your needs.
    The library is probably a very good start for other Analog DDS chips as well since
    all work from the same principal.

    Setup:
    Assure that you are using a 25 Mhz oscillator on the dds chip. Otherwise change
    the constant. See below (in the source) on how to do this.

Dependencies

No dependency found

## Summary

### Global variables/contants

- `const _dds_control_sleep = 0b_0000_0000_1100_0000`
- `const _dds_control_reset = 0b_0000_0001_0000_0000`
- `const dword _dds_const_int = 10`
- `const dword _dds_const_dec = 12_371_825`
- `const _dds_control_base = 0b_0010_0000_0000_1000`
- `const _dds_control_triangle = 0b_0000_0000_0000_0010`
- `const _dds_control_sine = 0b_0000_0000_0000_0000`
- `const _dds_control_square = 0b_0000_0000_0110_0000`

### Procedures

### Functions

## API details

### Global variables/contants

- `const _dds_control_sleep = 0b_0000_0000_1100_0000`

      Sleep on, DAC off

- `const _dds_control_reset = 0b_0000_0001_0000_0000`

      reset

- `const dword _dds_const_int = 10`

  No documentation found

- `const dword _dds_const_dec = 12_371_825`

  No documentation found

- `const _dds_control_base = 0b_0010_0000_0000_1000`

      Info on the Control Word: ---------------------------------------------------
      bit		we use	descr
      15/14	xx		register select: 00 = control, 01 = freq0, 10 = freq1, 11 = phase0&1 (use bit 13
      13		1		B28: 	0 = select LSB/MSB via bit 12, 1 = write MSB&LSB in consecutive write,
      B28: 	0 = write phase0, 1 = write phase1
      12		0		HLB: select LSB/MSB: ignored in 28-bit mode
      11		0		FSELECT: 0 = freq0, 1 = freq1
      10		0		PSELECT: 0 = phase0, 1 = phase1
      9		0		reserved
      8		x		RESET: 1 = reset state, 0 = no reset. 1 on init, 0 on running
      7 		0		SLEEP1: 0 = MCLK enabled, 1 = MCLK disabled (device freezes)
      6		0		SLEEP12: 0 = DAC on, 1 = DAC disabled
      5		x		OPBITEN: 0 = DAC (sine/triangle), 1 = MSB (square)
      4 		0		reserved
      3		0		DIV2: 0 = MSB/2, 1 = MSB
      2		0		reserved
      1		x		MODE: 0 = Sine, 1 = triangle
      0		0		reserved
      init:  0b_0010_0001_0000_1000
      square:0b_0010_0000_0011_1000
      triang:0b_0010_0000_0000_1010
      sine:  0b_0010_0000_0000_1000
      write freq0:
      write 0b_01mm_mmmm_mmmm
      CONTROL:                   0b_0010_000R_SDO0_10M0

- `const _dds_control_triangle = 0b_0000_0000_0000_0010`

      DAC ON, MSB off, Mode=triangle

- `const _dds_control_sine = 0b_0000_0000_0000_0000`

      DAC ON, MSB off, Mode=sine

- `const _dds_control_square = 0b_0000_0000_0110_0000`

      DAC off, MSB on

### Procedures

### Functions

## Related samples

Here are the list of samples which use this library:

16f628 | 16f628_dds_ad9833.jal