Forums > MaxMSP

How to pass the string '02' in Max 5?

Feb 08 2011 | 8:11 am

Hi folks,

We’re trying to control some projectors via the Max [serial] object and RS232, but have run into a snag with Max 5; our message MUST start with zero. Specifically, the syntax is: ’02 4F 4D 4E 03′ for instance. It cannot be ‘2 4F 4D’ etc., we’ve tried with other software. Seems straight forward enough, but with Max 5 every time we try to form the string ’02’ it gets abbreviated to ‘2’. Try typing ’02’ into a message box, umenu, whatever, the ‘0’ magically disappears. If we try to form the string on the fly, say with [sprintf 0%i] the zero gets knocked off, even though [sprintf 1%i] works as one would suspect. The only way we can pass the message ’02’ is if we put quotes around it, but then the [serial] object complains "Serial doesn’t understand "02 4F 4D 4E 03".

Any help MUCH appreciated. We’ve got a lot of equipment we want to control this way.


Feb 08 2011 | 9:11 am

serial accepts ints. It looks like what you want to send are hex values. So 0x02 is 2, 0x4f is 79, 0x4d is 77, etc.
Generally, the ints sent thru a serial port are ASCII values… (in ASCII 4f 4d 4e is the "OMN" string). So you may need to play with itoa/atoi.

Feb 08 2011 | 12:15 pm

Based on atoi this is a hex to int converter.

-- Pasted Max Patch, click to expand. --

Feb 08 2011 | 12:25 pm

The same thing, but with only one standard object (there are some funny nice features deeply hidden in Max):

-- Pasted Max Patch, click to expand. --

Feb 09 2011 | 3:25 am

Thank you gentlemen. That both explains well and solves the problem.



Feb 15 2011 | 6:24 pm

Hi Christopher
did you manage to get your patch working? I am doing the same exact thing with a panasonic projector and having difficulty getting it to work. I’ve done other rs-232 controls before in max but this one is frustrating me. my projector wants also wants STX and ETX at the beginning and end… in theory I am sending the integers to serial object as follows: 50 65 68 90 90 59 80 79 70 51 13

spelled out with itoa that means ‘2ADZZ;POF3’


– Johnny

Feb 15 2011 | 7:05 pm

Figured it out.. its like the above integer stream but ‘2’ and ‘3’ instead of 50 and 51

simple example patch attached :) It is quite literal, just figuring out the actual ascii codes to send, but with a little more work it could be made to do the translation of any command. BTW this is for Panasonic PT-Dxxxx series, some Panasonics do not require the AT ZZ for projector ID.


Feb 15 2011 | 10:08 pm

Once you get going its hard to stop :) I found a more detailed serial command doc digging around panasonics site, which allowed me to add more commands, such as lens zoom, focus etc etc. I also streamlined and switched to sprintf to format commands easier. new and improved enclosed


Apr 03 2011 | 12:14 pm


@Christopher: did you get it to work?

@all: I want to control a Kramer VP-88ETH Matrix with Max via RS232. I have a USB-Serial Converter from HAMA. Honestly I am not really firm with this kind of things, but thought it shouldn’t be too dificult. As I understand the manual of the Matrix, to switch for example Input 1 to Output 3 it needs the HEX code: 01 81 83 81
(the download page of the manuals:
(as for all the other controls, I have no idea).
Anyhow, I don’t get it to work at all. "Serial" doesn’t send hex-data, right? Any help on getting started is very appreciated!!
How do I even know, that the Matrix is receiving any data at all from the macbookpro?

Thanks a lot, rene

Viewing 9 posts - 1 through 9 (of 9 total)

Forums > MaxMSP