EasyManuals Logo

Brainchild PR10 User Manual

Brainchild PR10
479 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #469 background imageLoading...
Page #469 background image
Page 469 of 479
int rcv = (5+(RegQuantities*2));
/* Send snd bytes content of msg to COMM port */
/* Receive rcv bytes of response from COMM port to MbsBuf */
if (receiving data length is same as rcv)
return true;
else
return false;
}
8.3.3 Convert Data Function
/****************************************************************/
// Parameter:
// ValueRangeLo -> Minimum value of the value range
// ValueRangeHi -> Maximum value of the value range
// ScaleLo -> Minimum value of the scale value
// ScaleHi -> Maximum value of the scale value
// RegData -> Current register data from remote device
/****************************************************************/
double ConvertData(double ValueRangeLo,
double ValueRangeHi,
double ScaleLo,
double ScaleHi,
double RegData)
{
double ConvertValue;
ConvertValue = (((RegData*(ScaleHi - ScaleLo))/ (ValueRangeHi - ValueRangeLo)) + ScaleLo);
return ConvertValue;
}
8.3.4 Read AI Function
bool ReadAIData(void)
{
unsigned char MsgBuf[40];
unsigned char Addr = 1; /* Slave Id */
unsigned short StartRegAdd = 2;
unsigned short RegQuantities = 5;
int ScaleLo, ScaleHi,
ValueRangeLo, ValueRangeHi,
AiData;
unsigned short RegData;
// Read register data from remote device
ReadData(Addr, StartRegAdd, RegQuantities, MsgBuf);
// Step 1: Parsing data for AI1
RegData = MAKEWORD(MsgBuf[4], MsgBuf[3]);
// Step 2: Set value range
//Because AI data type was set as 2 bytes, the value range would be
// showing between -32768 to 32767

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Brainchild PR10 and is the answer not in the manual?

Brainchild PR10 Specifications

General IconGeneral
BrandBrainchild
ModelPR10
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals