• ### Hex to (decimal?) bytes

I am trying to controll a Marshall PZT Camera with a raspi over rs422 over VISCA protocol. I think i can use [comport] but i don't understand puredata (anymore).
In the camera manual it tells me to send a string of HEX numbers 8x 01 04 3F 02 01 FF but with comport i can send bytes as decimal numbers. I dont understand how to convert these.
Does anyone has experience or understands how to do this?

• Posts 13 | Views 176
• puuh, thank you all, i will try to see through all of this. The system is very hard to debug for, 'cause the Camera is either moving or not. And there are a few stepping stones on the way..

• @alexandros Very good.....
So...... simple.....
David.
([f] converts from Pd 0.48 onwards.)

• well, @whale-av, @alexandros, i thought that the conversion of [list fromsymbol] is what i need 'cause with print i get the bytes to send? I only understand half, so is it for you possible to follow what i mean:

[FF(
|
[list]
|
[list fromsymbol]

{bundle bytes and send to device}

• @Johnny-Mauser Yes, I thought so at first.
But it returns the ASCII decimal values for example of the characters D and E separately...... list D E
What is needed is the decimal value of the 8-byte HEX DE.
There is no decimal ascii value for a character DE as the character does not exist.

It would be possible using [list fromsymbol] and some maths but it is complicated because when the list is split using [list split 1] the second outlet continues to output the remembered 2nd value (E) when there is no new value....... i.e. for decimal 0 to 15 (HEX 00 to 0F).
David.

• The device manual demands this Hex numbers:
81 01 04 3F 02 01 FF
as far as i understand now this is the list i need to send:
129 1 4 63 2 1 255
i didn't find a universal solution in your answers, but followed this table, which also shows the bits and therefore i beginn to understand a little bit more..

• If I understand what you say, your issue is that the "print" messege sent to [comport] translates values to ASCII, right? In that case, you can send raw bytes without the "print" message. Just send a list of values that you pass through the [f ] object and you should be fine.

• @alexandros, no. I send the numbers directly allready now, like shown in the [comport] help patch. My camera is still not moving.

• @Johnny-Mauser What about the serial port stuff like baud rate, start & stop bits, etc? Is that all set to what the camera expects? Do you have the right port #?

• @Johnny-Mauser What @jameslo says and.....
So the first message.....81 01 04 3F 02 01 FF..... recall preset 3 on camera 1..... does preset 3 exist....... Is the camera set as camera 1?
Does an error message come back from the camera?
Have you thought of doing it over IP..... ethernet?
Does the camera have the firmware upgrade (around year 2019) that enables HEX commands?

But I wonder if a text string would in fact work........ [print 81 01 04 3F 02 01 FF( ....into comport.
...... and.... hard to find..... but do you have noise from a bad ground or a bad power supply?
RS422 is balanced, but if there is a lot of noise coming from the device balancing will not help.
David

Posts 13 | Views 176
Internal error.

Oops! Looks like something went wrong!