News:

  • November 23, 2026, 11:48:05 AM

Login with username, password and session length

Author Topic: Strings in UDT  (Read 27811 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Strings in UDT
« Reply #15 on: November 06, 2020, 09:56:10 AM »
Sorry, that really wasn't clear. It's in regards to what can be done with UDTs. Let me clarify:

After creating a UDT and assigning it to a memory location I would like to be able to use that UDT with the MRX command to write the modbus value into. For example:

Read address 40001, two consecutive registers --> store in MyUDT.Real. At current time if I try to do this I get the error message: Do-more Element not valid for the given Modbus Function: Cannot be a structure or structure field.

This is related to this post in that I would like to store the string in the UDT and the read modbus value into the UDT. I now have to create my UDT, create a helper string array and now create a helper real array to store read modbus values. 

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #16 on: November 06, 2020, 10:26:15 AM »
Sorry, that really wasn't clear. It's in regards to what can be done with UDTs. Let me clarify:

After creating a UDT and assigning it to a memory location I would like to be able to use that UDT with the MRX command to write the modbus value into. For example:

Read address 40001, two consecutive registers --> store in MyUDT.Real. At current time if I try to do this I get the error message: Do-more Element not valid for the given Modbus Function: Cannot be a structure or structure field.

This is related to this post in that I would like to store the string in the UDT and the read modbus value into the UDT. I now have to create my UDT, create a helper string array and now create a helper real array to store read modbus values.

Ah, makes sense.

I don't think there is any inherent limitation that would prevent this. This isn't the first request we've had for targeting portions of structure in comm functions. We'll look at it.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Strings in UDT
« Reply #17 on: November 06, 2020, 04:27:50 PM »
Also, tried MOVE(MyUDT[InderectReference].Float:UW0 to V0). This doesn't work. Don't know if this is related or not to this conversation.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #18 on: November 06, 2020, 04:47:27 PM »
Also, tried MOVE(MyUDT[InderectReference].Float:UW0 to V0). This doesn't work. Don't know if this is related or not to this conversation.

You can't cast a struct field. The limitation is in how DmD stores element references, there isn't enough space.

We are looking at relaxing the some of the restrictions on source and destination for MRX/MWX/MEMCOPY/etc. Please understand that the reason for the limitations was to keep users from doing things they will probably regret. We now realize that while those limitations needs to stay in place for built-in structures, we can easily relax them for UDTs.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

etElMadr

  • Full Member
  • ***
  • Posts: 37
Re: Strings in UDT
« Reply #19 on: November 19, 2021, 05:44:06 PM »
Quote
Not easily enough to sneak into 2.8 (next month), but barring unforeseen gotchas, I'd guess summer for the next release.
Any updates regarding the ability to add Strings in UDT?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6180
  • Yes Pinky, Do-more will control the world!
Re: Strings in UDT
« Reply #20 on: November 19, 2021, 06:50:01 PM »
Any updates regarding the ability to add Strings in UDT?

Support for full nesting of structures, including strings, will be in  2.9, due out next month.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Strings in UDT
« Reply #21 on: November 19, 2021, 07:21:48 PM »
Also, tried MOVE(MyUDT[InderectReference].Float:UW0 to V0). This doesn't work. Don't know if this is related or not to this conversation.

Not sure if IndirectReference is a V register or an expression, but only a V  or V + offset can be used as an index in any instruction other than MATH.

How about MEMCOPY instead of MOVE? (bearing in mind your index can only be a V  or V + offset for the same reason)   I't's just shuffling bit and bytes so it might be a little less picky.  AND, with MEMCOPY, you wouldn't need to cast because you specify the length of the copy in the instruction.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Strings in UDT
« Reply #22 on: November 19, 2021, 07:23:31 PM »
Support for full nesting of structures, including strings, will be in  2.9, due out next month.

Awesome, thank you!   8)
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.