AD9835



Le DDS AD9835 ne manque pas d'attrait.
Bien que de performances moindres que l'AD9850 et a fortiori de l'AD9852, son nombre réduit de pattes (16 au lieu de 28 ou 80) peut être déterminant pour le sélectionner.
La fréquence maximale de son horloge est de 50 MHz, ce qui permet de générer un signal convenable jusqu'à 16.6 MHz (F Clock/3).
Son application sera donc davantage orientée vers les oscillateurs de fréquence moyenne (BFO ou driver de PLL)plutÎt que les oscillateurs locaux.

Programmation:

La programmation présente quelques différences notable avec l'AD9850 :

- présence de deux registres fréquence
- ordre inverse des bits

Les modules ci-dessous sont compatibles avec les PIC Microchip possÚdant la fonction SPI (PIC16F873, 876, 877...)
;****************************************************************************************

;INIT_DDS AD9835 :
;*****************************************************************************************


INIT_DDS


;INIT DDS AD 9835


CLRF FI0
CLRF FI1
CLRF FI2
CLRF FI3
CLRF FI4
CALL BFO35
RETURN

;----------------------------------------------------------------------------------------
;*********************************************************************
;
;S/P OL35 : Chargement duDDS AD9835
;
;Le chargement utilise la routine SPI pour les données DATA et CLOCK
;La validation s'effctur par L_35BFO
;***********************************************************************

BFO35

BTFSS f_freg ; frequency register 0 updated last time?
GOTO load_reg2 ; yes, go update register 1 this time

BCF f_freg ; update register 0 this time, 1 next time
MOVLW 0x30 ; write to defer register, destination = 0
CALL RSPI
MOVF FI0,w ; low byte
CALL RSPI
BSF L_35BFO ; talk to the hardware
BCF L_35BFO

MOVLW 0x21 ; write 16 freq. bits, destination = 1
CALL RSPI
MOVF FI1,w ; low mid byte
CALL RSPI
BSF L_35BFO ; talk to the hardware
BCF L_35BFO

MOVLW 0x32 ; write to defer register, destination = 2
CALL RSPI
MOVF FI2,w ; high mid byte
CALL RSPI
BSF L_35BFO ; talk to the hardware
BCF L_35BFO

MOVLW 0x23 ; write 16 freq. bits, destination = 3
CALl RSPI
MOVF FI3,w ; high byte
CALL RSPI
BSF L_35BFO ; talk to the hardware
BCF L_35BFO

MOVLW 0x50 ; switch to frequency register 0
CALL RSPI ; (data in temp0 is unimportant)
BSF L_35BFO ; talk to the hardware
BCF L_35BFO
RETURN

load_reg2

BSF f_freg ; update register 1 this time, 0 next time
MOVLW 0x34 ; write to defer register, destination = 4
CALL RSPI
MOVF FI0,w ; low byte
CALL RSPI
BSF L_35BFO ; talk to the hardware
BCF L_35BFO

MOVLW 0x25 ; write 16 freq. bits, destination = 5
CALL RSPI
MOVF FI1,w ; low mid byte
CALL RSPI
BSF L_35BFO ; talk to the hardware
BCF L_35BFO

MOVLW 0x36 ; write to defer register, destination = 6
CALL RSPI
MOVF FI2,w ; high mid byte
CALL RSPI
BSF L_35BFO ; talk to the hardware
BCF L_35BFO

MOVLW 0x27 ; write 16 freq. bits, destination = 7
CALL RSPI
MOVF FI3,w ; high byte
CALL RSPI
BSF L_35BFO ; talk to the hardware
BCF L_35BFO

MOVLW 0x58 ; switch to frequency register 1
CALL RSPI ; (data in temp0 is unimportant)
BSF L_35BFO ; talk to the hardware
BCF L_35BFO
RETURN



;**************************************************************************************
;S/P RSPI: Sérialise le caractÚre contenu dans W en sortie de SDO
; GénÚre l'horloge associée en sortie de SCK
;*****************************************************************************************

RSPI
BCF PIR1,SSPIF
MOVWF SSPBUF

SPI_T BTFSS PIR1,SSPIF
GOTO SPI_T
RETURN

;*****************************************************************************************







 
© 2002 f6blk.net