Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 221 → Rev 222

/cvi/RedPitaya/RedPitaya.c
43,7 → 43,7
static int ph_tdc, ph_wf;
static int dtdc[MAXTDCCH];
static int debugOut = 0;
 
static time_t t0;
static ViStatus istat;
static ViSession RedPHandle,RMHandle;
 
50,8 → 50,7
//==============================================================================
// Static functions
 
static int update_plots (void)
{
static int update_plots (void) {
if (ph_tdc>0) DeleteGraphPlot (p1h, P1_TDC_G, ph_tdc, VAL_DELAYED_DRAW);
ph_tdc = PlotY (p1h, P1_TDC_G, &dtdc[0], MAXTDCCH, VAL_INTEGER,
VAL_VERTICAL_BAR, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
58,40 → 57,89
return (0);
}
 
static int CVICALLBACK daq_run(void *functionData)
{
int i,trgdly,neve,ieve,ndata;
 
 
static int export_data (void) {
char filename[0xFF],rootcmd[0xFF];
int type=0;
int neve;
GetCtrlVal(p1h,P1_FILENAME_EN,filename);
GetCtrlVal(p1h,P1_FILETYPE,&type);
unsigned int hdr[10];
time_t t;
hdr[0] = 0x1;
hdr[1] = sizeof(int) * MAXTDCCH;
hdr[2] = t0;
GetCtrlVal (p1h, P1_CEVE_N, &neve);
hdr[3] = neve;
hdr[4] = (unsigned int)( time(&t)-t0);
FILE *fp;
switch (type) {
case 0:
case 1:
fp =fopen(filename,"wb");
if (fp) {
fwrite(hdr,sizeof(unsigned int),5,fp);
fwrite(dtdc,sizeof(int),MAXTDCCH,fp);
fclose(fp);
if (type) {
sprintf(rootcmd ,"root.exe plottdc.cxx(\\\"%s\\\")", filename);
LaunchExecutable(rootcmd);
 
}
}
break;
case 2:
fp=fopen(filename,"w");
if (fp) {
for (int i=0; i<MAXTDCCH; i++) fprintf(fp,"%d\n", dtdc[i]);
fclose(fp);
}
break;
 
}
 
 
return (0);
}
static int CVICALLBACK daq_run(void *functionData) {
int trgdly,neve,ieve,ndata;
float data[10000];
char datac[100000];
char *ctoken_p;
char response[80];
 
istat = viPrintf (RedPHandle, "ACQ:RST\r\n");
istat = viPrintf (RedPHandle, "ACQ:AVG OFF\r\n");
istat = viPrintf (RedPHandle, "ACQ:DEC 1\r\n");
istat = viPrintf (RedPHandle, "ACQ:TRIG:LEV -0.03\r\n");
trgdly = MINTRGDELAY + NSAMPLES - NBEFORE + 1;
istat = viPrintf (RedPHandle, "ACQ:TRIG:DLY %0d\r\n", trgdly);
istat = viPrintf (RedPHandle, "ACQ:START\r\n");
Delay(0.01);
istat = viPrintf (RedPHandle, "ACQ:TRIG CH1_NE\r\n");
time_t t;
response[0] = 0;
t0 = time(&t);
if (RedPHandle) {
istat = viPrintf (RedPHandle, "ACQ:RST\r\n");
istat = viPrintf (RedPHandle, "ACQ:AVG OFF\r\n");
istat = viPrintf (RedPHandle, "ACQ:DEC 1\r\n");
istat = viPrintf (RedPHandle, "ACQ:TRIG:LEV -0.03\r\n");
trgdly = MINTRGDELAY + NSAMPLES - NBEFORE + 1;
istat = viPrintf (RedPHandle, "ACQ:TRIG:DLY %0d\r\n", trgdly);
istat = viPrintf (RedPHandle, "ACQ:START\r\n");
Delay(0.01);
istat = viPrintf (RedPHandle, "ACQ:TRIG CH1_NE\r\n");
// istat = viPrintf (RedPHandle, "ACQ:TRIG NOW\r\n");
 
GetCtrlVal (p1h, P1_NEVE_N, &neve);
}
GetCtrlVal (p1h, P1_NEVE_N, &neve);
ieve=0;
do {
while (VI_TRUE) {
istat = viQueryf (RedPHandle, "ACQ:TRIG:STAT?\r\n", "%s",response);
if (RedPHandle) istat = viQueryf (RedPHandle, "ACQ:TRIG:STAT?\r\n", "%s",response);
if (response[0]=='T') break;
if (!daq_on) break;
}
if (!daq_on) break;
istat = viQueryf (RedPHandle, "ACQ:SOUR1:DATA:LAT:N? %0d\r\n", "%s", NSAMPLES, datac);
istat = viPrintf (RedPHandle, "ACQ:START\r\n");
Delay(0.001);
istat = viPrintf (RedPHandle, "ACQ:TRIG CH1_NE\r\n");
if (RedPHandle) {
istat = viQueryf (RedPHandle, "ACQ:SOUR1:DATA:LAT:N? %0d\r\n", "%s", NSAMPLES, datac);
istat = viPrintf (RedPHandle, "ACQ:START\r\n");
Delay(0.001);
istat = viPrintf (RedPHandle, "ACQ:TRIG CH1_NE\r\n");
// istat = viPrintf (RedPHandle, "ACQ:TRIG NOW\r\n");
// Delay(0.01);
}
ndata=0;
ctoken_p = strtok (datac, "{,}\r");
while (ctoken_p) {
101,7 → 149,7
ndata++;
}
ph_wf = PlotY (p1h, P1_WF_G, data, ndata, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, VAL_BLUE);
SetCtrlVal (p1h, P1_CEVE_N, ++ieve);
SetCtrlVal (p1h, P1_CEVE_N, ++ieve);
if (debugOut) {
sprintf(response,"%d, %d",ieve,ndata);
istat = InsertTextBoxLine (p1h, P1_IO_TB, -1, response);
108,12 → 156,12
debugOut=0;
}
} while (ieve<neve);
daq_on=0;
SetCtrlVal (p1h, P1_DAQ_S, daq_on);
SetCtrlVal (p1h, P1_CEVE_N, ieve);
return 0;
daq_on=0;
SetCtrlVal (p1h, P1_DAQ_S, daq_on);
SetCtrlVal (p1h, P1_CEVE_N, ieve);
return 0;
}
 
//==============================================================================
// Global variables
 
125,8 → 173,7
/// HIRET What does your function return?
 
int CVICALLBACK cb_timer (int panel, int control, int event, void *callbackData,
int eventData1, int eventData2)
{
int eventData1, int eventData2) {
QueueUserEvent (9000, p1h, P1_TIMER_T);
return (0);
}
145,7 → 192,7
LPSTR lpszCmdLine, int nCmdShow) {
int i,refon,dummy;
char response[80];
 
if (InitCVIRTE (hInstance, 0, 0) == 0)
return -1; /* out of memory */
 
157,18 → 204,20
SetStdioWindowPosition (825, 20);
 
istat = viOpenDefaultRM (&RMHandle);
istat = viOpen (RMHandle, "TCPIP0::178.172.43.73::5000::SOCKET", VI_NULL, VI_NULL, &RedPHandle);
if (RMHandle) istat = viOpen (RMHandle, "TCPIP0::178.172.43.73::5000::SOCKET", VI_NULL, VI_NULL, &RedPHandle);
if (RedPHandle){
istat = viSetAttribute (RedPHandle, VI_ATTR_TCPIP_KEEPALIVE, VI_TRUE);
istat = viSetAttribute (RedPHandle, VI_ATTR_TCPIP_NODELAY, VI_TRUE);
istat = viSetAttribute (RedPHandle, VI_ATTR_TERMCHAR, '\n');
istat = viSetAttribute (RedPHandle, VI_ATTR_TERMCHAR_EN, VI_TRUE);
istat = viSetAttribute (RedPHandle, VI_ATTR_TMO_VALUE, 1000);
 
}
if ((p1h = LoadPanel (0, "RedPitaya_ui.uir", P1)) < 0) return -1;
DisplayPanel (p1h);
istat = SetCtrlAttribute (p1h, P1_WF_G, ATTR_DATA_MODE, VAL_DISCARD);
 
istat = viQueryf (RedPHandle, "*IDN?\r\n", "%s",response);
if (RedPHandle) istat = viQueryf (RedPHandle, "*IDN?\r\n", "%s",response);
else sprintf(response,"Connection to RedPitaya is missing");
istat = InsertTextBoxLine (p1h, P1_IO_TB, -1,response);
istat = ProcessDrawEvents ();
 
189,8 → 238,7
GetCtrlVal (p1h, P1_DAQ_S, &daq_on);
if (daq_on) {
CmtScheduleThreadPoolFunction (poolHandle, daq_run, (void *)&dummy, &tfID);
}
else {
} else {
CmtWaitForThreadPoolFunctionCompletion (poolHandle, tfID,
OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
CmtReleaseThreadPoolFunctionID (poolHandle, tfID);
204,6 → 252,10
case P1_CLEAR_PB:
DeleteGraphPlot (p1h, P1_WF_G, -1, VAL_IMMEDIATE_DRAW);
break;
 
case P1_EXPORT_PB:
export_data();
break;
case P1_TDCLOG_S:
GetCtrlVal (p1h, P1_TDCLOG_S, &istat);
SetCtrlAttribute (p1h, P1_TDC_G, ATTR_YMAP_MODE, istat);
212,14 → 264,13
default:
Delay(1.);
}
}
while ((rID != P1_EXIT_PB)||daq_on);
} while ((rID != P1_EXIT_PB)||daq_on);
 
CmtDiscardThreadPool (poolHandle);
DiscardPanel (p1h);
 
istat = viClose (RedPHandle);
istat = viClose (RMHandle);
if (RedPHandle) istat = viClose (RedPHandle);
if (RMHandle) istat = viClose (RMHandle);
 
return 0;
}
/cvi/RedPitaya/RedPitaya.prj
0,0 → 1,444
[Project Header]
Version = 1302
Pathname = "/c/home/CVI/RedPitaya/RedPitaya.prj"
CVI Dir = "/c/program files (x86)/national instruments/cvi2013"
CVI Shared Dir = "/C/Program Files (x86)/National Instruments/Shared/CVI"
CVI Pub Local Dir = "/C/ProgramData/National Instruments/CVI2013"
CVI Pub Global Dir = "/C/ProgramData/National Instruments/CVI"
IVI Standard Root Dir = "/C/Program Files (x86)/IVI Foundation/IVI"
VXIplug&play Framework Dir = "/C/Program Files (x86)/IVI Foundation/VISA/winnt"
IVI Standard Root 64-bit Dir = "/C/Program Files/IVI Foundation/IVI"
VXIplug&play Framework 64-bit Dir = "/C/Program Files/IVI Foundation/VISA/win64"
Number of Files = 4
Target Type = "Executable"
Flags = 2064
Copied From Locked InstrDrv Directory = False
Copied from VXIPNP Directory = False
Locked InstrDrv Name = ""
Don't Display Deploy InstrDrv Dialog = False
 
[Folders]
Instrument Files Folder Not Added Yet = True
Library Files Folder Not Added Yet = True
Folder 0 = "User Interface Files"
FolderEx 0 = "User Interface Files"
Folder 1 = "Include Files"
FolderEx 1 = "Include Files"
Folder 2 = "Source Files"
FolderEx 2 = "Source Files"
 
[File 0001]
File Type = "User Interface Resource"
Res Id = 1
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "RedPitaya_ui.uir"
Path = "/c/home/CVI/RedPitaya/RedPitaya_ui.uir"
Exclude = False
Project Flags = 0
Folder = "User Interface Files"
Folder Id = 0
 
[File 0002]
File Type = "Include"
Res Id = 2
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "RedPitaya_ui.h"
Path = "/c/home/CVI/RedPitaya/RedPitaya_ui.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
Folder Id = 1
 
[File 0003]
File Type = "Unknown"
Res Id = 3
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "plottdc.cxx"
Path = "/c/home/CVI/RedPitaya/plottdc.cxx"
Exclude = False
Project Flags = 0
Folder = "Source Files"
Folder Id = 2
 
[File 0004]
File Type = "CSource"
Res Id = 4
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "RedPitaya.c"
Path = "/c/home/CVI/RedPitaya/RedPitaya.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"
Folder Id = 2
 
[Custom Build Configs]
Num Custom Build Configs = 0
 
[Default Build Config Debug]
Config Name = "Debug"
Is 64-Bit = False
Is Release = False
Default Calling Convention = "cdecl"
Optimization Level = "Optimize for speed (level 2)"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "Common"
Warning List None = ""
Warning List Common = ""
Warning List Extended = ""
Warning List All = ""
Warning Mode = 0
Enable Unreferenced Identifiers Warning = True
Enable Pointer Mismatch Warning = True
Enable Unreachable Code Warning = True
Enable Assignment In Conditional Warning = True
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = True
Enable OpenMP Extensions = False
Stack Size = 250000
Stack Reserve = 1048576
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
Sign = False
Sign Store = ""
Sign Certificate = ""
Sign Timestamp URL = ""
Sign URL = ""
Manifest Embed = False
Icon File Is Rel = False
Icon File = ""
Application Title = ""
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Runtime Support = "Full Runtime Support"
Runtime Binding = "Shared"
Embed Project .UIRs = False
Generate Map File = False
Embed Timestamp = True
Create Console Application = False
Using LoadExternalModule = False
DLL Exports = "Include File Symbols"
Register ActiveX Server = False
Numeric File Version = "1,0,0,0"
Numeric Prod Version = "1,0,0,0"
Comments = ""
Comments Ex = ""
Company Name = ""
Company Name Ex = "%company"
File Description = "RedPitaya (Debug x86)"
File Description Ex = "%application (%rel_dbg %arch)"
File Version = "1.0"
File Version Ex = "%f1.%f2"
Internal Name = "RedPitaya"
Internal Name Ex = "%basename"
Legal Copyright = "Copyright © 2017"
Legal Copyright Ex = "Copyright © %company %Y"
Legal Trademarks = ""
Legal Trademarks Ex = ""
Original Filename = "RedPitaya.exe"
Original Filename Ex = "%filename"
Private Build = ""
Private Build Ex = ""
Product Name = " RedPitaya"
Product Name Ex = "%company %application"
Product Version = "1.0"
Product Version Ex = "%p1.%p2"
Special Build = ""
Special Build Ex = ""
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
 
[Default Build Config Release]
Config Name = "Release"
Is 64-Bit = False
Is Release = True
Default Calling Convention = "cdecl"
Optimization Level = "Optimize for speed (level 2)"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "Common"
Warning List None = ""
Warning List Common = ""
Warning List Extended = ""
Warning List All = ""
Warning Mode = 0
Enable Unreferenced Identifiers Warning = True
Enable Pointer Mismatch Warning = True
Enable Unreachable Code Warning = True
Enable Assignment In Conditional Warning = True
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = True
Enable OpenMP Extensions = False
Stack Size = 250000
Stack Reserve = 1048576
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
Sign = False
Sign Store = ""
Sign Certificate = ""
Sign Timestamp URL = ""
Sign URL = ""
Manifest Embed = False
Icon File Is Rel = False
Icon File = ""
Application Title = ""
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Runtime Support = "Full Runtime Support"
Runtime Binding = "Shared"
Embed Project .UIRs = False
Generate Map File = False
Embed Timestamp = True
Create Console Application = False
Using LoadExternalModule = False
DLL Exports = "Include File Symbols"
Register ActiveX Server = False
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
 
[Default Build Config Debug64]
Config Name = "Debug64"
Is 64-Bit = True
Is Release = False
Default Calling Convention = "cdecl"
Optimization Level = "Optimize for speed (level 2)"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "Common"
Warning List None = ""
Warning List Common = ""
Warning List Extended = ""
Warning List All = ""
Warning Mode = 0
Enable Unreferenced Identifiers Warning = True
Enable Pointer Mismatch Warning = True
Enable Unreachable Code Warning = True
Enable Assignment In Conditional Warning = True
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = True
Enable OpenMP Extensions = False
Stack Size = 250000
Stack Reserve = 1048576
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
Sign = False
Sign Store = ""
Sign Certificate = ""
Sign Timestamp URL = ""
Sign URL = ""
Manifest Embed = False
Icon File Is Rel = False
Icon File = ""
Application Title = ""
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Runtime Support = "Full Runtime Support"
Runtime Binding = "Shared"
Embed Project .UIRs = False
Generate Map File = False
Embed Timestamp = True
Create Console Application = False
Using LoadExternalModule = False
DLL Exports = "Include File Symbols"
Register ActiveX Server = False
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
 
[Default Build Config Release64]
Config Name = "Release64"
Is 64-Bit = True
Is Release = True
Default Calling Convention = "cdecl"
Optimization Level = "Optimize for speed (level 2)"
Require Prototypes = True
Show Warning IDs in Build Output = False
Selected Warning Level = "Common"
Warning List None = ""
Warning List Common = ""
Warning List Extended = ""
Warning List All = ""
Warning Mode = 0
Enable Unreferenced Identifiers Warning = True
Enable Pointer Mismatch Warning = True
Enable Unreachable Code Warning = True
Enable Assignment In Conditional Warning = True
Uninitialized Locals Compile Warning = "Aggressive"
Require Return Values = True
Enable C99 Extensions = True
Enable OpenMP Extensions = False
Stack Size = 250000
Stack Reserve = 1048576
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
Sign = False
Sign Store = ""
Sign Certificate = ""
Sign Timestamp URL = ""
Sign URL = ""
Manifest Embed = False
Icon File Is Rel = False
Icon File = ""
Application Title = ""
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Runtime Support = "Full Runtime Support"
Runtime Binding = "Shared"
Embed Project .UIRs = False
Generate Map File = False
Embed Timestamp = True
Create Console Application = False
Using LoadExternalModule = False
DLL Exports = "Include File Symbols"
Register ActiveX Server = False
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
 
[Compiler Options]
Default Calling Convention = "cdecl"
Require Prototypes = True
Require Return Values = False
Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Enable Unreferenced Identifiers Warning = False
Enable Assignment In Conditional Warning = False
O Option Compatible With 5.0 = False
Enable C99 Extensions = True
Uninitialized Locals Compile Warning = "Disabled"
Precompile Prefix Header = False
Prefix Header File = ""
 
[Run Options]
Stack Size = 250000
Stack Commit = 4096
Image Base Address = 4194304
Image Base Address x64 = 4194304
 
[Compiler Defines]
Compiler Defines = "/DWIN32_LEAN_AND_MEAN"
 
[Create Executable]
Executable File_Debug Is Rel = True
Executable File_Debug Rel To = "Project"
Executable File_Debug Rel Path = "RedPitaya.exe"
Executable File_Debug = "/c/home/CVI/RedPitaya/RedPitaya.exe"
Executable File_Release Is Rel = True
Executable File_Release Rel To = "Project"
Executable File_Release Rel Path = "RedPitaya.exe"
Executable File_Release = "/c/home/CVI/RedPitaya/RedPitaya.exe"
Executable File_Debug64 Is Rel = True
Executable File_Debug64 Rel To = "Project"
Executable File_Debug64 Rel Path = "RedPitaya.exe"
Executable File_Debug64 = "/c/home/CVI/RedPitaya/RedPitaya.exe"
Executable File_Release64 Is Rel = True
Executable File_Release64 Rel To = "Project"
Executable File_Release64 Rel Path = "RedPitaya.exe"
Executable File_Release64 = "/c/home/CVI/RedPitaya/RedPitaya.exe"
Icon File Is Rel = False
Icon File = ""
Application Title = ""
DLL Exports = "Include File Symbols"
Use IVI Subdirectories for Import Libraries = False
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Custom Directory to Copy DLL Is Rel = False
Custom Directory to Copy DLL = ""
Generate Source Documentation = "None"
Add Type Lib To DLL = False
Include Type Lib Help Links = False
TLB Help Style = "HLP"
Type Lib FP File Is Rel = False
Type Lib FP File = ""
Type Lib Guid = ""
Runtime Support = "Full Runtime Support"
Instrument Driver Support Only = False
Embed Project .UIRs = False
Generate Map File = False
 
[External Compiler Support]
UIR Callbacks File Option = 0
Using LoadExternalModule = False
Create Project Symbols File = True
UIR Callbacks Obj File Is Rel = False
UIR Callbacks Obj File = ""
Project Symbols H File Is Rel = False
Project Symbols H File = ""
Project Symbols Obj File Is Rel = False
Project Symbols Obj File = ""
 
[ActiveX Server Options]
Specification File Is Rel = False
Specification File = ""
Source File Is Rel = False
Source File = ""
Include File Is Rel = False
Include File = ""
IDL File Is Rel = False
IDL File = ""
Register ActiveX Server = False
 
[Signing Info]
Sign = False
Sign Debug Build = False
Store = ""
Certificate = ""
Timestamp URL = ""
URL = ""
 
[Manifest Info]
Embed = False
 
[tpcSection]
tpcEnabled = 0
tpcOverrideEnvironment = 0
tpcEnabled x64 = 0
tpcOverrideEnvironment x64 = 0
 
/cvi/RedPitaya/RedPitaya_ui.h
1,51 → 1,54
/**************************************************************************/
/* LabWindows/CVI User Interface Resource (UIR) Include File */
/* */
/* WARNING: Do not add to, delete from, or otherwise modify the contents */
/* of this include file. */
/**************************************************************************/
 
#include <userint.h>
 
#ifdef __cplusplus
extern "C" {
#endif
 
/* Panels and Controls: */
 
#define P1 1
#define P1_EXIT_PB 2 /* control type: command, callback function: (none) */
#define P1_IO_TB 3 /* control type: textBox, callback function: (none) */
#define P1_WF_G 4 /* control type: graph, callback function: (none) */
#define P1_CLEAR_PB 5 /* control type: command, callback function: (none) */
#define P1_RESET_PB 6 /* control type: command, callback function: (none) */
#define P1_CEVE_N 7 /* control type: numeric, callback function: (none) */
#define P1_TDC_G 8 /* control type: graph, callback function: (none) */
#define P1_NEVE_N 9 /* control type: numeric, callback function: (none) */
#define P1_TDCLOG_S 10 /* control type: binary, callback function: (none) */
#define P1_DAQ_S 11 /* control type: textButton, callback function: (none) */
#define P1_TIMER_T 12 /* control type: timer, callback function: cb_timer */
#define P1_REFON_CB 13 /* control type: radioButton, callback function: (none) */
#define P1_REFRESH_PB 14 /* control type: command, callback function: (none) */
#define P1_DEBUG_PB 15 /* control type: command, callback function: debug_pressed */
 
 
/* Control Arrays: */
 
/* (no control arrays in the resource file) */
 
 
/* Menu Bars, Menus, and Menu Items: */
 
/* (no menu bars in the resource file) */
 
 
/* Callback Prototypes: */
 
int CVICALLBACK cb_timer(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK debug_pressed(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
 
 
#ifdef __cplusplus
}
#endif
/**************************************************************************/
/* LabWindows/CVI User Interface Resource (UIR) Include File */
/* */
/* WARNING: Do not add to, delete from, or otherwise modify the contents */
/* of this include file. */
/**************************************************************************/
 
#include <userint.h>
 
#ifdef __cplusplus
extern "C" {
#endif
 
/* Panels and Controls: */
 
#define P1 1
#define P1_EXPORT_PB 2 /* control type: command, callback function: (none) */
#define P1_EXIT_PB 3 /* control type: command, callback function: (none) */
#define P1_IO_TB 4 /* control type: textBox, callback function: (none) */
#define P1_WF_G 5 /* control type: graph, callback function: (none) */
#define P1_CLEAR_PB 6 /* control type: command, callback function: (none) */
#define P1_RESET_PB 7 /* control type: command, callback function: (none) */
#define P1_CEVE_N 8 /* control type: numeric, callback function: (none) */
#define P1_TDC_G 9 /* control type: graph, callback function: (none) */
#define P1_NEVE_N 10 /* control type: numeric, callback function: (none) */
#define P1_TDCLOG_S 11 /* control type: binary, callback function: (none) */
#define P1_DAQ_S 12 /* control type: textButton, callback function: (none) */
#define P1_TIMER_T 13 /* control type: timer, callback function: cb_timer */
#define P1_REFON_CB 14 /* control type: radioButton, callback function: (none) */
#define P1_REFRESH_PB 15 /* control type: command, callback function: (none) */
#define P1_DEBUG_PB 16 /* control type: command, callback function: debug_pressed */
#define P1_FILENAME_EN 17 /* control type: string, callback function: (none) */
#define P1_FILETYPE 18 /* control type: ring, callback function: (none) */
 
 
/* Control Arrays: */
 
/* (no control arrays in the resource file) */
 
 
/* Menu Bars, Menus, and Menu Items: */
 
/* (no menu bars in the resource file) */
 
 
/* Callback Prototypes: */
 
int CVICALLBACK cb_timer(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK debug_pressed(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
 
 
#ifdef __cplusplus
}
#endif
/cvi/RedPitaya/RedPitaya_ui.uir
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/RedPitaya/plottdc.cxx
0,0 → 1,24
void plottdc(char *filename) {
FILE *fp =fopen(filename,"r");
if (fp) {
unsigned int hdr[10];
int nb = fread(hdr,sizeof(unsigned int), 5, fp);
int size = hdr[1]/sizeof(int);
printf("FILE %s opened\nheader read nb=%d\ndata size %d\n", filename, nb ,size);
//int *data = new unsigned int[size];
int *data = new unsigned int[size];
nb = fread(data, sizeof(unsigned int), size, fp);
printf("FILE data elements %d\n", nb);
fclose(fp);
TFile *f = new TFile(TString(filename)+".root","RECREATE");
TH1F *h = new TH1F("h","TDC;tdc(bin);N",size, -0.5, size-0.5);
for (int i=0; i< size; i++ ) h->SetBinContent(i+1,data[i]);
h->DrawCopy();
f->Write();
f->Close();
}
 
}