72
Serial communication
CG Drives & Automation, 01-5326-01r3b
Programming example:
typedef struct
{
int m:11; // mantissa, -1024..1023
int e: 4; // exponent -8..7
unsigned int f: 1; // format, 1->special emoint format
} eint16;
//---------------------------------------------------------------------------
unsigned short int float_to_eint16(float value)
{
eint16 etmp;
int dec=0;
while (floor(value) != value && dec<16)
{
dec++; value*=10;
}
if (value>=0 && value<=32767 && dec==0)
*(short int *)&etmp=(short int)value;
else if (value>=-1000 && value<0 && dec==0)
{
etmp.e=0;
etmp.f=1;
etmp.m=(short int)value;
}
else
{
etmp.m=0;
etmp.f=1;
etmp.e=-dec;
if (value>=0)
etmp.m=1; // Set sign
else
etmp.m=-1; // Set sign
value=fabs(value);
while (value>1000)
{
etmp.e++; // increase exponent
value=value/10;
}
value+=0.5; // round
etmp.m=etmp.m*value; // make signed
}
R
return (*(unsigned short int *)&etmp);
}
//---------------------------------------------------------------------------
float eint16_to_float(unsigned short int value)
{
float f;
eint16 evalue;
evalue=*(eint16 *)&value;
if (evalue.f)
{
if (evalue.e>=0)
f=(int)evalue.m*pow10(evalue.e);
else
f=(int)evalue.m/pow10(abs(evalue.e));
}
else
f=value;
return f;
}
//---------------------------------------------------------------------------
9(0R'ULYH 96, 9(0 U
Summary of Contents for VEMoDRIVE VSI 2.0 HD
Page 1: ...Frequency converter VEMoDRIVE VSI 2 0 HD Instruction manual 01 5326 01 04 2018...
Page 2: ......
Page 4: ......
Page 40: ...38 Installation CG Drives Automation 01 5326 01r3b 9 0R ULYH 96 9 0 U...
Page 52: ...50 Getting Started CG Drives Automation 01 5326 01r3b 9 0R ULYH 96 9 0 U...
Page 64: ...62 EMC and standards CG Drives Automation 01 5326 01r3b 9 0R ULYH 96 9 0 U...
Page 142: ...140 Functional Description CG Drives Automation 01 5326 01r3b 9 0R ULYH 96 9 0 U...
Page 198: ...196 CG Drives Automation 01 5326 01r3b 9 0R ULYH 96 9 0 U...
Page 232: ...230 Technical Data CG Drives Automation 01 5326 01r3b 9 0R ULYH 96 9 0 U...
Page 238: ...236 Menu List CG Drives Automation 01 5326 01r3b 9 0R ULYH 96 9 0 U...
Page 243: ...241 9 0R ULYH 96 9 0 U...