view DDS4xAD9912.h @ 45:b47b97cfd050

Fix output frequency read back in DDS Fox driver The FTW registry value was read back wrong due to an integer overflow in the conversion from bytes string to double. This should fix the "jumps" seen in the application of the frequency dedrifting.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Wed, 10 Oct 2012 12:14:01 +0200
parents d9aae7d7f2c6
children 54e7b129ecc2
line wrap: on
line source

//==============================================================================
//
// Title:       DDS4xAD9912.h
// Purpose:     
//
// Created on:  by Volodimer Laurent, modified by YLC
// Copyright:   syrte. All Rights Reserved.
//
//==============================================================================

#ifndef __DDS4XAD9912_H__
#define __DDS42XAD9912_H__

#ifdef __cplusplus
    extern "C" {
#endif

//==============================================================================
// Include files

#include "cvidef.h"

//==============================================================================
// Defines
		
#define Adress	"145.238.205.55"
#define Port1 	6665
#define Port2	6666		
#define Port3	6667
#define Port4	6668		
#define Clk		1000000000
#define E48		281474976710656.0		
#define E40		1099511627776.0
#define E32		4294967296.0
#define E24		16777216.0
#define E16		65536.0
#define E8		256.0

//==============================================================================
// Macros
		
#define WORD(Freq,Clk) pow(2,48)*(Freq/Clk)	
		
// DDS4xAD9912_Data : the data of crypto class DDS4xAD9912

typedef struct {
	double Frequency1 ; 
	double Frequency2 ;
	double Frequency3 ;
	double Frequency4 ;
} DDS4xAD9912_Data ;
		
//==============================================================================		
// Variables
		
char  Request[255];
char Response[255];
unsigned int hConv;	


//==============================================================================		
// Functions


static int DDS4xAD9912_SendCmd(int DDSNum,char *Buffer) ; // essentially a private function, hence the static scope... 
int DDS4xAD9912_SetFrequency(DDS4xAD9912_Data * Instance, int DDSNum, double Freq) ;		
int DDS4xAD9912_Reset(DDS4xAD9912_Data * Instance) ;
int DDS4xAD9912_FrequencyRampe ( DDS4xAD9912_Data * Instance,int DDSNum, double Frequin,double Frequout, double Step ) ;


#ifdef __cplusplus
    }
#endif

#endif  /* ndef __DDS2XAD9858_H__ */