News:

;) This forum is the property of Proton software developers

Main Menu

AD9833 DDS MODULE FREQ_REG_0 ISSUE

Started by GDeSantis, Feb 16, 2023, 01:07 AM

Previous topic - Next topic

GDeSantis

I am using a PIC16F18323 to control an AD9833 Direct Digital Synthesis (DDS) module.  Several programs written to date can generate sine, triangular or square waves that work as expected.  However, these programs exclusively use the AD9833 Frequency Register 0.

Unfortunately, all attempts to control the DDS module using Frequency Register 1 have failed.
An example program is attached that should output a sine wave at 500Hz, 1KHz and 2KHz with a one second duration at each frequency.  The 500Hz and 2KHz outputs use Frequency Register 0 and work OK.  The 1KHz output uses Frequency Register 1 and does not operate.
 
Any words of wisdom regarding this issue would be greatly appreciated.

trastikata

#1
Question here, after sending the data for DDS_SIN_1000 you issue

pRESET  = $2000               ;CLEAR RESET
Where you are actually clearing bit 11 thus by selecting register FREQ0 to be used in the phase accumulator?

GDeSantis

Many thanks Trastikata,  Your suggestion did the job and I can now program both frequency and phase registers properly.
 
This was important for my application as setting a frequency on the second register and then switching to it will produce a seamless waveform change.

Pepe

you must put

DDS_SIN_1000:                    ;1000Hz
    CNTRL  = $2900              ;SET RESET, FREQ1 ACTIVE
    F_LSB  = $A9F1              ;LOAD LSB FREQ REGISTER
    F_MSB  = $8000              ;LOAD MSB FREQ REGISTER
    pPHASE  = $C000             ;LOAD PHASE REGISTER 0
    pRESET  = $2800             ;CLEAR RESET
    GoSub DDS_OUT
    Return

Attached simulation in proteus with XTAL 2.5MHz because with 25MHz gives a triangular wave

GDeSantis

Pepe
You are correct.  Thank you.
GDeSantis