AnsweredAssumed Answered

Issues regarding AD9835

Question asked by Future.Plans on Jan 31, 2011
Latest reply on Apr 17, 2013 by DarrenJ

I've been trying to get this DDS to output a signal of frequency of about 1/100 of it's input, however, I have not succeeded in getting any sort of output with it.  I've been using a PIC16F873A to program it.  I've tested all the pins and they all are at the correct potential and I have made sure that all the connections were good.  From that, I've narrowed it down to issues in the code:

 

;;; --------------------------------------------------------------------
;;; Main Program.
;;; --------------------------------------------------------------------
    CODE   
Main:       
    banksel TRISB
    movlw    0xF8
    andwf    TRISB,F

 

 

Loop:

 

 

 


call DDS_programming
    ;; Keep looping.

 


    goto    Loop
;;; ---------------------------------------------------------------------
;;; Vectors Section.
;;; ---------------------------------------------------------------------
;;; Establish the reset vector.

 

 

Reset:    CODE    0x0000
    clrf    PCLATH    ; Selects page 0 of program memory.
    pagesel    Main       
    goto    Main        ; Goes to the actual program.

 

    END            ; End of file.

 

 

;;; --------------------------------------------------------------------
;;; DDS_programming.
;;; --------------------------------------------------------------------
    CODE   
DDS_programming:
global    DDS_programming       
    ;; Your code starts here.

 

    call    B0_low

 

    call    B2_low
    movlw    0xF8
    call    Send_word
    movlw    0x00
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0xB0
    call    Send_word
    movlw    0x00
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0x50
    call    Send_word
    movlw    0x00
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0x40
    call    Send_word
    movlw    0x00
    call    Send_word

    call    B2_high

 

    call    B2_low
    movlw    0x18
    call    Send_word
    movlw    0x00
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0x09
    call    Send_word
    movlw    0x00
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0x30
    call    Send_word
    movlw    0x29
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0x21
    call    Send_word
    movlw    0x5c
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0x32
    call    Send_word
    movlw    0x8f
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0x23
    call    Send_word
    movlw    0x02
    call    Send_word
    call    B2_high

 

    call    B2_low
    movlw    0xc0
    call    Send_word
    movlw    0x00
    call    Send_word
    call    B2_high

 

;1/100
;0xF800 // Reset
;0x3029 0x215C 0x328F 0x2302 // Freq0
;0x3429 0x255C 0x368F 0x2702 // Freq1
;0x1800 0x900 // Phase0
;0x1A00 0xB00 // Phase1
;0x1C00 0xD00 // Phase2
;0x1E00 0xF00 // Phase3
;0x9000 // Sync/Selsrc
;0xC000 // Out of reset

 

;1/1000
;0xF800 // Reset
;0x3037 0x2189 0x3241 0x2300 // Freq0
;0x3437 0x2589 0x3641 0x2700 // Freq1
;0x1800 0x900 // Phase0
;0x1A00 0xB00 // Phase1
;0x1C00 0xD00 // Phase2
;0x1E00 0xF00 // Phase3
;0x8000 // Sync/Selsrc
;0xC000 // Out of reset

 

    ;; Keep looping.
return

 

;;; --------------------------------------------------------------------
;;; Application-specific Subroutines.
;;; --------------------------------------------------------------------

 


;;---Section to set the logic bit out--------
B0_high:
    movlw    0x01
    call    DELAY_Wx1ms
    banksel PORTB
    BSF        PORTB,0
return

 


B0_low:
    movlw    0x01
    call    DELAY_Wx1ms
    banksel PORTB
    BCF        PORTB,0
return

 


B1_high:
    movlw    0x01
    call    DELAY_Wx1ms
    banksel PORTB
    BSF        PORTB,1
return

 


B1_low:
    movlw    0x01
    call    DELAY_Wx1ms
    banksel PORTB
    BCF        PORTB,1
return

 


B2_high:
    movlw    0x01
    call    DELAY_Wx10ms
    banksel PORTB
    BSF        PORTB,2

return

 


B2_low:
    movlw    0x01
    call    DELAY_Wx10ms
    banksel PORTB
    BCF        PORTB,2
return
;;-------------------------------------------------------

 


;;--subroutine to pulse the data sync--
Data_Sent:
    call    B0_high
    call     B0_low

 

return

 


;;--Section to send every bit of a Byte in a serial output--
Send_word:
    banksel    Current_word
    movwf    Current_word
    movlw    0x08
    banksel    Bit_Count
    movwf    Bit_Count
word_loop:
    banksel    Current_word
    BTFSC    Current_word,7
    call    B1_high
    banksel    Current_word
    BTFSS    Current_word,7   
    call    B1_low

 

    call    Data_Sent
    banksel    Current_word
    RLF        Current_word
    DECFSZ    Bit_Count
    goto    word_loop
return
;-------------------------

 

End

 

The delay subrouting is just a 1ms delay, despite the name saying 10ms.  It was changed in the delay code.

 

I can't figure out what could be the issue.  If anyone could, the help would be greatly appreciated.

Outcomes