Three-Point Circular Positioning with Xinjie PLC

Written in C language provided by Xinjie

void JISUAN ( PINT16S W, PBIT B )

{ #define SysRegAddr_HD_D_HM_M

#define DD *(INT32S*)&D

#define FFD *(FP32*)&D

#define DFD *(FP64*)&D

#define DSD *(INT32S*)&SD

#define DHD *(INT32S*)&HD

#define FFHD *(FP64*)&HD

#define FHD *(FP32*)&HD

#define DHSD *(INT32S*)&HSD

#define DSFD *(INT32S*)&SFD

#define DHSCD *(INT32S*)&HSCD

int page, count; float length = 399.0 ; // Set distance between two legs

float length2 = length * length;

float high = FFD[200] * 10.0; // Height calculated from encoder

FFD[210] = high;

float hi4 = high * high * 4.0;

float jiguo = ( hi4 + length2 ) / ( 4.0 * high );

FFD[300] = jiguo;// Display actual length on touch screen

}

Function Description:

  • This function is used to calculate the actual length based on the encoder height and display the result on the touch screen.
  • Main parameter description:
    • length: Set value for the distance between two legs
    • FFD[200]: Encoder height
    • FFD[300]: Calculation result for touch screen displayThree-Point Circular Positioning with Xinjie PLC

Leave a Comment