comparison FXAnalyse.c @ 164:211ea3950310

Read AD9956 configuration from configuration file
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 10 Feb 2014 15:19:34 +0100
parents 1517a56163de
children fdd2f8fd7714
comparison
equal deleted inserted replaced
163:4ff3e468ab5f 164:211ea3950310
15 #include "muParserDLL.h" 15 #include "muParserDLL.h"
16 #include "utils.h" 16 #include "utils.h"
17 #include "stat.h" 17 #include "stat.h"
18 #include "data-provider.h" 18 #include "data-provider.h"
19 19
20 #define CONFIGFILE "FXAnalyse.ini"
20 #define SR_LOGGER_IP "145.238.204.91" 21 #define SR_LOGGER_IP "145.238.204.91"
21 #define DATAFOLDER "Z:\\Measures-2014" 22 #define DATAFOLDER "Z:\\Measures-2014"
22 23
23 #define FREP_STEP_SIZE 50000.0 24 #define FREP_STEP_SIZE 50000.0
24 25
420 421
421 return parser; 422 return parser;
422 } 423 }
423 424
424 425
426
427
425 void CVICALLBACK DataAvailableCB (CmtTSQHandle queueHandle, unsigned int event, 428 void CVICALLBACK DataAvailableCB (CmtTSQHandle queueHandle, unsigned int event,
426 int value, void *callbackData); 429 int value, void *callbackData);
427 430
428 431
429 int main (int argc, char *argv[]) 432 int main (int argc, char *argv[])
430 { 433 {
434 int rv;
431 double frequency; 435 double frequency;
432 char expr[1024]; 436 char expr[1024];
433 437
434 if (InitCVIRTE (0, argv, 0) == 0) 438 if (InitCVIRTE (0, argv, 0) == 0)
435 return -1; 439 return -1;
440 return -1; 444 return -1;
441 if ((EstimateNPanel = LoadPanel (MainPanel, "FXAnalyse.uir", ESTIMATEN)) < 0) 445 if ((EstimateNPanel = LoadPanel (MainPanel, "FXAnalyse.uir", ESTIMATEN)) < 0)
442 return -1; 446 return -1;
443 if ((LoggingPanel = LoadPanel (0, "FXAnalyse.uir", LOGGING)) < 0) 447 if ((LoggingPanel = LoadPanel (0, "FXAnalyse.uir", LOGGING)) < 0)
444 return -1; 448 return -1;
449
450 // construct configuration file path
451 char pathname[MAX_PATHNAME_LEN];
452 char project[MAX_PATHNAME_LEN];
453 GetProjectDir(project);
454 MakePathname(project, CONFIGFILE, pathname);
455
456 // load configuration file */
457 IniText configuration = Ini_New(TRUE);
458 Ini_ReadFromFile(configuration, pathname);
459
460 // get AD9956 configuration parameters
461 char host[256];
462 int port;
463 double clock;
464 rv = Ini_StringIntoBuffer(configuration, "AD9956", "host", host, sizeof(host));
465 if (! rv)
466 return -1;
467 rv = Ini_GetInt(configuration, "AD9956", "port", &port);
468 if (! rv)
469 return -1;
470 rv = Ini_GetDouble(configuration, "AD9956", "clock", &clock);
471 if (! rv)
472 return -1;
473
474 // initialyze 1x AD9956 DDS box
475 DDSFox_Initialize(&DDS1xAD9956, host, port, dedrift.freq0);
476
477 // free
478 Ini_Dispose(configuration);
445 479
446 // initialize 4x AD9959 DDS box 480 // initialize 4x AD9959 DDS box
447 DDS4xAD9912_Reset(&DDS4xAD9912); 481 DDS4xAD9912_Reset(&DDS4xAD9912);
448 GetCtrlVal(MainPanel, PANEL_DDS1, &frequency); 482 GetCtrlVal(MainPanel, PANEL_DDS1, &frequency);
449 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency); 483 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 1, frequency);
451 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency); 485 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 2, frequency);
452 GetCtrlVal(MainPanel, PANEL_DDS3, &frequency); 486 GetCtrlVal(MainPanel, PANEL_DDS3, &frequency);
453 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency); 487 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 3, frequency);
454 GetCtrlVal(MainPanel, PANEL_DDS4, &frequency); 488 GetCtrlVal(MainPanel, PANEL_DDS4, &frequency);
455 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); 489 DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency);
456
457 // initialyze 1x AD9956 DDS box
458 DDSFox_Initialize(&DDS1xAD9956, "145.238.205.58", 6665, dedrift.freq0);
459 490
460 GetCtrlVal(MainPanel, PANEL_N1CHOICE, &N1); 491 GetCtrlVal(MainPanel, PANEL_N1CHOICE, &N1);
461 GetCtrlVal(MainPanel, PANEL_N2CHOICE, &N2); 492 GetCtrlVal(MainPanel, PANEL_N2CHOICE, &N2);
462 GetCtrlVal(MainPanel, PANEL_N3CHOICE, &N3); 493 GetCtrlVal(MainPanel, PANEL_N3CHOICE, &N3);
463 494