News:

  • May 17, 2026, 05:29:22 AM

Login with username, password and session length

Author Topic: PLC IP Address Problems  (Read 38530 times)

marc.turcotte

  • Jr. Member
  • **
  • Posts: 13
PLC IP Address Problems
« on: June 05, 2009, 01:23:38 PM »
Hi,

I've "randomly" set my PLCs to IP 192.168.10.1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 , but there are too many PLCs on the network and i don't want to scan these other PLC to get the device count. I don't really understand how to scan the network only for those PLCs...


Also, i tried changing IP to 192.168.13.1 / 2 .... but anything other than 192.168.10.X Doesnt work. I get multiple errors, but it read the mac address correctly though. As for the real EtherCCM, it doesnt work neither with 192.168.13.X ... it sees the good number of devices, but it doesnt show any details (DetailLines are emtpy)

so, anyone as a clue on how to query / scan network for certain PLCs Only?
Also, whats going on with the 192.168.13.X thing?

Thanks

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: PLC IP Address Problems
« Reply #1 on: June 05, 2009, 02:41:37 PM »
What is your subnet mask set to?
An output is a PLC's way of getting its inputs to change.

MikeS

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 261
    • Host Engineering, Inc.
Re: PLC IP Address Problems
« Reply #2 on: June 08, 2009, 11:41:21 AM »
the HEIQueryDevices() api will find all of the "Host Ethernet" devices on the local network. you will then have to process the array of devices that were found to filter out the ones you don't want. you can filter by device type (ECOM vs EBC vs WinPLC, vs etc.), or you can filter by IP address range, whatever you need. But you are correct in that with the Query functions you're going to see all of the possible Host Devices to pick from and you're going to have to decide which ones to work with.

optionally, if you don't want to query the network, you can talk directly to a specific ECOM (or ECOMs) by manually creating an HEIDevice structure for each ECOM that you want to talk and then call HEIopen with each of your HEIDevice structures. This skips the network querys but means you have to hard code the device information for each ECOM.

Good design costs a lot. Bad design costs even more.

marc.turcotte

  • Jr. Member
  • **
  • Posts: 13
Re: PLC IP Address Problems
« Reply #3 on: June 08, 2009, 01:21:23 PM »
Thanks , i totally forgot that i changed my IP to 192.168.10.50 (PC 10/100 Card)

Therefore, i just had to change 10 for 15 to query the PLCs .

Thanks!

Now everything works, i have functions such as : SetCValueON(CValue as string) thats sets a specific  C value ex : C550 , ON. taking in consideration all the other values around (i.e.: the surrounding values are kept)

SetCValueOFF(CValue)

WriteMultipleCValues(CValue#1,CValue#2, etc) that writes multiple C values that are / or aren't on the same V Map, all that without overwriting surrounding values.

IsCValueON(CValue) that tells me if a particular C value is on or off...

and so on!

Thanks again, without your help I wouldnt have been able to do all that.
Thanks for all your help.

swavek

  • Newbie
  • *
  • Posts: 6
Re: PLC IP Address Problems
« Reply #4 on: November 04, 2009, 04:46:52 PM »
the HEIQueryDevices() api will find all of the "Host Ethernet" devices on the local network. you will then have to process the array of devices that were found to filter out the ones you don't want. you can filter by device type (ECOM vs EBC vs WinPLC, vs etc.), or you can filter by IP address range, whatever you need. But you are correct in that with the Query functions you're going to see all of the possible Host Devices to pick from and you're going to have to decide which ones to work with.

optionally, if you don't want to query the network, you can talk directly to a specific ECOM (or ECOMs) by manually creating an HEIDevice structure for each ECOM that you want to talk and then call HEIopen with each of your HEIDevice structures. This skips the network querys but means you have to hard code the device information for each ECOM.



Mike,

Have you got a code sample for the later case where you want to talk directly to some ECOMs? (I am using HEI API version 3 on linux.)

Thanks,
Swavek

MikeS

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 261
    • Host Engineering, Inc.
Re: PLC IP Address Problems
« Reply #5 on: November 05, 2009, 10:33:14 AM »
here's some VB6 code that populates the HEIDevice structure

' If you'd rather not query the network for Host Ethernet devices, you can manually place the
' the required Ethernet information in the HEIDevice structure then call PASCAL_HEIOpenDevice
' just as you would after a query operation. The key is getting the required information into
' the correct places in the structure. Refer to the following example:
'
' aDevices(X).Address(0) = 2         ' Family= AF_INET
' aDevices(X).Address(1) = 0
 
' aDevices(X).Address(2) = &H70      ' ECOMs use Port number 7070(Hex)
' aDevices(X).Address(3) = &H70
 
' aDevices(X).Address(4) = 192       ' IP Address of the ECOM is 192.168.0.1
' aDevices(X).Address(5) = 168
' aDevices(X).Address(6) = 26
' aDevices(X).Address(7) = 100
Good design costs a lot. Bad design costs even more.

swavek

  • Newbie
  • *
  • Posts: 6
Re: PLC IP Address Problems
« Reply #6 on: November 05, 2009, 04:02:13 PM »
Thanks Mike, populating the address attributes of the HEIDevice struture is very straigh forward, indeed.

Now, the HEIDevice has quite a few other attributes. It looks like I would need to at least set BOOL UseBroadcast to False and HEITransport *_pTransport to my transport structure. Could you please comment comment on these two and any other attributes that need to have any specific default values (my guess is that I should mimick the defaults that the HEIQueryDevices assigns)?

Thanks,
Swavek

MikeS

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 261
    • Host Engineering, Inc.
Re: PLC IP Address Problems
« Reply #7 on: November 06, 2009, 10:03:53 AM »
I don't think you need to set anything else, just the three parameters in the sample. The remaining fields of the HEIDevice structure will be populated by the HEIOpenDevice call.

You should not have to set any more of the member fields like the HEIQueryxxx calls. Essentially what happens is the HEIQueryxxxx calls do a broadcast for HEI devices, then calls HEIOpenDevice for each one that responded. You're simply bypassing the broadcast query and going straight to the HEIOpenDevice call manually.
Good design costs a lot. Bad design costs even more.

swavek

  • Newbie
  • *
  • Posts: 6
Re: PLC IP Address Problems
« Reply #8 on: November 18, 2009, 03:19:05 PM »
Thanks Mike, it worked fine.

Swavek