# HG changeset patch # User Daniele Nicolodi # Date 1393004550 -3600 # Node ID 12df3a2b18dee2c03af926f67c42a2ececeed3cb # Parent 791ca26fee6aae6c17a160761b616f8c4503ac08 Do not reset dedrift DDS at program initialization diff -r 791ca26fee6a -r 12df3a2b18de DDS_Fox.c --- a/DDS_Fox.c Fri Feb 21 18:42:30 2014 +0100 +++ b/DDS_Fox.c Fri Feb 21 18:42:30 2014 +0100 @@ -66,7 +66,7 @@ va_end(args); } -void DDSFox_Initialize(DDSParameter *Param, char *ip, int port, double frequency) +void DDSFox_Init(DDSParameter *Param, char *ip, int port) { strcpy(Param->ip, ip); Param->Port = 6665; @@ -74,10 +74,14 @@ Param->Clock = 200000000; Param->Delta_T = 0.01; Param->SweepRate = 0.0; - +} + +void DDSFox_Reset(DDSParameter *Param, double frequency) +{ + // set sweep rate to 0 + Param->SweepRate = 0.0; // reset the DDS - //DDSFox_Nop(Param); - DDSFox_Reset(Param); + DDSFox_DeviceReset(Param); // set profile number 7 soft frequecy sweep DDSFox_SetProfile(Param); // set clock divider to 1 @@ -141,14 +145,11 @@ SendCmd(request, Param); } -void DDSFox_Reset(DDSParameter *Param) +void DDSFox_DeviceReset(DDSParameter *Param) { - char Request[255]; - //sprintf(Request,"set;%i;%i",1,CMD_NOP); - //SendCmd(Request, Param) ; - sprintf(Request,"set;%i;%i",1,CMD_RESET_DDS); - SendCmd(Request, Param) ; - return ; + char request[255]; + sprintf(request, "set;%i;%i", 1, CMD_RESET_DDS); + SendCmd(request, Param); } void DDSFox_StopSweep(DDSParameter *Param) diff -r 791ca26fee6a -r 12df3a2b18de DDS_Fox.h --- a/DDS_Fox.h Fri Feb 21 18:42:30 2014 +0100 +++ b/DDS_Fox.h Fri Feb 21 18:42:30 2014 +0100 @@ -1,21 +1,20 @@ typedef struct { - char Name[255]; char ip[255]; int Port; - //int Divider; double Clock; double SweepRate; double Delta_T; unsigned int Profil; } DDSParameter; -void DDSFox_Initialize(DDSParameter *Param, char *ip, int port, double frequency); +void DDSFox_Init(DDSParameter *Param, char *ip, int port); +void DDSFox_Reset(DDSParameter * Param, double frequency); void DDSFox_SetSweepRate(DDSParameter *Param, double sweepRate); void DDSFox_Set(DDSParameter *Param, double frequency, double sweepRate); void DDSFox_Nop(DDSParameter *Param); void DDSFox_SetProfile(DDSParameter *Param); void DDSFox_SetDiv(DDSParameter *Param, int div); -void DDSFox_Reset(DDSParameter * Param); +void DDSFox_DeviceReset(DDSParameter * Param); void DDSFox_SetFreq (DDSParameter * Param) ; void DDSFox_SetFreqInf (DDSParameter *Param, double frequency) ; void DDSFox_SetFreqSup (DDSParameter *Param, double frequency) ; diff -r 791ca26fee6a -r 12df3a2b18de FXAnalyse.c --- a/FXAnalyse.c Fri Feb 21 18:42:30 2014 +0100 +++ b/FXAnalyse.c Fri Feb 21 18:42:30 2014 +0100 @@ -433,7 +433,7 @@ return -1; // dedrift DDS - DDSFox_Initialize(&DDS1xAD9956, host, port, dedrift.freq0); + DDSFox_Init(&DDS1xAD9956, host, port); // AD9912 configuration parameters rv = Ini_GetStringIntoBuffer(configuration, "AD9912", "host", host, sizeof(host)); @@ -1952,10 +1952,7 @@ dedrift.applied = 0.0; SetCtrlVal(panel, PANEL_SLOPE_APPLIED, dedrift.applied); // reset DDS - DDSFox_Reset(&DDS1xAD9956); - DDSFox_SetProfile(&DDS1xAD9956); - DDSFox_SetDiv(&DDS1xAD9956, 1); - DDSFox_Set(&DDS1xAD9956, dedrift.freq0, 0.0); + DDSFox_Reset(&DDS1xAD9956, dedrift.freq0); break; } return 0;