Subversion Repositories f9daq

Compare Revisions

No changes between revisions

Ignore whitespace Rev 278 → Rev 279

/cvi/instr/K617/K617-ctrl.h
0,0 → 1,62
/**************************************************************************/
/* 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_TEST 2 /* control type: command, callback function: TestCB */
#define P1_EXIT 3 /* control type: command, callback function: ExitCB */
#define P1_U_1 4 /* control type: numeric, callback function: (none) */
#define P1_I_1 5 /* control type: numeric, callback function: (none) */
#define P1_BOX_1 6 /* control type: radioButton, callback function: SetMaskCB */
#define P1_READ 7 /* control type: command, callback function: ReadCB */
#define P1_SET 8 /* control type: command, callback function: SetCB */
#define P1_IMON_1 9 /* control type: numeric, callback function: (none) */
#define P1_VMON_1 10 /* control type: numeric, callback function: (none) */
#define P1_TIMERON 11 /* control type: binary, callback function: TimerOnOffCB */
#define P1_LOG 12 /* control type: radioButton, callback function: LogToFileCB */
#define P1_CVCC_1 13 /* control type: LED, callback function: (none) */
#define P1_TIMER 14 /* control type: timer, callback function: TimerCB */
#define P1_ONOFF 15 /* control type: binary, callback function: SwitchOnOffCB */
#define P1_TINTERVAL 16 /* control type: numeric, callback function: SetIntervalCB */
#define P1_GRAPH_1 17 /* control type: strip, callback function: (none) */
#define P1_GRAPH 18 /* control type: strip, 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 ExitCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK LogToFileCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK ReadCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK SetCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK SetIntervalCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK SetMaskCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK SwitchOnOffCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK TestCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK TimerCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK TimerOnOffCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
 
 
#ifdef __cplusplus
}
#endif
/cvi/instr/K617/K617-ctrl.uir
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/cvi/instr/K617/K617.c
272,20 → 272,12
return;
}
 
#ifdef K617_MAIN
 
#include <cvirte.h>
 
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
void _VI_FUNC K617_test (void)
{
int i;
int i;
double value;
char cres[100];
 
if (InitCVIRTE (hInstance, 0, 0) == 0) return -1; /* out of memory */
K617_open (1,5,3,0,13);
K617_clear ();
K617_current_mode (4);
K617_zero_correct (1);
311,9 → 303,260
Delay(5);
K617_vsource_operate (0);
K617_close();
 
}
 
#ifdef K617_MAIN
 
#include <cvirte.h>
#include <userint.h>
#include "K617-ctrl.h"
int pnl; int gLogToFile;
int vmon[4]={P1_VMON_1};
int imon[4]={P1_IMON_1 };
int vset[4]={P1_U_1 };
int iset[4]={P1_I_1 };
int radiob[4]={P1_BOX_1 };
 
int cvcc[4]={P1_CVCC_1 };
const unsigned char Pre_1 = 1;
int gMask=0xF;
 
int pnl;
FILE *gFp;
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
char cres[100];
double Voltage, Current, tinterval;
if (InitCVIRTE (hInstance, 0, 0) == 0) return -1; /* out of memory */
SetStdioPort (CVI_STDIO_WINDOW);
if ((pnl = LoadPanel (0, "K617-ctrl.uir", P1)) < 0) return -1;
K617_open (1,4,3,0,13);
SetCtrlVal(pnl, P1_ONOFF, 0);
GetCtrlVal(pnl, P1_TINTERVAL, &tinterval);
SetCtrlAttribute (pnl, P1_TIMER, ATTR_INTERVAL, tinterval);
for (unsigned char ch=0;ch<1;ch++){
int ison,i;
Voltage =K617_vsource_get();
Current =K617_get(cres,&i);
SetCtrlVal(pnl, vset[ch], Voltage);
SetCtrlVal(pnl, iset[ch], Current);
GetCtrlVal(pnl, radiob[ch], &ison);
gMask = ison;
}
DisplayPanel (pnl);
RunUserInterface ();
DiscardPanel (pnl);
K617_close();
 
