Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 311 → Rev 310

/cvi/apps/TempCtrl/TempCtrl_K2231A.c
File deleted
/cvi/apps/TempCtrl/Arduino_UNO/Arduino_UNO.ino
File deleted
/cvi/apps/TempCtrl/TempCtrl_K2231A.prj
File deleted
/cvi/apps/TempCtrl/TempCtrl.c
73,6 → 73,8
GetCtrlVal(pa,PA_CHANNEL, &ch);
iRet = TMI_TimeOut(TMI_DeviceId, 1);
iRet = TMI_Refresh(TMI_DeviceId);
 
 
iRet = TMI_MoniDataQ(TMI_DeviceId, ch+1, &Voltage, &Current, &cv_cc);
 
SetCtrlVal(panel, PA_VMON, Voltage);
95,9 → 97,10
GetCtrlVal(pa,PA_CHANNEL, &ch);
GetCtrlVal(pa,PA_PRESET, &preset);
 
 
 
TMI_VoltageQ(TMI_DeviceId, ch+1, preset, &Voltage);
TMI_CurrentQ(TMI_DeviceId, ch+1, preset, &Current);
SetCtrlVal(pa, PA_VSET, Voltage);
SetCtrlVal(pa, PA_ISET, Current);
 
106,11 → 109,6
return 0;
}
 
int SetCooling(char onoff){
int nb=0;
nb = ComWrt (COM_PORT, &onoff, 1);
return nb;
}
 
#define tcpChk(f) if ((g_TCPError=(f)) < 0) {ReportTCPError(); return -1; }
 
176,10 → 174,10
printf("Received %s\n", receiveBuf);
int cmd=0;
float arg;
sscanf(receiveBuf,"%d%f",&cmd,&arg);
sscanf("%d%f",&cmd,&arg);
switch (cmd){
case 1:
SetCtrlVal(pa,PA_TSET,arg);
SetCtrlVal(ps.PA_TSET,arg);
break;
default:
break;
287,19 → 285,7
return 0;
}
 
int CVICALLBACK SwitchCoolingOnOffCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2) {
int onoff=0;
 
switch (event) {
case EVENT_COMMIT:
GetCtrlVal(pa,control,&onoff);
SetCooling(onoff);
break;
}
return 0;
}
 
int CVICALLBACK SwitchOnOffCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2) {
327,13 → 313,8
int debug1;
GetCtrlVal(pa,PA_DEBUG_1, &debug1);
//printf("%f#%s#", temp, read_data);
// temp1 , temp2 , temp3 , temp4 , temp humidity sens, rel.humidity
if (bytes_read >0) {
SetCtrlVal(pa,PA_ARDUINO, read_data);
}
sscanf(read_data,"%lf %lf %lf %lf %lf %lf",&f[0],&f[1],&f[2],&f[3],&f[4],&f[5]);
double humidity = f[5];
double htemp = f[4];
// printf("%lf %lf %lf %lf %lf %lf",f[0],f[1],f[2],f[3],f[4],f[5]);
int RS232Error = ReturnRS232Err ();
if (ReturnRS232Err ()) {
357,7 → 338,7
 
double tdiff = temp - tset;
double retpid = UpdatePID(&pid, tdiff, temp);
const double troom = htemp;
const double troom = 20;
double Pheat= 0.2 * (temp - troom);
double Ptec = retpid - Pheat*2;
vset = (polar*Ptec>0) ? sqrt(fabs(Ptec)) : 0;
381,7 → 362,7
PlotStripChart (pa, PA_GRAPH_VMON, pgraph, 3, 0, 0, VAL_DOUBLE);
PlotStripChart (pa, PA_GRAPH_3, &humidity, 1, 0, 0, VAL_DOUBLE);
SetCtrlVal(pa,PA_TMON,temp);
SetCtrlVal(pa,PA_HTMON,htemp);
 
SetCtrlVal(pa,PA_HUMIDITY,humidity);
 
char transmitBuf[512]= {0};
/cvi/apps/TempCtrl/TempCtrl.h
19,27 → 19,24
#define PA_START 4 /* control type: command, callback function: StartCB */
#define PA_TSET 5 /* control type: numeric, callback function: (none) */
#define PA_HUMIDITY 6 /* control type: numeric, callback function: (none) */
#define PA_HTMON 7 /* control type: numeric, callback function: (none) */
#define PA_TMON 8 /* control type: numeric, callback function: (none) */
#define PA_DEBUG_1 9 /* control type: radioButton, callback function: (none) */
#define PA_LOG 10 /* control type: radioButton, callback function: (none) */
#define PA_GRAPH_VMON 11 /* control type: strip, callback function: (none) */
#define PA_GRAPH_3 12 /* control type: strip, callback function: (none) */
#define PA_GRAPH 13 /* control type: strip, callback function: (none) */
#define PA_FNAME 14 /* control type: string, callback function: (none) */
#define PA_ONOFF 15 /* control type: binary, callback function: SwitchOnOffCB */
#define PA_CHANNEL 16 /* control type: numeric, callback function: SelectChannelCB */
#define PA_IMAX 17 /* control type: numeric, callback function: (none) */
#define PA_VMAX 18 /* control type: numeric, callback function: (none) */
#define PA_VSET 19 /* control type: numeric, callback function: (none) */
#define PA_VMON 20 /* control type: numeric, callback function: (none) */
#define PA_ISET 21 /* control type: numeric, callback function: (none) */
#define PA_POLAR 22 /* control type: ring, callback function: (none) */
#define PA_IMON 23 /* control type: numeric, callback function: (none) */
#define PA_CVCC 24 /* control type: LED, callback function: (none) */
#define PA_PRESET 25 /* control type: numeric, callback function: SetPresetCB */
#define PA_FAN 26 /* control type: binary, callback function: SwitchCoolingOnOffCB */
#define PA_ARDUINO 27 /* control type: string, callback function: (none) */
#define PA_TMON 7 /* control type: numeric, callback function: (none) */
#define PA_DEBUG_1 8 /* control type: radioButton, callback function: (none) */
#define PA_LOG 9 /* control type: radioButton, callback function: (none) */
#define PA_GRAPH_VMON 10 /* control type: strip, callback function: (none) */
#define PA_GRAPH_3 11 /* control type: strip, callback function: (none) */
#define PA_GRAPH 12 /* control type: strip, callback function: (none) */
#define PA_FNAME 13 /* control type: string, callback function: (none) */
#define PA_ONOFF 14 /* control type: binary, callback function: SwitchOnOffCB */
#define PA_CHANNEL 15 /* control type: numeric, callback function: SelectChannelCB */
#define PA_IMAX 16 /* control type: numeric, callback function: (none) */
#define PA_VMAX 17 /* control type: numeric, callback function: (none) */
#define PA_VSET 18 /* control type: numeric, callback function: (none) */
#define PA_VMON 19 /* control type: numeric, callback function: (none) */
#define PA_ISET 20 /* control type: numeric, callback function: (none) */
#define PA_POLAR 21 /* control type: ring, callback function: (none) */
#define PA_IMON 22 /* control type: numeric, callback function: (none) */
#define PA_CVCC 23 /* control type: LED, callback function: (none) */
#define PA_PRESET 24 /* control type: numeric, callback function: SetPresetCB */
 
 
/* Control Arrays: */
59,7 → 56,6
int CVICALLBACK SetPresetCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK StartCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK StopCB(int panel, int control, int event, void *callbackData, int eventData1, int eventData2);
int CVICALLBACK SwitchCoolingOnOffCB(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);
 
 
/cvi/apps/TempCtrl/TempCtrl.uir
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream