WC32: is there a variable containing IP address obtained by DHCP?

There is none of that at this point. IP address can be displayed on the status.xml, but that is a string, can be queried over html protocol. That string is not operator inside PLC.
 
We can add that to the firmware, if there are requests for it.
 
CAI_Support said:
 IP address can be displayed on the status.xml, but that is a string, can be queried over html protocol.
 
But.... in order to request the status.xml file, you need to know the IP address already!
 
Rossw,
 
I am sure system operators always know the IP address of the board. I though what he wanted is to display the IP address on the USB LCD display through PLC program. Currently, there is no method to do that to send board IP addr into any variable inside PLC.
 
Is there any other need for this IP address in PLC coding?  If that is only for send to LCD, it could be easier directly format that into text string and let user set the LCD buffer with it.  However, if there any other use, then it would be more useful to have four groups of integer or unsigned char.
 
An ugly brute force approach is to statically assign the address, and embed that knowledge info in your code.
 
Personally I statically assign the address of all the WebControl devices on our LAN so that don't move around.
 
/tom
 
CAI_Support said:
Is there any other need for this IP address in PLC coding?  If that is only for send to LCD, it could be easier directly format that into text string and let user set the LCD buffer with it.  However, if there any other use, then it would be more useful to have four groups of integer or unsigned char.
 
that's the idea: display on LCD the IP@ configured (statically/dynamically DHCP) of WC board. 
could be via PLC specific command or why not de facto in bootloader, display it few seconds without specific PLC code
 
Thomas
 
Because most boards do not have LCD module connected to its USB ports. Also bootloader portion only for update firmware, it does not have USB driver inside to make it too big.  Since WC32 has large amount ram and eeprom, so we could add that to the firmware to allow users with LCD module to display it through PLC commands
 
An IP address is just an unsigned 32-bit number.
Surely, even on WC8, it should be possible to have a variable (name) that references the current device IP address
Eg, on boot-up,
   set var1 ipaddr  # get my address
   set var2 123      # my unique ID
   email em1          # report it
 
The way I do it on my own devices, is I have them "wake up", set the time, and once they're alive they do a "webset" to call in to a server that they're online.
I typically store a unique ID for this device in one of the URAM variables.
The server can see the IP address of the request, and can now map the IP and device ID.
(This doesn't work so well when the device is behind a NAT device, and the server isn't, and other trickery needs to be done!)
 
I think what he wants to do is to display the IP address on the UM216 LCD or any I2C based LCD.   That way, his product can let user to use that information for future configuring the device.  We need to think the best way to support that feature, since it is useful for many users.
 
CAI_Support said:
I think what he wants to do is to display the IP address on the UM216 LCD or any I2C based LCD.   That way, his product can let user to use that information for future configuring the device.  We need to think the best way to support that feature, since it is useful for many users.
 
Using my above example, one could easily
 
set ram1 ipaddr  # get my address
 
Then, concatenate RAMB10,  ".", RAMB11, ".", RAMB12, ".", RAMB13
and print.
Ie, make the dotted-quad from the 4 bytes of the 32-bit unsigned that is the IPv4 address.
 
This means one, single enhancement - adding "ipaddr" as a variable, can be used in any number of ways/places, is consistent, can easily be back-ported to WC8 to provide benefits there too...
 
Thanks for that suggestion.  On WC8, it can reference to that IP address also, just don't have that UM216 supported concatenation and print functions.
 
CAI_Support said:
Thanks for that suggestion.  On WC8, it can reference to that IP address also, just don't have that UM216 supported concatenation and print functions.
 
The significant thing is that it makes one, consistent way to get the address.
You don't then have to add something "special" in the UM216 routines just to handle display of an IP address, by being able to get it, it can be used however (eg, only showing the last octet if that's all that's relevant to you!). More flexible, and should be easy to code. A "variable" like "ipaddr" can just be a pointer to the same memory as the actual IP address buffer. Heck, perhaps even make it read/write - a board could then set its IP address. Might make for "self-sensing, auto-fail-over" networks where one webcontrol board can sense that its peer has "died" and take over its address!
 
IPaddr is stored in the EEPROM. Read and write are all possible, especially on WC32. However, the Ipaddress we normally saw might not be the same byte order it would display, since big ending and little ending differences.  To be able to display them in its internal storage order is the only to display them on WC8, since it does not have RAM for another set of IP address. To make PLC code as much compatible as possible between WC8 and WC32, we will display native storage byte order for IP addr.  Is that okay?
 
Surely the IP address isn't stored in eeprom when it's DHCP assigned, is it?
Byte order could be big-endian or little-endian, I doubt there would be any real concern one way or the other, as long as it was understood/stated.
 
Back
Top