Send TCP/IP message from PLC to PC using Ladder Program - plc

Consider the following Ladder Program that checks if a connection is enabled (A202.00) then send a message from the PLC to the PC.
The documentation (Omron CX-Programmer) has a severe lack of explanation of the program convention. What I do not understand is:
To send a message from a node to a node. I should need to specify the receiver ID. It seems the function block does not have an option where I can insert an IP address. Am I supposed to MOV an IP address to a DM address (D300) then use it? If that's the case how (IP address has dots in between 4 bytes..)?
Can someone please explain what is S (First source word), D (First destination word) and C (First control word). Aren't they just memory address? E.g. sending content of a memory adress to another memory address?
[EDIT]
What am I trying to do?
I am trying to interface a measuring gauge (controlled through Ethernet by PC/C# application) to a robotic system (no RS232 or serial, no TCP/IP, only has the simplest I/O points) with an Omron PLC. When gauge completes a measurement, the C# app sends a command to the Omron PLC which, according to the command received, switch ON or OFF an output which triggers a voltage flow to the robot's I/O port.
Should I use FINS? What functions/protocol from the PLC I need to know to do this? I do not know so I am testing every function from the documentation. So far, zero progress.

1) All addressing information is encapsulated in the five control words (C -> C+4). C- "First Control Word" is the pointer to the first word in this table of five words you must have stored somewhere in your PLC to set up the communication.
2) First source word points to the first word in your PLC you wish to send. First destination word points to the first address in the PLC/device you wish to send to. In the example , the first control word specifies that 10 words should be sent. You point to the first one and it will send that one plus the next nine addresses as well.
To do this you have to use FINS communication - the PC stores a memory structure similar to the PLCs (CIO, DM, etc) called Event Memory and these are the addresses in the PC you are pointing to. The PC gets a FINS node number and address just like a PLC would - no IP addresses are involved. (see : FINS Manual) FINS is old, however, and has been superceded by things like Sysmac Gateway.
There are much better ways of communicating between PLC/PC, however, depending on what you are trying to do. Are you trying to write an HMI? If so, what language are you using?
Edit :
If you're using C#, I highly recommend you look into Sysmac Gateway and CX-Compolet. This is probably the most flexible, simple, and extensible way to get .NET working with Omron PLCs. If it is at all possible, however, a better way might even be to have the measurement unit communicate directly with the PLC via hardware I/O (relays, DIO, etc).
CX-Compolet, Sysmac Gateway link:
http://www.ia.omron.com/product/family/63/index_l_u.html

Related

Does a Computer has a physical component for each ports/sockets?

