How to split [80h] into [8] & [0]

renaud's icon

Hello everybody,
I make a patch to control a CHROMA KEY with RS 232, it's the DVK 100 (datavideo) and I have a few problems.
The DVK needs a particuliar form of hexadecimal, so I make the conversion when information return from the DVK 100, But I don't know how to do for send it to the machine.
I need to split a hexa like for example [80h] into [8] & [0] .

Thanks so much in advance ...

Max Patch
Copy patch and select New From Clipboard in Max.


yair reshef's icon

one way

Max Patch
Copy patch and select New From Clipboard in Max.

On 1/10/07, renaud wrote:
>
> Hello everybody,
> I make a patch to control a CHROMA KEY with RS 232, it's the DVK 100 (datavideo) and I have a few problems.
> The DVK needs a particuliar form of hexadecimal, so I make the conversion when information return from the DVK 100, But I don't know how to do for send it to the machine.
> I need to split a hexa like for example [80h] into [8] & [0] .
>
> Thanks so much in advance ...
>
>
> max v2;
> #N vpatcher 356 456 855 890;
> #P origin 295 -58;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 3;
> #P comment 265 265 100 196617 what's I need at the end of the conversion;
> #P window linecount 1;
> #P comment 237 272 20 196617 30;
> #P message 211 91 26 196617 128;
> #P message 125 91 20 196617 30;
> #P message 74 91 20 196617 38;
> #P newex 74 43 48 196617 loadbang;
> #P newex 211 194 30 196617 t b s;
> #P message 211 217 50 196617 80h;
> #P newex 211 170 62 196617 prepend set;
> #P newex 211 143 31 196617 Lhex;
> #P number 211 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 74 272 30 196617 t b s;
> #P message 74 308 50 196617 80h;
> #P newex 74 245 62 196617 prepend set;
> #P message 74 385 50 196617 128;
> #P newex 74 362 62 196617 prepend set;
> #P newex 74 336 33 196617 Llong;
> #P newex 125 194 31 196617 t b i;
> #P newex 74 217 83 196617 sprintf %ld%ldh;
> #P flonum 125 170 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 125 143 33 196617 - 30.;
> #P number 125 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 74 194 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 74 143 33 196617 - 30.;
> #P number 74 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 2;
> #P comment 266 215 100 196617 how to split [80] into[8] & [0];
> #P window linecount 1;
> #P comment 213 272 20 196617 38;
> #P fasten 21 0 22 0 79 75 79 75;
> #P connect 22 0 2 0;
> #P connect 2 0 3 0;
> #P connect 3 0 4 0;
> #P connect 4 0 8 0;
> #P fasten 9 0 8 0 130 213 79 213;
> #P connect 8 0 13 0;
> #P connect 13 0 15 0;
> #P connect 15 0 14 0;
> #P connect 15 1 14 0;
> #P connect 14 0 10 0;
> #P connect 10 0 11 0;
> #P connect 11 0 12 0;
> #P fasten 21 0 23 0 79 75 130 75;
> #P connect 23 0 5 0;
> #P connect 5 0 6 0;
> #P connect 6 0 7 0;
> #P connect 7 0 9 0;
> #P connect 9 1 8 1;
> #P fasten 21 0 24 0 79 75 216 75;
> #P connect 24 0 16 0;
> #P connect 16 0 17 0;
> #P connect 17 0 18 0;
> #P connect 18 0 20 0;
> #P connect 20 1 19 0;
> #P connect 20 0 19 0;
> #P pop;
>
>

pdelges's icon

On 10 janv. 07, at 11:22, renaud wrote:

> I need to split a hexa like for example [80h] into [8] & [0] .

Max Patch
Copy patch and select New From Clipboard in Max.

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl
http://users.skynet.be/crfmw/max

renaud's icon

Thanks so much yair...

Gary Lee Nelson's icon

Try this

Max Patch
Copy patch and select New From Clipboard in Max.

On 1/10/07 5:49 AM, "yair reshef" wrote:

