EasyManua.ls Logo

Brainchild PR20 - Read DI Function

Default Icon
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 471 of 479
Math
switch(decimal value)
{
case 1:
ScaleLo = ScaleLo / 10;
ScaleHi = ScaleHi / 10;
break;
case 2:
ScaleLo = ScaleLo / 100;
ScaleHi = ScaleHi / 100;
break;
case 3:
ScaleLo = ScaleLo / 1000;
ScaleHi = ScaleHi / 1000;
break;
case 4:
ScaleLo = ScaleLo / 10000;
ScaleHi = ScaleHi / 10000;
break;
case 5:
ScaleLo = ScaleLo / 100000;
ScaleHi = ScaleHi / 100000;
break;
default:
break;
}
// Step 4: Parsing data for Math1
RegData = (UINT)MAKELONG(MAKEWORD(MsgBuf[j+1],
MsgBuf[j]),
MAKEWORD(MsgBuf[j+3],
MsgBuf[j+2]));
// Step 5: Execute converted function
MathData = ConvertData(ValueRangeLo,
ValueRangeHi,
ScaleLo,
ScaleHi,
RegData);
// Step 6: Repeat Step 1 to Step 5 for getting another data of Math
}
8.3.6 Read DI Function
bool ReadDIData(void)
{
unsigned char MsgBuf[96];
unsigned char Addr = 1; /* Slave Id */
unsigned short StartRegAdd = 50;

Table of Contents

Related product manuals