I'm sorry if my question is too easy or obvious. I'm Comp. Science Student (it's my 6.th term).
I'm trying to combine the knowledges that I'm learning from 'Computer Networks and Security', 'Computer Organization' and 'Operating Systems' lectures in this term.
So, I cannot figure out that;
Does a computer or a phone has physical components for each 65535 ports/sockets?
Or
The machine has just one physical component. So that means port numbers are logical representations that can be shown as text-fields (like header entities or json attributes) of a request or something, to say to computer how to handle the request?
I used ports for connections of back-end and android and front-end. I know that a socket is a physical component, I worked 4 months as phone-repairer, I know these. But this makes me confused.
Thanks in advance..
Think of it this way: "the network interface is the phone system, IP-addresses are phone numbers, and socket/port numbers are like telephone extensions. (The network interface is the only physical device.)
Network traffic is carried by so-called "packets" which have various fields which tell the network how they should be routed. The IP-address will get the packet to the proper destination, then the port/socket-number will specify exactly what software process at that destination should actually handle this packet.

Protocol Translation from CAN bus to IP

I am trying to detect intrusions on a CAN bus configuration. To do this I want to try protocol conversion from CAN to IP (UDP) in order to use snort. I really don't know where to begin as I have not seen anything on protocol translation for a CAN bus at all. Is it even possible? Has anyone tried it?
I basically used a raspberry pi and several Arduinos to take temperature readings (from thermostats) and control hot/cold fans in order to regulate temperature. I know this is not a lot to go on, but as I said, I am just in the beginning phase of planning this protocol translation.
You can use cannelloni on your RPi. There are also stand-alone CAN-to-TCP/UDP converters like for example this one.

npa201 i2c address change

I need to change an i2c address of an amphenol nova sensor NPA201 (pressure) using an stm32F407-discovery board.
An application note provided by manufacturer raises some questions.
According to the table, the one must set cpu's i2c module to master-receiver mode, and immediately send a byte to sensor. Is it even possible to do so?
May be i need to read reference manual one more time, buy as far as i know such situation is not described there.
Has anybody done the changing address procedure before?
table
Information for changing the address of the sensor can be found here Please note you can only change it three times. The default i2c address is 0x27.

why is it not possible to use mmap with socket fd as an argument?

i know it's not possible, i'm trying to understand the true reason behind it OS wise
Because the concept of a socket simply doesn't map to the concept of a random-access in-memory array, which is the abstraction which mmap gives you. A file on a block-device (disk) usually allows random read/write access. This maps nicely to an in-memory contiguous array, which also gives you random read/write access.
A socket, however, is usually stream (or packet/datagram) oriented. Meaning, a stream of data gets sent over the socket, and a stream of data is received from the socket. But you can't, for example, write/read to the Nth byte of an open socket stream - that simply doesn't make any sense conceptually.
In fact it is possible with some protocol families in linux, namely:
PF_NETLINK
PF_PACKET
For the rest of protocols mmapping is not implemented/possible. For example PF_INET
The mmap system call for socket gets dispatched here
See also:
Documentation/networking/packet_mmap.txt
There is whole thing called packet mmap. Search on google. There is program example in elixir maintained and doc page with example. Just search
Program link in kernel source maintained to view
https://elixir.bootlin.com/linux/v3.14.32/source/tools/testing/selftests/net
Tutorial
https://www.kernel.org/doc/html/latest/networking/packet_mmap.html
What is it. Use socket fd with mmap. So mapping socket to rx and tx descriptor in device driver.
To understand more about device descriptors u can look at this code https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/realtek/r8169_main.c in case anyone is are curious and stumble upon this page and linux device drivers pdf

USB windows xp final USB access issues

I basically understand you C++ people, Please do not get distracted because I'm writing in Delphi.
I have a stable USB Listing method that accesses all my USB devices
I get the devicepath, and this structure:
TSPDevInfoData = packed record
Size: DWORD;
ClassGuid: TGUID;
DevInst: DWORD; // DEVINST handle
Reserved: DWord;
end;
I get my ProductID and VenderID successfully from my DevicePath
Lists all USB devices connected to the computer at the time
That enables me to access the registry data to each device in a stable way.
What I'm lacking is a little direction
Is friendly name able to be written inside the connected USB Micro chips by the firmware programmer? (I'm thinking of this to identify the device even further, or is this to help identify Bulk data transfer devices like memory sticks and camera's)
Can I use SPDRP_REMOVAL_POLICY_OVERRIDE to some how reset these polices
What else can I do with the registry details.
Identifying when some one unplugs a device The program is using (in windows XP standard)
I used a documented windows event that did not respond.
Can I read a registry value to identify if its still connected?
using CreateFileA (DevicePath) to send and receive data
I have read when some one unplugs in the middle of a data transfer its difficult clearing resources.
what can IoCreateDevice do for me and how does one use it for that task
This two way point of connection status and system lock up situations is very concerning.
Has some one read anything about this subject recently?
My objectives are to
1. list connected USB devices
identify a in development Micro Controller from everything else
send and receive data in a stable and fast way to the limits of the controller
No lock up's transferring data
Note I'm not using any service packs
I understand everything USB is in ANSI when windows xp is not and .Net is all about ANSI
(what a waste of memory)
I plan to continue this project into a .net at a later date as an addition.
MSDN gives me Structures and Functions and what should link to what ok but say little to what they get used for.
What is available in my language Delphi is way over priced that it needs a major price drop.
I found the registry DEVICE_INSTALL_STATE with :-
InstallStateInstalled = 0,
InstallStateNeedsReinstall = 1,
InstallStateFailedInstall = 2,
InstallStateFinishInstall = 3
I ask the question of how fast is the updated response and if their is a better way to do this
Lex Dean