> one way
>
> max v2;
> #N vpatcher 75 145 681 672;
> #P origin 295 -58;
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P comment 195 356 118 9109513 add this to sprintf help file;
> #P window linecount 8;
> #P comment 193 375 340 9109513 %ld or % d Replace with an int and
> display as decimal. (Floats are truncated.) %x or % X Replace with an
> int and display as hexadecimal. %o Replace with an int and display as
> octal. (There's one you don't see much any more!) %u Replace with an
> int and display unsigned. (In theory , this should let you display
> numbers larger than -1420130649 , but it doesn't.) %f Replace with a
> float. The format %.2f will round the float to 2 decimal places. %s
> Replace with a symbol. The format %.2s will show the first 2 letters
> of the symbol. %c Replace with character;
> #P window linecount 1;
> #P newex 307 223 64 9109513 sprintf %c%c;
> #B color 5;
> #P button 196 176 15 0;
> #P newex 291 256 35 9109513 print;
> #B color 5;
> #P newex 291 183 35 9109513 atoi;
> #B color 5;
> #P window linecount 3;
> #P comment 279 279 93 9109513 what's I need at the end of the conversion;
> #P window linecount 1;
> #P comment 251 286 20 9109513 30;
> #P message 225 105 26 9109513 128;
> #P message 139 105 20 9109513 30;
> #P message 88 105 20 9109513 38;
> #P newex 88 57 48 9109513 loadbang;
> #P newex 225 208 30 9109513 t b s;
> #P message 225 231 50 9109513 80h;
> #P newex 225 184 62 9109513 prepend set;
> #P newex 225 157 31 9109513 Lhex;
> #P number 225 129 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 88 286 30 9109513 t b s;
> #P message 88 322 50 9109513 80h;
> #P newex 88 259 62 9109513 prepend set;
> #P message 88 399 50 9109513 128;
> #P newex 88 376 62 9109513 prepend set;
> #P newex 88 350 33 9109513 Llong;
> #P newex 139 208 31 9109513 t b i;
> #P newex 88 231 83 9109513 sprintf %ld%ldh;
> #P flonum 139 184 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 139 157 33 9109513 - 30.;
> #P number 139 129 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 88 208 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 88 157 33 9109513 - 30.;
> #P number 88 129 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 2;
> #P comment 387 273 100 9109513 how to split [80] into[8] & [0];
> #P window linecount 1;
> #P comment 227 286 20 9109513 38;
> #P fasten 21 0 22 0 93 89 93 89;
> #P connect 22 0 2 0;
> #P connect 2 0 3 0;
> #P connect 3 0 4 0;
> #P connect 4 0 8 0;
> #P fasten 9 0 8 0 144 227 93 227;
> #P connect 8 0 13 0;
> #P connect 13 0 15 0;
> #P connect 15 0 14 0;
> #P connect 15 1 14 0;
> #P connect 14 0 10 0;
> #P connect 10 0 11 0;
> #P connect 11 0 12 0;
> #P fasten 21 0 23 0 93 89 144 89;
> #P connect 23 0 5 0;
> #P connect 5 0 6 0;
> #P connect 6 0 7 0;
> #P connect 7 0 9 0;
> #P connect 9 1 8 1;
> #P connect 17 0 29 0;
> #P fasten 21 0 24 0 93 89 230 89;
> #P connect 24 0 16 0;
> #P connect 16 0 17 0;
> #P connect 17 0 18 0;
> #P connect 18 0 20 0;
> #P connect 20 1 19 0;
> #P connect 20 0 19 0;
> #P connect 17 0 27 0;
> #P connect 30 0 28 0;
> #P connect 27 0 28 0;
> #P connect 27 0 30 0;
> #P pop;
>
>
> On 1/10/07, renaud wrote:
>>
>> Hello everybody,
>> I make a patch to control a CHROMA KEY with RS 232, it's the DVK 100
>> (datavideo) and I have a few problems.
>> The DVK needs a particuliar form of hexadecimal, so I make the conversion
>> when information return from the DVK 100, But I don't know how to do for send
>> it to the machine.
>> I need to split a hexa like for example [80h] into [8] & [0] .
>>
>> Thanks so much in advance ...
>>
>>
>> max v2;
>> #N vpatcher 356 456 855 890;
>> #P origin 295 -58;
>> #P window setfont "Sans Serif" 9.;
>> #P window linecount 3;
>> #P comment 265 265 100 196617 what's I need at the end of the conversion;
>> #P window linecount 1;
>> #P comment 237 272 20 196617 30;
>> #P message 211 91 26 196617 128;
>> #P message 125 91 20 196617 30;
>> #P message 74 91 20 196617 38;
>> #P newex 74 43 48 196617 loadbang;
>> #P newex 211 194 30 196617 t b s;
>> #P message 211 217 50 196617 80h;
>> #P newex 211 170 62 196617 prepend set;
>> #P newex 211 143 31 196617 Lhex;
>> #P number 211 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
>> #P newex 74 272 30 196617 t b s;
>> #P message 74 308 50 196617 80h;
>> #P newex 74 245 62 196617 prepend set;
>> #P message 74 385 50 196617 128;
>> #P newex 74 362 62 196617 prepend set;
>> #P newex 74 336 33 196617 Llong;
>> #P newex 125 194 31 196617 t b i;
>> #P newex 74 217 83 196617 sprintf %ld%ldh;
>> #P flonum 125 170 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
>> #P newex 125 143 33 196617 - 30.;
>> #P number 125 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
>> #P flonum 74 194 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
>> #P newex 74 143 33 196617 - 30.;
>> #P number 74 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
>> #P window linecount 2;
>> #P comment 266 215 100 196617 how to split [80] into[8] & [0];
>> #P window linecount 1;
>> #P comment 213 272 20 196617 38;
>> #P fasten 21 0 22 0 79 75 79 75;
>> #P connect 22 0 2 0;
>> #P connect 2 0 3 0;
>> #P connect 3 0 4 0;
>> #P connect 4 0 8 0;
>> #P fasten 9 0 8 0 130 213 79 213;
>> #P connect 8 0 13 0;
>> #P connect 13 0 15 0;
>> #P connect 15 0 14 0;
>> #P connect 15 1 14 0;
>> #P connect 14 0 10 0;
>> #P connect 10 0 11 0;
>> #P connect 11 0 12 0;
>> #P fasten 21 0 23 0 79 75 130 75;
>> #P connect 23 0 5 0;
>> #P connect 5 0 6 0;
>> #P connect 6 0 7 0;
>> #P connect 7 0 9 0;
>> #P connect 9 1 8 1;
>> #P fasten 21 0 24 0 79 75 216 75;
>> #P connect 24 0 16 0;
>> #P connect 16 0 17 0;
>> #P connect 17 0 18 0;
>> #P connect 18 0 20 0;
>> #P connect 20 1 19 0;
>> #P connect 20 0 19 0;
>> #P pop;
>>
>>

Cheers
Gary Lee Nelson
Oberlin College
www.timara.oberlin.edu/GaryLeeNelson

renaud's icon

Thanks Patrick & Gary, its sounds good. maybe I have to do like you say because my Chroma Key wait hex. And in the patch I just post I have convert all data in symbol...Maybe it's not the good way...