AD9834 Control Amplitude

Hello i have AD9834 Board Generator I found the code that control the frequency.

Can someone modify thecode that are capable to set and the amplitude. I try to do but no result.

#include "Wire.h"       
#define MAX5381 0x64     
#include "TimerOne.h"
int TimerUpdateRate = 1000;
 
const int SOURCE = 0;
const int FSYNC = 10;        
const int SDATA = 11;       
const int SCLK = 13;   
 
const float CRYSTAL = 75000000.0 ;
const int SINE = 0x2000;                    
const int SQUARE = 0x2020;                   
const int TRIANGLE = 0x2002; 
unsigned long FREQ = 1000;   
 
char Command ;                 
byte byteRead ;
 
void UpdateDDS(unsigned int data){
  unsigned int pointer = 0x8000;
  digitalWrite(FSYNC, LOW);     // AND NOW : WAIT 5 ns
  for (int i=0; i<16; i++){
   if ((data & pointer) > 0) { digitalWrite(SDATA, HIGH); }
      else { digitalWrite(SDATA, LOW); }
    digitalWrite(SCLK, LOW);
    digitalWrite(SCLK, HIGH);
    pointer = pointer >> 1 ;
  }
  digitalWrite(FSYNC, HIGH);
}
 
void UpdateFreq(long FREQ, int WAVE){   
  long FTW = (FREQ * pow(2, 28)) / CRYSTAL;
  if (WAVE == SQUARE) FTW = FTW << 1;
  unsigned int MSB = (int)((FTW & 0xFFFC000) >> 14);    
  unsigned int LSB = (int)(FTW & 0x3FFF);
  LSB |= 0x4000;
  MSB |= 0x4000; 
  UpdateDDS(0x2100);   
  UpdateDDS(LSB);                   
  UpdateDDS(MSB);                   
  UpdateDDS(0xC000);                
  UpdateDDS(WAVE);
}
 
void ReadUserInput()
{
  boolean ende = false ;
  FREQ = 0;
  while ( ( Serial.available() ) || ( ende == false ) ) 
      {
      byteRead = Serial.read();
      if ( byteRead == 10 ){ ende = true ; }
      if (( byteRead > 64 ) & (byteRead < 91)) { 
        Command = byteRead ; }                      // A..Z
      if (( byteRead > 47 ) & (byteRead < 58)) { 
        FREQ = FREQ * 10;
        FREQ = FREQ + byteRead - 48 ; }             // 0..9
      }
}

void setup() {
  pinMode(SOURCE, OUTPUT);
  pinMode(FSYNC, OUTPUT);
  pinMode(SDATA, OUTPUT);
  pinMode(SCLK, OUTPUT);
  digitalWrite(SOURCE, LOW);
  digitalWrite(FSYNC, HIGH);
  digitalWrite(SDATA, LOW);
  digitalWrite(SCLK, HIGH);
  Wire.begin();
  Serial.begin(9600);
  delay(2000);
  Serial.println("AD9834 Micro Waveform Generator");
  Serial.println("-------------------------------------------------------");
  Serial.println("COMMAND  : [WAVEFORM]+[FREQUENCY IN HERTZ]");
  Serial.println("WAVEFORM : S-SINE, T-TRIANGLE, R-RECTANGLE, A-ARBITRARY");
  Serial.println("E.G:: S1000 OUTPUTS A SINE AT 1000 Hz");
  Serial.println("Max. Const. Value :: S12500000");
  Serial.println("Interval:: 100 Hz-18000000 Hz");
  Serial.println("-------------------------------------------------------");
  UpdateDDS(0x2100);                                    
  UpdateDDS(0x50C7);                                    
  UpdateDDS(0x4000);                                    
  UpdateDDS(0xC000);                                    
  UpdateDDS(0x2000); 
  digitalWrite(SOURCE, LOW);                           
  delay(999);
}
 
void loop() {
    ReadUserInput();
    switch (Command)
    {
      case 82 :
        Serial.print("\nRECTANGLE, FREQ = ");
        Serial.print(FREQ,DEC);Serial.println(" Hz");
        UpdateFreq(FREQ, SQUARE);
        digitalWrite(SOURCE, LOW);
        Serial.println("O.K.");
        break;
      case 83 :
        Serial.print("\nSINE, FREQ = ");
        Serial.print(FREQ,DEC);Serial.println(" Hz");
        UpdateFreq(FREQ, SINE);
        digitalWrite(SOURCE, LOW);
        Serial.println("O.K.");
        break;
      case 84 :
        Serial.print("\nTRIANGLE, FREQ = ");
        Serial.print(FREQ,DEC);Serial.println(" Hz");
        UpdateFreq(FREQ, TRIANGLE);
        digitalWrite(SOURCE, LOW);
        Serial.println("O.K.");
        break;
      default:
        Serial.println("\nUnknown Command.");
        Serial.println("Try again :-)");
        delay(100);
        break;
    } 
}

The AD9834 does not have built-in ability to change the output amplitude. You will need a digital potentiometer or a DAC.

The AD9834 provides a pin for amplitude control but the PWM output of an Arduino is not appropriate.

Perhaps there is a DAC or a digital potentiometer on your board for this purpose but you have not told us what board you have.