Mitsubishi Electric FX3U-ENET User Manual page 276

Hide thumbs Also See for FX3U-ENET:
Table of Contents

Advertisement

APPENDIX
/ ***************************************************************** /
/ **
/ **
Sample program
/ **
/ **
This program is a sample program to conduct a
/ **
connection test between the Ethernet block and
/ **
/ **
target device.
/ **
This program accesses the data register (D) of
/ **
the Base Module installed together with the
/ **
Ethernet block.
/ **
/ **
/ **
Copyright(C) 2005 Mitsubishi Electric
/ **
Corporation
/ **
All Rights Reserved
/ **
/ ***************************************************************** /
#include <stdio.h>
#include <winsock.h>
#define FLAG_OFF 0
#define FLAG_ON 1
#define SOCK_OK 0
#define SOCK_NG -1
#define BUF_SIZE 4096
#define ERROR_INITIAL 0
#define ERROR_SOCKET 1
#define ERROR_BIND 2
#define ERROR_CONNECT 3
#define ERROR_SEND 4
#define ERROR_RECEIVE 5
#define ERROR_SHUTDOWN 6
#define ERROR_CLOSE 7
//Definitions for checking the receiving sizes
//#define RECV_ANS_1 4
//#define RECV_ANS_2 24
typedef struct sck_inf{
struct in_addr my_addr;
unsigned short my_port;
struct in_addr FX_IP_addr;
unsigned short FX_port;
};
int nErrorStatus;
int Dmykeyin;
int Closeflag;
SOCKET socketno;
App - 9
// Completion flag OFF
// Completion flag ON
// Normal completion
// Abnormal completion
// Receive buffer size
// Initial error
// Socket creation error
// Bind error
// Connection error
// Send error
// Receive error
// Shutdown error
// Line close error
// Receiving size of response message in reply to device write (1E frame)
// Receiving size of response message in reply to device read (1E frame)
** /
** /
** /
** /
** /
** /
** /
** /
** /
** /
** /
** /
** /
** /
** /
** /
// Error information storage variable
// Dummy key input
// Connection completion flag
MELSEC-F
App - 9

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fx3u-enet-l

Table of Contents