if (gFp) fclose(gFp);
 
return 0;
}
 
 
 
 
int CVICALLBACK SwitchOnOffCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
unsigned char state;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panel, control, &state);
K617_vsource_operate (state);
break;
}
return 0;
}
 
int CVICALLBACK SetCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
char cres[100];
int i;
switch (event)
{
case EVENT_COMMIT:
for (unsigned char ch = 0; ch<1;ch++){
//printf("ch %d %x\n", ch, gMask);
if (gMask){
double Voltage;
double Current;
GetCtrlVal(panel, vset[ch], &Voltage);
GetCtrlVal(panel, iset[ch], &Current);
printf("->ch %d VSet %g Iset %g\n", ch, Voltage, Current);
K617_vsource_set (Voltage);
Voltage=K617_vsource_get();
// TMI_Current(TMI_DeviceId, ch+1, Pre_1, Current);
Current=K617_get(cres,&i);
printf("<-ch %d VSet %g Iset %g\n", ch, Voltage, Current);
}
}
break;
}
return 0;
}
 
int CVICALLBACK ReadCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int iRet;
char ch=0;
double Voltage;
double Current;
char cv_cc;
char cres[100];
switch (event)
{
case EVENT_COMMIT:
for (ch = 0; ch<1;ch++){
if (gMask){
int ison,i;
Voltage =K617_vsource_get();
Current =K617_get(cres,&i);
cv_cc = 1;
printf("ch %d VSet %g Iset %g\n", ch, Voltage, Current);
SetCtrlVal(panel, vmon[ch], Voltage);
SetCtrlVal(panel, imon[ch], Current);
SetCtrlVal(panel, cvcc[ch], cv_cc);
}
}
break;
}
return 0;
}
 
int CVICALLBACK SetIntervalCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2) {
double tinterval;
switch (event) {
case EVENT_COMMIT:
GetCtrlVal(panel, control, &tinterval);
SetCtrlAttribute (panel, P1_TIMER, ATTR_INTERVAL, tinterval);
break;
}
return 0;
}
 
int CVICALLBACK TimerOnOffCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int state;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panel, control, &state);
if (state){
ResumeTimerCallbacks();
} else {
SuspendTimerCallbacks ();
printf ("Disabling timer....\n");
}
break;
}
return 0;
}
 
int CVICALLBACK ExitCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface(0);
break;
}
return 0;
}
 
int CVICALLBACK SetMaskCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{ int ison;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panel, control, &ison);
for (int i=0;i<1;i++) if (control == radiob[i]) break;
gMask = ison;
break;
}
return 0;
}
 
 
int CVICALLBACK LogToFileCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panel, control, &gLogToFile);
break;
}
return 0;
}
 
int CVICALLBACK TimerCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
unsigned char ch;
double current[4];
double voltage;
char cv_cc = 0;
char cres[100];
int i=0;
case EVENT_TIMER_TICK:
for (ch = 0; ch<1;ch++){
if (gMask){
voltage =K617_vsource_get();
current[ch] =K617_get(cres,&i);
if (gLogToFile){
if (!gFp) {
gFp= fopen("K617.log","w");
fprintf(gFp,"#time\tch\tU\tI\tCV_CC\n");
}
fprintf(gFp,"%ul\t%d\t%g\t%g\t%d\n", time(NULL), ch+1, voltage, current[ch], cv_cc);
}
}
}
PlotStripChart (panel, P1_GRAPH, current, 1, 0, 0, VAL_DOUBLE);
PlotStripChart (panel, P1_GRAPH_1, &voltage, 1, 0, 0, VAL_DOUBLE);
break;
}
return 0;
}
 
int CVICALLBACK TestCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2) {
switch (event) {
case EVENT_COMMIT:
K617_test();
break;
}
return 0;
}
 
