Sample Program - Omron CJ1W-ETN11 Operation Manual

Sysmac cs/cj series ethernet units
Hide thumbs Also See for CJ1W-ETN11:
Table of Contents

Advertisement

Sending Commands From a Host Computer
5-4-3

Sample Program

Operation Overview
Settings
Sample Program
1
#include <errno.h>
2
#include <stdio.h>
3
#include <sys/types.h>
4
#include <sys/socket.h>
5
#include <netinet/in.h>
6
#include <signal.h>
7
8
#define FINS_UDP_PORT 9600
9
#define SERV_IP_ADDR "196.36.32.100"
10
#define MAX_MSG
11
#define RESP_TIMEOUT 2
12
13
dress used for Ethernet.
00 (Hex):
Local PC Unit
01 to 7E (Hex): Destination node number (1 to 126)
FF (Hex): Broadcasting
When multiple Communications Units are mounted, DA1 specifies the
node number of the Unit connected to the network specified by DNA.
DA2 (Destination Unit Address)
Specifies the number of the Unit at the destination node.
00 (Hex):
PC (CPU Unit)
10 to 1F (Hex): CPU Bus Unit #0 to #15 (16 to 31)
E1 (Hex):
Inner Board
FE (Hex):
Unit connected to network.
SNA (Source Network Address)
Specifies the number of the network where the source node is located.
00 (Hex):
Local network
01 to 7F (Hex): Source network number (1 to 127)
SA1 (Source Node Address)
Specifies the local node number. The ranges of numbers that can be spec-
ified are the same as for DA1.
SA2 (Source Node Address)
Specifies the number of the Unit at the source node. The ranges of numbers
that can be specified are the same as for DA2.
SID (Service ID)
The SID is used to identify the process that data is sent from. Set any desired
number from 00 to FF for the SID. The same number will be returned in the
response, allowing you to match commands and responses in your applica-
tion.
This program reads 150 words of the PC memory beginning at D00100 by
sending an FINS command (MEMORY AREA READ, command code 0101)
from a UNIX workstation to the PC on the Ethernet network. If no response is
received within two seconds of sending the FINS command, the command will
be resent.
The Ethernet Unit IP address is 196.36.32.100, and the FINS node number is
100. IP address conversion is set to automatic generation.
The workstation's IP address is 196.36.32.50 and its FINS node number is 50.
The FINS UDP port number is 9600 (default).
2010
/*
Ethernet Unit IP ADDRESS
Section 5-4
*/
99

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cs1w-etn11Cs/cj seriesCs1w-etn01W343-e1-07

Table of Contents