Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 158 → Rev 159

/HVtest/HVtest.c
0,0 → 1,142
#include "MPOD.h"
 
#include "HVtest_ui.h"
 
static int p1h, pID, rID, tfID;
 
int CVICALLBACK refreshTimer (int panel, int control, int event, void *callbackData,
int eventData1, int eventData2) {
QueueUserEvent (9000, p1h, P1_REFRESHTIMER);
return (0);
}
 
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow) {
 
int mainonoff,onoff[4];
int ch=200,mo=2;
int iret;
int i, j;
double ret;
double vset[4],cset[4],vrise[4],vfall[4];
char cret[2000];
char cMainSwitch[2][30]= {"Turn system OFF?","Turn system ON?"};
 
HSNMP crate1;
 
if (InitCVIRTE (hInstance, 0, 0) == 0)
return -1; /* out of memory */
 
MPOD_Start();
MPOD_Open(0,"f9mpod.ijs.si");
crate1 = crateHsnmp[0];
 
iret=MPOD_GetInt(0,"moduleNumber.0");
printf("Module Number = %i\n", iret);
 
strcpy(cret, MPOD_GetString(0,"moduleDescription.ma2"));
printf("Module type: %s\n",cret);
 
 
iret=MPOD_GetIntCh(0,"fanNominalSpeed",0);
printf("Fan nominal speed = %i\n", iret);
 
if ((p1h = LoadPanel (0, "HVtest_ui.uir", P1)) < 0) return -1;
DisplayPanel (p1h);
 
//Initial state
mainonoff=getMainSwitch(crate1);
SetCtrlVal (p1h, P1_MSW, mainonoff);
SetCtrlVal (p1h, P1_MSWLED, mainonoff);
iret=getMainStatus(crate1);
SetCtrlVal (p1h, P1_MST, iret);
iret=getFanNominalSpeed(crate1);
SetCtrlVal (p1h, P1_MFS, iret);
 
if (mainonoff) {
onoff[0]=getChannelSwitch(crate1, ch);
SetCtrlVal (p1h, P1_ONOFF0, onoff[0]);
vset[0]=getOutputVoltage(crate1,ch);
SetCtrlVal (p1h, P1_V0, vset[0]);
cset[0]=1e+6*getOutputCurrent(crate1,ch);
SetCtrlVal (p1h, P1_C0, cset[0]);
vrise[0]=getModuleRampSpeedVoltage(crate1,mo);
SetCtrlVal (p1h, P1_VRI0, vrise[0]);
// vfall[0]=abs(getOutputFallRate(crate1,ch));
// SetCtrlVal (p1h, P1_VFA0, vfall[0]);
}
// QueueUserEvent (1000, p1h, P1_RESET);
QueueUserEvent (9000, p1h, P1_REFRESHTIMER);
 
do {
GetUserEvent (1, &pID, &rID);
switch (rID) {
case P1_REFRESHTIMER:
mainonoff=getMainSwitch(crate1);
SetCtrlVal (p1h, P1_MSW, mainonoff);
SetCtrlVal (p1h, P1_MSWLED, mainonoff);
iret=getMainStatus(crate1);
SetCtrlVal (p1h, P1_MST, iret);
// ret=getOutputSenseMeasurement(crate1, ch);
ret=getOutputTerminalMeasurement(crate1, ch);
SetCtrlVal (p1h, P1_VD0, ret);
ret=1e+6*getCurrentMeasurement(crate1, ch);
SetCtrlVal (p1h, P1_CD0, ret);
PlotStripChartPoint (p1h, P1_G1, ret);
break;
case P1_MSW:
GetCtrlVal (p1h, P1_MSW, &mainonoff);
if (ConfirmPopup("Main switch!!!", cMainSwitch[mainonoff]))
setMainSwitch(crate1, mainonoff);
if (!mainonoff) break;
// Delay(1);
onoff[0]=getChannelSwitch(crate1, ch);
SetCtrlVal (p1h, P1_ONOFF0, onoff[0]);
vset[0]=getOutputVoltage(crate1,ch);
SetCtrlVal (p1h, P1_V0, vset[0]);
cset[0]=1e+6*getOutputCurrent(crate1,ch);
SetCtrlVal (p1h, P1_C0, cset[0]);
vrise[0]=getModuleRampSpeedVoltage(crate1,mo);
SetCtrlVal (p1h, P1_VRI0, vrise[0]);
// vfall[0]=abs(getOutputFallRate(crate1,ch));
// SetCtrlVal (p1h, P1_VFA0, vfall[0]);
break;
}
if (!mainonoff) continue;
switch (rID) {
case P1_ONOFF0:
GetCtrlVal (p1h, P1_ONOFF0, &onoff[0]);
setChannelSwitch(crate1, ch, onoff[0]);
// Delay(1);
break;
case P1_V0:
GetCtrlVal (p1h, P1_V0, &vset[0]);
setOutputVoltage(crate1, ch, vset[0]);
break;
case P1_C0:
GetCtrlVal (p1h, P1_C0, &cset[0]);
cset[0]/=1e+6; //[uA]
setOutputCurrent(crate1, ch, cset[0]);
break;
case P1_VRI0:
GetCtrlVal (p1h, P1_VRI0, &ret);
setModuleRampSpeedVoltage(crate1, mo, ret);
vrise[0]=getModuleRampSpeedVoltage(crate1,mo);
SetCtrlVal (p1h, P1_VRI0, vrise[0]);
break;
// case P1_VFA0:
// GetCtrlVal (p1h, P1_VFA0, &ret);
// setOutputFallRate(crate1, ch, ret);
// vfall[0]=abs(getOutputFallRate(crate1,ch));
// SetCtrlVal (p1h, P1_VFA0, vfall[0]);
// break;
}
} while ((rID != P1_EXIT));
 
DiscardPanel (p1h);
 
MPOD_Close(0);
MPOD_End();
 
return 0;
}
/HVtest/HVtest.prj
0,0 → 1,468
[Project Header]
Version = 1302
Pathname = "/c/home/samo/HVtest/HVtest.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 = 5
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]
Folder 0 = "Source Files"
FolderEx 0 = "Source Files"
Folder 1 = "Instrument Files"
FolderEx 1 = "Instrument Files"
Folder 2 = "Include Files"
FolderEx 2 = "Include Files"
Folder 3 = "User Interface Files"
FolderEx 3 = "User Interface Files"
Folder 4 = "Library Files"
FolderEx 4 = "Library Files"
 