#endif
 
/cvi/instr/K617/K617.prj
1,6 → 1,6
[Project Header]
Version = 1302
Pathname = "/c/home/cvi/instr/K617/K617.prj"
Pathname = "/c/home/CVI/instr/K617/K617.prj"
CVI Dir = "/c/program files/national instruments/cvi2013"
CVI Shared Dir = "/C/Program Files/National Instruments/Shared/CVI"
CVI Pub Local Dir = "/C/ProgramData/National Instruments/CVI2013"
9,7 → 9,7
VXIplug&play Framework Dir = "/C/Program Files/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
Number of Files = 5
Target Type = "Executable"
Flags = 16
Copied From Locked InstrDrv Directory = False
18,7 → 18,6
Don't Display Deploy InstrDrv Dialog = False
 
[Folders]
User Interface Files Folder Not Added Yet = True
Library Files Folder Not Added Yet = True
Folder 0 = "Source Files"
FolderEx 0 = "Source Files"
26,6 → 25,8
FolderEx 1 = "Instrument Files"
Folder 2 = "Include Files"
FolderEx 2 = "Include Files"
Folder 3 = "User Interface Files"
FolderEx 3 = "User Interface Files"
 
[File 0001]
File Type = "CSource"
33,7 → 34,7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "K617.c"
Path = "/c/home/cvi/instr/K617/K617.c"
Path = "/c/home/CVI/instr/K617/K617.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
46,7 → 47,7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "K617.fp"
Path = "/c/home/cvi/instr/K617/K617.fp"
Path = "/c/home/CVI/instr/K617/K617.fp"
Exclude = False
Project Flags = 0
Folder = "Instrument Files"
58,7 → 59,7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../PROLOGIX/prologix.fp"
Path = "/c/home/cvi/instr/PROLOGIX/prologix.fp"
Path = "/c/home/CVI/instr/PROLOGIX/prologix.fp"
Exclude = False
Project Flags = 0
Folder = "Instrument Files"
70,12 → 71,24
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "K617.h"
Path = "/c/home/cvi/instr/K617/K617.h"
Path = "/c/home/CVI/instr/K617/K617.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
Folder Id = 2
 
[File 0005]
File Type = "User Interface Resource"
Res Id = 5
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "K617-ctrl.uir"
Path = "/c/home/CVI/instr/K617/K617-ctrl.uir"
Exclude = False
Project Flags = 0
Folder = "User Interface Files"
Folder Id = 3
 
[Custom Build Configs]
Num Custom Build Configs = 0
 
368,19 → 381,19
Executable File_Debug Is Rel = True
Executable File_Debug Rel To = "Project"
Executable File_Debug Rel Path = "K617_dbg.exe"
Executable File_Debug = "/c/home/cvi/instr/K617/K617_dbg.exe"
Executable File_Debug = "/c/home/CVI/instr/K617/K617_dbg.exe"
Executable File_Release Is Rel = True
Executable File_Release Rel To = "Project"
Executable File_Release Rel Path = "K617.exe"
Executable File_Release = "/c/home/cvi/instr/K617/K617.exe"
Executable File_Release = "/c/home/CVI/instr/K617/K617.exe"
Executable File_Debug64 Is Rel = True
Executable File_Debug64 Rel To = "Project"
Executable File_Debug64 Rel Path = "K617.exe"
Executable File_Debug64 = "/c/home/cvi/instr/K617/K617.exe"
Executable File_Debug64 = "/c/home/CVI/instr/K617/K617.exe"
Executable File_Release64 Is Rel = True
Executable File_Release64 Rel To = "Project"
Executable File_Release64 Rel Path = "K617.exe"
Executable File_Release64 = "/c/home/cvi/instr/K617/K617.exe"
Executable File_Release64 = "/c/home/CVI/instr/K617/K617.exe"
Icon File Is Rel = False
Icon File = ""
Application Title = ""