HI,
here is the code I have tried to use
int32 CVICALLBACK SpeedTorqueAcquisition721 (TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
{
DisableBreakOnLibraryErrors();
if(unit==1) DAQmxSetChanAttribute (AnalogInputsTask, "Torque Acquisition 721", DAQmx_AI_Voltage_Units, DAQmx_Val_FromCustomScale, "LB-In to N m");
else if (unit == 0) DAQmxSetChanAttribute (AnalogInputsTask, "Torque Acquisition 721", DAQmx_AI_Voltage_Units, DAQmx_Val_FromCustomScale, "Torquescale");
(DAQmxReadAnalogF64(AnalogInputsTask, 500, -1,DAQmx_Val_GroupByChannel, AnalogInputsArray,2500, &AnalogSamplesPerChan,NULL));
EnableBreakOnLibraryErrors();
Subset1D (AnalogInputsArray, 2000, 0, 500, SpeedArray);
Mean(SpeedArray, 500, &SpeedVal);
SpeedVal = SpeedVal*1500;
SetCtrlVal(dvdxt, DVDXT_Speed_indicator, SpeedVal);
Subset1D (AnalogInputsArray, 2000, 500, 500, TorqueArray);
Mean(TorqueArray, 500, &TorqueVal);
SetCtrlVal(dvdxt, DVDXT_Torque_indicator, TorqueVal);
Subset1D (AnalogInputsArray, 2000, 1000, 500, PressureArray);
Mean(PressureArray, 500, &PressureVal);
SetCtrlVal(dvdxt, DVDXT_Pressure_indicator, PressureVal);
Subset1D (AnalogInputsArray, 2000, 1500, 500, AlternatorTemperatureArray);
Mean(AlternatorTemperatureArray, 500, &AlternatorTemperatureVal);
SetCtrlVal(dvdxt, DVDXT_Int_Temp_indicator, AlternatorTemperatureVal);
return 0;
}
What I am trying to do is to convert value from lb-in to Nm using scales,on action of a button on the front panel called unit.
so I need to use the LB-in scale when unit = 1 and I need to use the lb-in to Nm scale when unit =0
lb in scale is y=40x+0, LB in to Nm scale is y=40*0.112984137 x+0, 40 is the converstion factor from voltage to lbin and 0.112984137 is the converstion factor from lbin to Nm
but using the code above the values does not change on unit button actuation.