Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue MID 0245 #77

Closed
tecnologic-srl-roberto-guerzoni opened this issue Sep 23, 2021 · 2 comments
Closed

Issue MID 0245 #77

tecnologic-srl-roberto-guerzoni opened this issue Sep 23, 2021 · 2 comments
Labels

Comments

@tecnologic-srl-roberto-guerzoni
Copy link

tecnologic-srl-roberto-guerzoni commented Sep 23, 2021

I'm using your excellent library to realize an Open Protocol Simulator. During my development i noticed an issue into MID 0245. I suppose the issue derive from a wrong cut and paste.
In my opinion the code should be fixed into this point

    public class Mid0245 : Mid, IPLCUserData, IIntegrator
    {
        private readonly IValueConverter<int> _intConverter;
        private const int LAST_REVISION = 1;
        public const int MID = 245;

        public int Offset
        {
            //old:get => GetField(1, (int)DataFields.USER_DATA).GetValue(_intConverter.Convert);
            //old:set => GetField(1, (int)DataFields.USER_DATA).SetValue(_intConverter.Convert, value);
			get => GetField(1, (int)DataFields.OFFSET).GetValue(_intConverter.Convert);
			set => GetField(1, (int)DataFields.OFFSET).SetValue(_intConverter.Convert, value);
        }

I'm not sure the USER_DATA field must be filled to 200 chars.
The documentation say:

Offset 21-23 Three ASCII digits Range 000-099Specify the address offset in number of bytes for theuser data in the PLC.The data is written to address 13000 + Offset in thePLC
User data 24-max 223 Minimum 2 and maximum 200 ASCII characters.See MID 0240 for a description.The maximum length for the field is 200 – 2 * Offset

Can you confirm the need of that padding?

Have a nice day

Roberto Guerzoni

@Rickedb Rickedb added the bug label Sep 23, 2021
@Rickedb
Copy link
Owner

Rickedb commented Sep 23, 2021

Hello Roberto, good to hear that the library is helping you.
Answering your questions:

  1. Offset field does have a bug and it was probably a copy + paste issue 😂
  2. About User data field: no, it's not obligatory to fill with 200 chars. In addition, the library (still) does not watch over the minimum and maximum values.

@tecnologic-srl-roberto-guerzoni
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants