DMX High Byte/Low Byte coding

Aug 26, 2007 at 8:15pm

DMX High Byte/Low Byte coding

Any links or info on how to split a data stream value out as two seperate High Byte and Low Byte channels on DMX? Tilt Pan value application with a range of 65535 which I am assuming is the bit depth of the two interleaved 255 values that dmx runs on.
Using Enttec products. I have all the regular DMX packing well in hand, just dont understand how to order the data from a single value to a split set of values of lower depth.

#33415
Aug 26, 2007 at 8:27pm

On 07-08-26, at 1315, piwolf wrote:
>
> Any links or info on how to split a data stream value out as two
> seperate High Byte and Low Byte channels on DMX? Tilt Pan value
> application with a range of 65535 which I am assuming is the bit
> depth of the two interleaved 255 values that dmx runs on.
> Using Enttec products. I have all the regular DMX packing well in
> hand, just dont understand how to order the data from a single
> value to a split set of values of lower depth.
>
Not sure if I understand you correctly, but I assume you’re using two
channels to send an unsigned short?

unsigned short pan = whatever;
char channel1 = (pan & 0xff00) >> 8;
char channel2 = (pan & 0xff);

r.

#111305
Aug 26, 2007 at 8:53pm

Yes I am sending to two channels each with a range or 0-255. There combination of values creates a range of 65535. The code excerpt you posted is intended for me to implement where? This is something I want to be constantly streaming update data to.
Are 0xff00 and 0xff the hex locations for most and least significant byte? I know char is a data type/object but give me the quick rundown on what type “unsigned short” is?

Thanks a ton!

brandon

#111306
Aug 26, 2007 at 10:43pm

On 07-08-26, at 1353, piwolf wrote:
>
> Yes I am sending to two channels each with a range or 0-255. There
> combination of values creates a range of 65535. The code excerpt
> you posted is intended for me to implement where? This is
> something I want to be constantly streaming update data to.
>
I don’t know what your DMX object looks like, so I have a hard time
advising here. If you want me to take a look at it you can send it to
me off-list. The DMX object I have accepts a number of channels at a
time as a list. I would probably implement the code I pasted upstream
to my DMX object, since it’s specific to one fixture, not the DMX
object itself. Consider the [expr] object.

> Are 0xff00 and 0xff the hex locations for most and least
> significant byte? I know char is a data type/object but give me
> the quick rundown on what type “unsigned short” is?
>
0xff00 and 0xff are bit masks. I recommend reading up on bit
operations, both masking and shifting.

http://en.wikipedia.org/wiki/Bitwise_operation#AND
http://en.wikipedia.org/wiki/Bitwise_operation#Shifts_in_C.2C_C.2B.2B.
2C_and_Java

I also recommend reading up on data types. An unsigned short in most
languages is an unsigned 16 bit value, giving a maximum of 65535. A
char is typically 1/2 a short, or 8 bits.

r.

#111307
Aug 26, 2007 at 11:02pm

Thanks man. Great help.

B

#111308
Sep 2, 2007 at 2:12am

So I understand the masking; and the variable types; and mostly the expression object but I am curious if I need to write an external or not. I take in the OSC float value from the lemur; then multiply it to get it into the range for the unsigned short, but Im not declaring an unsigned short, just an int in the range of one; then I tried to use the expression object to perform a masking function but the output I am getting is well beyond the range of an 8 bit value. I can see the problem from the math that I am sending in a higher bit depth variable even though I am in the value range I need to be. Is there a way to implement the masking without writing it in Visual Studio as an external? The only variable types I am familiar with declaring inside of max are the obvious, int,float,and symbol. What would be the cleanest and process friendly way of performing the split? Am I missing an obvious way with the max scripting to declare the bit depth of variables or should I do it in my external compiler? Thanks again!!

b

#111309
Sep 2, 2007 at 6:43am

On 07-09-01, at 1912, piwolf wrote:
>
> So I understand the masking; and the variable types; and mostly the
> expression object but I am curious if I need to write an external
> or not.
>
Who knows- we can’t read your mind. My guess is that if you can’t
already figure out what to do at this point, then writing an external
won’t help you.

This is what I gather is your question:

You have a lemur which is giving you a float value with some range
(input), and you want to convert it to an unsigned short to send over
DMX (output). This really means you need a high and low byte to send
over two DMX channels.

So just put the math I replied with previously into an expr and you
are good to go, no? If not, can you please restate your question in
such a way that we don’t need to assume we know what you are doing.

max v2;
#N vpatcher 14 59 614 459;
#P window setfont “Sans Serif” 9.;
#P number 152 135 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 301 188 48 196617 dmx low;
#P user multiSlider 152 65 113 8 0. 1. 1 2680 47 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P newex 152 108 53 196617 * 65536.;
#P newex 152 160 108 196617 expr $i1 >> 8 & 255;
#P number 152 187 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 264 186 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 264 160 83 196617 expr $i1 & 255;
#P comment 108 61 36 196617 lemur;
#P comment 189 189 37 196617 dmx hi;
#P flonum 152 83 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 8 0 0 0;
#P connect 0 0 7 0;
#P connect 7 0 10 0;
#P connect 10 0 6 0;
#P connect 6 0 5 0;
#P connect 10 0 3 0;
#P connect 3 0 4 0;
#P pop;

#111310
Oct 25, 2009 at 7:22pm

thanks for posting up that demo patch, massively helpful for me.

#111311

You must be logged in to reply to this topic.