Binary over rs232

Quick question… if I want to send binary data through the rs232 node (which only accepts strings), can I just type in the binary value as a string and send it or is there another conversion I can do somewhere?

Thanks for any help!

bump… no text …

what exactly do you mean by binary data? 0 / 1 bits?
note that the string it’s also just binary data in the end.

if you’d be a little more specific about what you want to send or what the receiver expects, one can for sure point to ways how to encode that info as a char or as strings

Hi woei

Thanks for getting back, an example of the ASCII string/HEX value/Binary that I need to be sending over rs232 looks like this:

String Command: sWN LMDscandatacfg 01 00 1 1 0 00 00 0 0 0 0 0 1

ASCII

sWN{SPC}LMDscandatacfg{SPC}01{SPC}00{SPC}1{SPC}1{SPC}0{SPC}00{SPC}00{SPC}0{SPC}
0{SPC}0{SPC}0{SPC}+1

HEX

02 73 57 4E 20 4C 4D 44 73 63 61 6E 64 61 74 61 63 66 67 20 30 31 20 30 30 20 31 20 31 20 30 20 30 30
20 30 30 20 30 20 30 20 30 20 30 20 2B 31 03

Binary

02 02 02 02 00 00 00 20 73 57 4E 20 4C 4D 44 73 63 61 6E 64 61 74 61 63 66 67 20 01 00 01 01 00 00 00
00 00 00 00 00 01 43

My question is just whether these values would be all sent as strings or if there’s any other way to format them. As in, if I want to send that block of hex values, or all those binary values at once via rs232 how does the string need to be formatted?

Many thanks again for your help.

i guess it really depends on what your receiver wants.
i think i remember with arduino for instance you can simply convert the value your sending to ascii via SpellValue. it will only read one byte at a time though, so you can only send values from 0 to 255.
if you can program whatever is receiving the data, you can probably do whatever you want. just have to convert it back to what you need on the other side…

Alright Light,

I’ve got a feeling that the HEX may give you the most accurate (if not most readable description of the code, but send it as an Ascii (byte) string.

As Veevee said, I’ve had a few occasions where manuals show commands written in HEX but in practice I’ve sent the commands in Byte form using Spellvalue (a few different projectors, Pharos LCP 1 for instance).

Have you been sending the device data and it isn’t interpreting it? Does it send back an error message in similar gobbledygook?
The HEX message example you put up there converts with some special empty symbols.

I’ve added a HEX converter in case its any help. The trick then will probably be to figure out which symbols should be constant and which you can change for your desired result.

Hayd

HEX Converter.v4p (24.8 kB)

oi,

i was kinda wondering because the ascii and hex/binary examples you gave don’t match.

so googling brought up this saying you can also send all your commands via plain ascii strings which is kinda convenient in v4.

if you want to have it hex / binary you have to start counting byte lengths and encode it after the prefix (kinda like osc does it)

and remember, just because vvvv udp node accepts only string, it’s still just bytes being sent. so binary data in vvvv shows up like a line of garbage string but you can send that too.

Ok thanks so much for helping on this, I’m jumping between a bunch of different projects at the moment but that’s really useful. I’ll try these suggestions tomorrow and hopefully get some results. The Sick engineers suggest using binary over anything else so that’s why I was asking about binary in particular.

Cheers