Report Bugs Here

Moderator: Mmiscool

User avatar
By marcomart
#63350 Hello.

How I can compose a string with single instructions like chr(num)?
Is it the following right in syntax matter?

bla = chr(65) & chr(66) & chr(67)

I was trying to pass from esp module to vb program trough UDP a string that is composed by some byte that should reflect some IO states like the following:

bla = chr(1) & chr(10) & chr(3)

but from the vb side I get only the first byte.


Thank You.
Marco.
User avatar
By Mmiscool
#63351 The syntax you are using is correct.

the problem may lie in the fact that you are using characters under 32.

Why not just send as a string?
User avatar
By marcomart
#63352 Hello.

Might be I got the matter, is actually chr(0), I just tried it and the string will get truncated at the chr(0), I think because the 0 is use to terminate the string parsing. I compose already a string but the problem is that if I
deal for example with modbus protocol a lot of times it will use the zero as returning value from coil or registers, by the way here below what's going on:

bla = chr(1) & chr(2) & chr(3) & chr(4) & chr(5) ' i got it right
bla = chr(1) & chr(2) & chr(0) & chr(4) & chr(5) ' i got until chr(2) so 12 the rest will be truncated
User avatar
By Mmiscool
#63354 Can you send a string over instead of the characters.

Code: Select allbla = str(1) & "_" & str(2) & "_" &  str(0) & "_" &  str(4) & "_" &  str(5)