Mark Whitt
Member
Hello Folks!
I'm still trying to get the hang of using STL and Pointers in Step 7 (V5.5).
For background, I'm writing a sample application that our customers can use for reference in the case where they will be using one or more of our weigh terminals in their process. This requires that they read a block of input words from the device and generate a checksum from them to compare against the checksum that the device itself is sending.
In the case where there are more than one of these devices on the ProfiBus network, I'd like to send the starting Input address to the checksum routine and have it calculate the checksum for any device submitted. This requires the passing of a pointer or Any Pointer to the FC function that I've written.
The function works fine if I hard code the starting Input address into the function itself. But when I try to pass the address via a pointer, things no longer work, and I'm at a loss to figure out why.
Additional background is that I try to write the samples using ladder logic where possible to make them easier to understand for as many people as possible, and then switch to STL when necessary because that's what is available to everyone by default.
Here's a picture of the routine that calls the checksum function:
And here is a picture of the checksum routine itself:
I know that the Any Pointer in the calling routine is set for a size of 2 Bytes, which is wrong. But I've tried other sizes (240, 224, and so on) with the same results.
I'm sure the problem is something simple, but at this point my eyes are crossing and I'm just not seeing it. So, any help would be appreciated.
Thanks in advance!
Mark
I'm still trying to get the hang of using STL and Pointers in Step 7 (V5.5).
For background, I'm writing a sample application that our customers can use for reference in the case where they will be using one or more of our weigh terminals in their process. This requires that they read a block of input words from the device and generate a checksum from them to compare against the checksum that the device itself is sending.
In the case where there are more than one of these devices on the ProfiBus network, I'd like to send the starting Input address to the checksum routine and have it calculate the checksum for any device submitted. This requires the passing of a pointer or Any Pointer to the FC function that I've written.
The function works fine if I hard code the starting Input address into the function itself. But when I try to pass the address via a pointer, things no longer work, and I'm at a loss to figure out why.
Additional background is that I try to write the samples using ladder logic where possible to make them easier to understand for as many people as possible, and then switch to STL when necessary because that's what is available to everyone by default.
Here's a picture of the routine that calls the checksum function:
And here is a picture of the checksum routine itself:
I know that the Any Pointer in the calling routine is set for a size of 2 Bytes, which is wrong. But I've tried other sizes (240, 224, and so on) with the same results.
I'm sure the problem is something simple, but at this point my eyes are crossing and I'm just not seeing it. So, any help would be appreciated.
Thanks in advance!
Mark