I have a subroutine that opens a TCP pipe to an Ethernet device. The process for the subroutine is:
Open a TCP pipe to the ethernet device
Send a command string to the device.
Check for a waiting return value using GetNumCharsWaiting()
Get the string using the ReceiveNChars() command. Using the number of characters returned above as an argument to the ReceiveNChars() command.
When I step into the subroutine in debug mode it returns the correct number of characters. When I step over the subroutine it returns a 0 as the number of characters waiting.
Is the subroutine parameter holding the number of characters a literal or a variable? If you want to see the value from the subroutine it needs to be setup as a variable.
The number of characters is a variable within the subroutine; it is not passed out of the subroutine. The subroutine uses this value to receive a string with ReceiveNChars() that is passed out of the subroutine; the parameter passed out of the subroutine is a variable string.
So I assume you are calling GetNumCharsWaiting in the subroutine? In debug, once you step out of the subroutine, you can no longer see any of the variables inside it.
No, that’s not what I’m seeing. When I step into the subroutine GetNumCharsWaiting returns a proper value. When I step over the subroutine GetNumCharsWaiting will return a 0 value, an incorrect value, for the number of characters waiting. In both cases, GetNumCharsWaiting is called from inside the subroutine.