Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Bolt on December 04, 2021, 12:23:11 AM

Title: IP Addresses and UDT's
Post by: Bolt on December 04, 2021, 12:23:11 AM
When I create a field in a UDT called UDT.OtherPLCIP, and type it as an IP Address, it will not let me edit it (fully) in a Status Data View, as it caps the value at 2147483647.  (I also can't do UDT.OtherPLCIP:UB0-3, but I knew that). Even if I create it in D0:UB0-3, I can't copy the result to UDT.OtherPLCIP, as it's typically over 2147483647.  I have not tried programmatically copying D0 to UDT.OtherPLCIP, I just replaced all instances with D0 and went on with my life.
Title: Re: IP Addresses and UDT's
Post by: Greg on December 04, 2021, 03:19:47 PM
When I create a field in a UDT called UDT.OtherPLCIP, and type it as an IP Address, it will not let me edit it (fully) in a Status View, as it caps the value at 2147483647.  (I also can't do UDT.OtherPLCIP:UB0-3, but I knew that). Even if I create it in D0:UB0-3, I can't copy the result to UDT.OtherPLCIP, as it's typically over 2147483647.  I have not tried programmatically copying D0 to UDT.OtherPLCIP, I just replaced all instances with D0 and went on with my life.

I use INIT instruction to do this. There you can enter, for example, as the Value, 0xFFFFFF00 for 255.255.255.0 (e.g. a subnet IP).

You can use MOVE instruction or a COPY instruction to copy, say, from UDT.OtherPLCIP --> D0, or vice versa.
Title: Re: IP Addresses and UDT's
Post by: Bolt on December 05, 2021, 12:50:19 AM
But I'm looking for a way to edit things without having to modify the program in the PLC.  I go to a convertor, such as https://www.silisoftware.com/tools/ipconverter.php and enter the IP, paste the integer to a status data view field, and write it to memory.
Currently the only way I have found to status write an IP Address greater than 127.255.255.255 to a UDT field (with a default display format of IP Address), is to put a D0 in a status data view, change the display to IP Address, paste the integer to edit, write it to D0, then have a delta contact on D0 copy it to UDT.IPAddress.  Kinda kludgy.
There's something in your status data view display settings that is letting a D0 status set to IP Address be written with a 32 bit unsigned integer, but once it's a DWORD UDT field as IP Address, it reverts to a 32 bit signed integer as the edit field.
Title: Re: IP Addresses and UDT's
Post by: Greg on December 06, 2021, 09:19:44 AM
You can use Change Value dialog. It has an IP Address format. To pull up Change Value you can press the <Value> button on the Online Toolbar, or select, Debug --> Change Value from the menu, or, if you are not in the Edit mode, just double-click the Element.
Title: Re: IP Addresses and UDT's
Post by: Greg on December 06, 2021, 09:34:14 AM
Another thing you can do, if, for example, you are using, say, D10 as an IP address, and you have it in a Data View, you can click on it (so that it receives focus), and then press the <Value> button on the Online Toolbar, and it will pull up the Change Value dialog. Then you can select the "IP Address" as the Format, enter in your IP address, and press the Write to the PLC button out beside it, and it works too.

You cannot edit the Element value in an IP address format from Data View itself yet, but the above is a way to do it anyways.
Title: Re: IP Addresses and UDT's
Post by: franji1 on December 06, 2021, 09:45:07 AM
Another thing you can do, if, for example, you are using, say, D10 as an IP address, and you have it in a Data View, you can click on it (so that it receives focus), and then press the <Value> button on the Online Toolbar, and it will pull up the Change Value dialog. Then you can select the "IP Address" as the Format, enter in your IP address, and press the Write to the PLC button out beside it, and it works too.

You cannot edit the Element value in an IP address format from Data View itself yet, but the above is a way to do it anyways.

And if you are a keyboard person, whatever current element has FOCUS, Ctrl+Shift+F2 brings up the Change Value dialog.  Doc Editor, focus on D5 row, Ctrl+Shift+F2 - Change Value dialog with D5.  Data View, focus on IPAddresses3.IPAddress1, Ctrl+Shift+F2 - Change Value dialog with IPAddresses3.IPAddress1 UDT structure field
Title: Re: IP Addresses and UDT's
Post by: BobO on December 06, 2021, 09:51:50 AM
Probably need to get IP editing supported in DataView, but I generally switch the format to BCD/HEX to set IP addresses.
Title: Re: IP Addresses and UDT's
Post by: Bolt on December 06, 2021, 10:43:53 AM
Another thing you can do, if, for example, you are using, say, D10 as an IP address, and you have it in a Data View, you can click on it (so that it receives focus), and then press the <Value> button on the Online Toolbar, and it will pull up the Change Value dialog. Then you can select the "IP Address" as the Format, enter in your IP address, and press the Write to the PLC button out beside it, and it works too.

You cannot edit the Element value in an IP address format from Data View itself yet, but the above is a way to do it anyways.

And if you are a keyboard person, whatever current element has FOCUS, Ctrl+Shift+F2 brings up the Change Value dialog.  Doc Editor, focus on D5 row, Ctrl+Shift+F2 - Change Value dialog with D5.  Data View, focus on IPAddresses3.IPAddress1, Ctrl+Shift+F2 - Change Value dialog with IPAddresses3.IPAddress1 UDT structure field

I like these solutions here.  Now only if it defaulted the format to what the UDT Default Display Format is set to, but no big deal.  Thanks!
Title: Re: IP Addresses and UDT's
Post by: Bolt on December 06, 2021, 10:46:40 AM
Probably need to get IP editing supported in DataView, but I generally switch the format to BCD/HEX to set IP addresses.

BCD/HEX works to input (a "large") to an UDT.IPAddress

EDIT: I just noticed, if you take UDT.IPAddress in a status data view and change it to "Smart Native", it will let you input a unsigned 32 bit decimal number as an input.  So that answers my original question, but the Ctrl + Shift + F2 from Franji1 is the most user friendly way I see right now.

Now, can we PLEASE have "regular" Ctrl + C, Ctrl + V functions from Status Data View windows?  Pretty please?
Title: Re: IP Addresses and UDT's
Post by: franji1 on December 06, 2021, 10:49:56 AM
Now only if it defaulted the format to what the UDT Default Display Format is set to, but no big deal.  Thanks!

I saw that too.  We'll look at Change Value dialog supporting struct Field Format initially
Title: Re: IP Addresses and UDT's
Post by: franji1 on December 07, 2021, 10:33:36 AM
I saw that too.  We'll look at Change Value dialog supporting struct Field Format initially

Implemented - it will be in the next release.  Basically, whenever you enter an element, if it has a defined display format, Change Value will automagically select that format over the default "decimal" format.  You can still change that element's format via the radio buttons, but the default will be the desired format.

So when you enter "T42.Acc" in the Change Value dialog, it defaults to a Timer display/edit format (e.g. 2h 3m 4.567s instead of 7384567 decimal number of milliseconds).  See the attached screen shot.
Title: Re: IP Addresses and UDT's
Post by: Controls Guy on December 07, 2021, 11:20:35 AM
Nice!   Thanks!    8)
Title: Re: IP Addresses and UDT's
Post by: Bolt on December 07, 2021, 11:38:16 AM
I saw that too.  We'll look at Change Value dialog supporting struct Field Format initially

Implemented - it will be in the next release.  Basically, whenever you enter an element, if it has a defined display format, Change Value will automagically select that format over the default "decimal" format.  You can still change that element's format via the radio buttons, but the default will be the desired format.

So when you enter "T42.Acc" in the Change Value dialog, it defaults to a Timer display/edit format (e.g. 2h 3m 4.567s instead of 7384567 decimal number of milliseconds).  See the attached screen shot.

Excellent, thank you!

I'll keep waiting semi-patiently for the Ctrl+C and Ctrl+V to work in the Data Views.  Status (copy only) and Edit columns please!