Hi Thomas,

I've been watching the awesome stuff you've been doing. Finally getting my 
rookie C code into shape ... thanks a lot for this and a very warm welcome here 
on the list. 

If you want, I could give you a video-call introduction to our code generation.

I have to admit, I was a bit worried as I saw in your PR that there were 
generated files updated (If we don't yet generate that comment Jetbrains IDEs 
react on, we definitely need to do that) ... we need to find a way to get these 
changes back into the code generation templates.

Bur regarding your question:
No, we can't change that to uint 16 as in the S7 protocol this size is defined 
as a uint 8 (one byte unsigned int)

        ['0x04','0x03' S7ParameterReadVarResponse
            [simple uint 8 'numItems']
        ]

So, if we would increase that to uint 16 the drivers wouldn't work anymore. 
However this means that you can never request more than 255 elements of an 
array anyway. 

Hope this helps,
       Chris

-----Ursprüngliche Nachricht-----
Von: Thomas <[email protected]> 
Gesendet: Donnerstag, 15. April 2021 16:58
An: [email protected]
Betreff: Re: PLC4c: What I'm up to in PR#233

Hi all,

In PLC4c generated sources s7_var_payload_data_item.c:68 can we change the 
uint8_t itemCount variable to a uint16_t. This becomes a problem when we read 
reasonably big items (256B but still within PDU limits).

I ask as I'm not sure how the generated sources are actually generated. Maybe 
there is some documentation on it?

Thanks,
Thomas

Sent with [ProtonMail](https://protonmail.com) Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, 13 April 2021 11:49, Thomas <[email protected]> wrote:

> Hi all,
>
> Re [PR233](https://github.com/apache/plc4x/pull/233). I aim to use PLC4c with 
> digital twins (codegen'd Simulink models) for metal industry and have it talk 
> to Siemens S7 PLCs. Currently use a customized version of libnodave but PLC4x 
> is interesting as it (eventually) works with multiple PLCs & has a C 
> implementation.
>
> In PR233 I have added a loopback test (write values->read them back -> check 
> they match). That's all I need for above use case. To do this I will/did:
>
> - Added write functionality (as in PR) this took a fair bit of time, mostly 
> getting to understand the existing code/datatypes/debugging slowly
> - this morning added error checking to the write responses.
> - I see the read responses are not really checked so I will add this
> - Will check/chase any memory leaks
>
> That's all. After that a few tests in MATLAB/Simulink. If that goes well I 
> can probably help on other protocols in PLC4c.
>
> Cheers,
> Thomas

Reply via email to