On Mon, 2012-02-27 at 19:48 +0000, Chris Morley wrote:
> 
> > 
> > There may be a function that can look this up, but I think it's hard for
> > the API to know what network the app needs to use, although 99% of the
> > time the host has a single Ethernet port making the practical choice
> > easy. I got the libmodbus 3 unit-test demo to work by just doing a
> > ifconfig to to get my IP address and plugged that in. That's all that
> > was needed. RTU over TCP is probably a different story. My LinuxCNC
> > master could send queries just fine, but the unit-test slave isn't set
> > up to return anything interesting. Successes for unit-test demo seems to
> > be a lack of error messages.
> > 
> 
> CL requires the address and the port number (9502 id default).
> I somewhat understand the address but not really the port number.
> Can you elaborate how you found this info? keep in mind I have 
> almost no knowledge of networks other then plugging in my ethernet cable
> in to my cable internet router. :)
> 
> Chris M  

I'm not sure of the proper terminology and I'm learning as I go, but
each network node or Ethernet connection has an address like
192.168.1.10, then services that can be provided on a network node have
a port number. So when LinuxCNC makes a request it gets routed to the
network card that has the proper address, then the card routes the
request to the proper service by using the port number. If the request
was for an HTML web page or FTP file transfer, the address would be the
same but the port number would be different. ModbusTCP seems to have a
default address of 502, but it really could be anything. Addresses above
1000 are handled with fewer restrictions, the libmodbus demo selects
port 1502 so the demo doesn't need to be run as root. You can see active
ports of services your computer is providing from the desktop here:
System > Administration > Network Tools > Netstat > Active Network
Services

For libmodbus 3 it seems the slave address(es) needs to be determined
and entered in both the master component, so the master knows which
slave to talk to, and the slave driver, so the slave knows which
Ethernet card and service port to listen to for requests. libmodbus has
a feature called ModbusTCP/IP that can use a hostname to find the
network address, but I haven't looked into it yet.

There is another variation of ModbusTCP for using Ethernet to serial
port bridges where the network information and the serial port
information need to be included within the Modbus packet in order to
find the proper slave.

-- 
Kirk Wallace
http://www.wallacecompany.com/machine_shop/
http://www.wallacecompany.com/E45/index.html
California, USA


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to