[File 0001]
File Type = "CSource"
Res Id = 1
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "HVtest.c"
Path = "/c/home/samo/HVtest/HVtest.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"
Folder Id = 0
 
[File 0002]
File Type = "Function Panel"
Res Id = 2
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../cvi/instr/MPOD/MPOD.fp"
Path = "/c/home/cvi/instr/MPOD/MPOD.fp"
Exclude = False
Project Flags = 0
Folder = "Instrument Files"
Folder Id = 1
 
[File 0003]
File Type = "Include"
Res Id = 3
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "HVtest_ui.h"
Path = "/c/home/samo/HVtest/HVtest_ui.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
Folder Id = 2
 
[File 0004]
File Type = "User Interface Resource"
Res Id = 4
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "HVtest_ui.uir"
Path = "/c/home/samo/HVtest/HVtest_ui.uir"
Exclude = False
Project Flags = 0
Folder = "User Interface Files"
Folder Id = 3
 
[File 0005]
File Type = "Library"
Res Id = 5
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../../usr/lib/netsnmp.lib"
Path = "/c/usr/lib/netsnmp.lib"
Exclude = False
Project Flags = 0
Folder = "Library Files"
Folder Id = 4
 
[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 = "HVtest (Debug x86)"
File Description Ex = "%application (%rel_dbg %arch)"
File Version = "1.0"
File Version Ex = "%f1.%f2"
Internal Name = "HVtest"
Internal Name Ex = "%basename"
Legal Copyright = "Copyright © 2016"
Legal Copyright Ex = "Copyright © %company %Y"
Legal Trademarks = ""
Legal Trademarks Ex = ""
Original Filename = "HVtest.exe"
Original Filename Ex = "%filename"
Private Build = ""
Private Build Ex = ""
Product Name = " HVtest"
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 = True
Enable Pointer Mismatch Warning = True
Enable Unreachable Code Warning = True
Enable Unreferenced Identifiers Warning = True
Enable Assignment In Conditional Warning = True
O Option Compatible With 5.0 = False
Enable C99 Extensions = True
Uninitialized Locals Compile Warning = "Aggressive"
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"
 
[Include Paths]
Include Path 1 Is Rel = True
Include Path 1 Rel To = "Project"
Include Path 1 Rel Path = "../../cvi/instr/MPOD/include"
Include Path 1 = "/c/home/cvi/instr/MPOD/include"
Include Path 2 Is Rel = True
Include Path 2 Rel To = "Project"
Include Path 2 Rel Path = "../../../usr/include"
Include Path 2 = "/c/usr/include"
 
[Create Executable]
Executable File_Debug Is Rel = True
Executable File_Debug Rel To = "Project"
Executable File_Debug Rel Path = "HVtest.exe"
Executable File_Debug = "/c/home/samo/HVtest/HVtest.exe"
Executable File_Release Is Rel = True
Executable File_Release Rel To = "Project"
Executable File_Release Rel Path = "HVtest.exe"
Executable File_Release = "/c/home/samo/HVtest/HVtest.exe"
Executable File_Debug64 Is Rel = True
Executable File_Debug64 Rel To = "Project"
Executable File_Debug64 Rel Path = "HVtest.exe"
Executable File_Debug64 = "/c/home/samo/HVtest/HVtest.exe"
Executable File_Release64 Is Rel = True
Executable File_Release64 Rel To = "Project"
Executable File_Release64 Rel Path = "HVtest.exe"
Executable File_Release64 = "/c/home/samo/HVtest/HVtest.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
 
/HVtest/HVtest_ui.h
0,0 → 1,51
/**************************************************************************/
/* 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_SET0 2 /* control type: command, callback function: (none) */
#define P1_EXIT 3 /* control type: command, callback function: (none) */
#define P1_C0 4 /* control type: numeric, callback function: (none) */
#define P1_VFA0 5 /* control type: numeric, callback function: (none) */
#define P1_VRI0 6 /* control type: numeric, callback function: (none) */
#define P1_CD0 7 /* control type: numeric, callback function: (none) */
#define P1_VD0 8 /* control type: numeric, callback function: (none) */
#define P1_V0 9 /* control type: numeric, callback function: (none) */
#define P1_ONOFF0 10 /* control type: radioButton, callback function: (none) */
#define P1_REFRESHTIMER 11 /* control type: timer, callback function: refreshTimer */
#define P1_MSW 12 /* control type: binary, callback function: (none) */
#define P1_G1 13 /* control type: strip, callback function: (none) */
#define P1_MSWLED 14 /* control type: LED, callback function: (none) */
#define P1_MFS 15 /* control type: numeric, callback function: (none) */
#define P1_MST 16 /* control type: numeric, 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 refreshTimer(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
 
 
#ifdef __cplusplus
}
#endif
/HVtest/HVtest_ui.uir
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property