We have the NCD ethernet receiver too. We have customer using PAC R1 with ncd, we were having some issues on the data prasing, so I was working on rewriting the prasing code. As both epic and pac r1 has same chart for ncd data prasing. Our customers have options to pick between ethernet and serial. Ethernet is most preferred for epic verson. But older pac r1 customers we are sticking with serial only.
I have a similar problem as an OP but can’t use Unpack string function (developing the code in PAC control 8.5, don’t ask why).
what would be the best way to convert the string I receiving to string of HEX characters without this function. Basically I’m trying to implement Unpackstring subroutine myself.
So far my code:
for nIndex = 0 to (GetStringLength(s2unpack)-1) step 1
GetSubstring(s2unpack, nIndex, 2, sCharacter);
nCharacter = HexStringToNumber(sCharacter);
NumberToStringField(nCharacter, 2, sCharacter);
sString = sString + sCharacter;
next
It looks like you are getting and decoding two hex characters at a time?
If that’s the case, you should probably be using step 2, not step 1 — so that you’re avoiding overlapping every other character in the original string data.
Can you test that and see if it makes any difference?
Can you give an example of the s2unpack value you’re working with? Also, can you confirm the lengths of s2unpack and sCharacter? Just trying to cover all bases.
as I read it in the HEX window. What I want it to read it and have an actual string like that.
The problem is that 02 and 16 are not printable characters, and I do not know how to convert that I read into the string.
I need the same function in PAC 8.5 (it came to PAC control in later versions), and trying to implement myself subroutine that would do the same function but will work in 8.5.