for some time in Met/Cal the processing of special characters was activated.
For device control with the FSC IEEE or PORT, I use the byte streaming in some cases.
Under the use of strings, this was easy before activation.
The string I can variably byteweise with itoc (ASCII value) put together and send it to the bus.
After the activation, this method only works for ASCII values from 1 to 127. The ASCII value of 0 must be processed separately. Starting at value 128, the special characters begin. Since itoc (128) becomes a Multicharacter. In this case, it has a length of 3 bytes. Now fail my procedure.
The following example shows the conversion. The determination of the ASCII value of a special character with ctoi (multibyte_character) is not possible.
1.001 MATH nChr = 127
1.002 MATH Chr = ITOC(nChr)
1.003 MATH len = LEN(Chr)
1.004 MATH nDest = CTOI(Chr)
1.005 MATH nChr = 128
1.006 MATH Chr = ITOC(nChr)
1.007 MATH len = LEN(Chr)
1.008 MATH Chr1 = SUB(Chr,1,1); nChr1 = CTOI(Chr1)
1.009 MATH Chr2 = SUB(Chr,2,1); nChr2 = CTOI(Chr2)
1.010 MATH Chr3 = SUB(Chr,3,1); nChr3 = CTOI(Chr3)
1.011 MATH nDest = CTOI(Chr)
1.012 MATH chr128 = "Ç"
1.013 MATH len = LEN(chr128)
1.014 MATH Chr1 = SUB(chr128,1,2); nChr1 = CTOI(chr128)
1.015 MATH Chr2 = SUB(chr128,2,1); nChr2 = CTOI(chr128)
1.016 MATH nDest = CTOI(chr128)
As a solution I see only the use of a Win32 function (DLL), which takes over the conversion and the data in an intermediate file. The content can be sent in Met/Cal on the bus.
Does anyone have a better solution?
Please sign in to leave a comment.