beautypg.com

Yaskawa MP920 Communications Module User Manual

Page 290

background image

Appendix C C Language Sample Programs

C.2.1 TCP (When Using Extended MEMOBUS Protocol)

C-14

// Extended MEMOBUS Data Length
memex_len = (unsigned short)((unsigned char)rbuf[13]) << 8;
memex_len += (unsigned short)((unsigned char)rbuf[12]);

// Checks the extended MEMOBUS data length.
if (( data_len - 14) != memex_len )
// Extended MEMOBUS data length

¼

Total data length

-

218 header (12 bytes)

-

// Extended MEMOBUS length (2 bytes)

{

rc = -3;
return( rc );

}

// Checks the MFC.
if ( rbuf[14] != 0x20 )// MFC is fixed to 0x20.
{

rc = -4;
return( rc );

}

// Checks the SFC.
// Checks within mk_rsp_data().

return( rc );

}