EasyManua.ls Logo

Brainchild PR10 - Read Math Function

Brainchild PR10
479 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Page 470 of 479
ValueRangeLo = -32768;
ValueRangeHi = 32767;
// Step 3: Set value range for scale
//The default of Sensor type in AI1 is set asThermocouple K Type.
// Scale low value is showing “-120”, scale high value is showing “1000”
//Please refer to AI configuration for Modbus Scale
ScaleLo = -120;
ScaleHi = 1000;
// Step 4: Execute converted function
AiData = (int)ConvertData(ValueRangeLo,
ValueRangeHi,
ScaleLo,
ScaleHi,
RegData);
// Step 5: Repeat Step 1 to Step 4 for getting another AI data
}
8.3.5 Read Math Function
bool ReadMathData(void)
{
unsigned char MsgBuf[120];
unsigned char i, j;
unsigned char Addr = 1; /* Slave Id */
unsigned short StartRegAdd = 201;
unsigned short RegQuantities = (10*2); // Math data is float type, so each Math value take two
registers
double ScaleLo, ScaleHi, ValueRangeLo, ValueRangeHi;
double RegData, MathData;
// Read register data from remote device
ReadData(Addr, StartRegAdd, RegQuantities, MsgBuf);
// Step 1: Set value range
//The default of Math data type was set as 4 bytes, the value range will be showing between 0 to
//4294967295
ValueRangeLo = 0;
ValueRangeHi = 4294967295;
// Step 2: Set value range for scale
// When the property of “Transformation” in scale was set as disable, the range will be showing
//-2147483648 to 2147483647
// If the property of “Transformation” in Scale was set as “Value” or “Math Channel”, please refer to
//Appendix D
ScaleLo = -2147483648;
ScaleHi = 2147483647;
// Step 3: Please refer to the decimal value for the conversion of each

Table of Contents

Related product manuals