annotate DDS4xAD9959.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1 //==============================================================================
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
2 //
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
3 // Title: DDS4xAD9959.h
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
4 // Purpose:
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
5 //
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
6 // Created on: by Volodimer Laurent, modified by YLC
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
7 // Copyright: syrte. All Rights Reserved.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
8 //
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
9 //==============================================================================
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
10
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
11 #ifndef __DDS4XAD9959_H__
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
12 #define __DDS4XAD9959_H__
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
13
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
14 #ifdef __cplusplus
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
15 extern "C" {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
16 #endif
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
17
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
18 //==============================================================================
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
19 // Include files
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
20
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
21 #include "cvidef.h"
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
22
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
23 //==============================================================================
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
24 // Defines
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
25
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
26 #define Adress "192.168.0.5"
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
27 #define Port1 6665
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
28 #define Port2 6666
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
29 #define Port3 6667
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
30 #define Port4 6668
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
31 #define Clk 1000000000
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
32 #define E48 1099511627776.0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
33 #define E32 4294967296.0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
34 #define E24 16777216.0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
35 #define E16 65536.0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
36 #define E8 256.0
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
37
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
38 //==============================================================================
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
39 // Macros
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
40
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
41 #define WORD(Freq,Clk) pow(2,32)*(Freq/Clk)
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
42
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
43 // DDS2xAD9858_Data : the data of crypto class DDS2xAD9858
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
44
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
45 typedef struct {
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
46 double Frequency1 ;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
47 double Frequency2 ;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
48 double Frequency3 ;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
49 double Frequency4 ;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
50 } DDS4XAD9959_Data ;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
51
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
52 //==============================================================================
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
53 // Variables
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
54
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
55 char Request[255];
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
56 char Response[255];
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
57 unsigned int hConv;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
58
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
59 //==============================================================================
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
60 // Functions
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
61
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
62
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
63 static int DDS4XAD9959_SendCmd(int DDSNum,char *Buffer) ; // essentially a private function, hence the static scope...
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
64 int DDS4XAD9959_SetFrequency(DDS4XAD9959_Data * Instance, int DDSNum, double Freq) ;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
65 int DDS4XAD9959_Reset(DDS4XAD9959_Data * Instance) ;
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
66
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
67 #ifdef __cplusplus
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
68 }
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
69 #endif
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
70
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
71 #endif /* ndef __DDS2XAD9858_H__ */