Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
You could convert your example string to an integer with
i=(byte(s,1)*256)+byte(s,2);
If 's' = the string "\x03\xE7", then integer 'i' would = 03E7h or 999d, depending on how one wishes to look at it. No need for further conversion, assuming I'm understanding your intent.
From: Crestron@... [mailto:Crestron@...] On Behalf Of prunier514 Sent: Tuesday, June 04, 2013 4:52 PM To: Crestron@... Subject: [Crestron] Simpl+ hex manipulation
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
Perfect, thx. Know, I need to do the same process but in the other way... : Example: I have an integer i = 999d ans i would like put this value in a string with 2 bytes....like string s = \x03\xE7 . Any suggestions? Thx again for your time
toggle quoted message
Show quoted text
--- In Crestron@..., "Steve Kaudle" <skaudle@...> wrote: You could convert your example string to an integer with
i=(byte(s,1)*256)+byte(s,2);
If 's' = the string "\x03\xE7", then integer 'i' would = 03E7h or 999d, depending on how one wishes to look at it. No need for further conversion, assuming I'm understanding your intent.
From: Crestron@... [mailto:Crestron@...] On Behalf Of prunier514 Sent: Tuesday, June 04, 2013 4:52 PM To: Crestron@... Subject: [Crestron] Simpl+ hex manipulation
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
[Non-text portions of this message have been removed]
|
X = 999; String$ = CHR(X/256) + CHR(X%256);
That's off the top of my head - should do it... "%" is short for MOD aka "modulus".
- Chip
toggle quoted message
Show quoted text
--- In Crestron@..., "prunier514" <jerome.homeprog@...> wrote:
Perfect, thx. Know, I need to do the same process but in the other way... : Example: I have an integer i = 999d ans i would like put this value in a string with 2 bytes....like string s = \x03\xE7 . Any suggestions? Thx again for your time
--- In Crestron@..., "Steve Kaudle" <skaudle@> wrote:
You could convert your example string to an integer with
i=(byte(s,1)*256)+byte(s,2);
If 's' = the string "\x03\xE7", then integer 'i' would = 03E7h or 999d, depending on how one wishes to look at it. No need for further conversion, assuming I'm understanding your intent.
From: Crestron@... [mailto:Crestron@...] On Behalf Of prunier514 Sent: Tuesday, June 04, 2013 4:52 PM To: Crestron@... Subject: [Crestron] Simpl+ hex manipulation
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
[Non-text portions of this message have been removed]
|
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
toggle quoted message
Show quoted text
--- In Crestron@..., "prunier514" <jerome.homeprog@...> wrote: Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
toggle quoted message
Show quoted text
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote: x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@..., "prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
Except "03E7" != "\x03\xE7"
And ITOHEX(999) will give you "3E7", not "\x03\xE7". :)
- Chip
toggle quoted message
Show quoted text
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote: x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@..., "prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
Oh, I didn't understand that the escape chars were actually needed, my bad.
toggle quoted message
Show quoted text
--- In Crestron@..., "Chip" <cfm@...> wrote:
Except "03E7" != "\x03\xE7"
And ITOHEX(999) will give you "3E7", not "\x03\xE7". :)
- Chip
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@..., "prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
Not sure it's really better, but another option is: s=chr(high(i))+chr(low(i)); if 'i' = 03E7h, then 's' would = "\x03\xE7" From: Crestron@... [mailto:Crestron@...] On Behalf Of prunier514 Sent: Wednesday, June 05, 2013 1:44 PM To: Crestron@... Subject: [Crestron] Re: Simpl+ hex manipulation It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7 Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo) Working good! --- In Crestron@... <mailto:Crestron%40yahoogroups.com> , "matt_rasmussen_2000" <mjrtoo@...> wrote: x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> ,
"prunier514" <jerome.homeprog@> wrote: Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together
(so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
toggle quoted message
Show quoted text
--- In Crestron@..., "prunier514" <jprunier@...> wrote: It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@..., "prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together (so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
\x03\xE7 isn't eight characters, its two, the \x is an identifier that says 'the next two characters = one byte' From: Crestron@... [mailto:Crestron@...] On Behalf Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... Subject: [Crestron] Re: Simpl+ hex manipulation ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)? --- In Crestron@... <mailto:Crestron%40yahoogroups.com> , "prunier514" <jprunier@...> wrote: It's not worling like i want. because the result is string = 999 in ASCII but it is string =
\x39\x39\x39 in hex...i want string = \x03\xE7 Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> ,
"matt_rasmussen_2000" <mjrtoo@> wrote: x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> ,
"prunier514" <jerome.homeprog@> wrote: Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together
(so, I want 03E7)and convert this value in an integer to have 999 at the end. Any suggestions? Thx for time
|
I'll just go away now... ;-)
toggle quoted message
Show quoted text
--- In Crestron@..., "Steve Kaudle" <skaudle@...> wrote: \x03\xE7 isn't eight characters, its two, the \x is an identifier that says 'the next two characters = one byte'
From: Crestron@... [mailto:Crestron@...] On Behalf Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> , "prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> , "matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> ,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together
(so, I want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions? Thx for time
[Non-text portions of this message have been removed]
|
somewhat in my defense I look at anything in "" to be a literal string, but ya :-)
toggle quoted message
Show quoted text
--- In Crestron@..., "Steve Kaudle" <skaudle@...> wrote: \x03\xE7 isn't eight characters, its two, the \x is an identifier that says 'the next two characters = one byte'
From: Crestron@... [mailto:Crestron@...] On Behalf Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> , "prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> , "matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <mailto:Crestron%40yahoogroups.com> ,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put together
(so, I want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions? Thx for time
|
Try firing this: out="\x03\xE7"; Out into Simpl and watch the value in Debugger (in hex mode, of course), and tell me what you see;) On Wednesday, June 5, 2013, matt_rasmussen_2000 wrote: **
somewhat in my defense I look at anything in "" to be a literal string, but ya :-)
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>, "Steve Kaudle" <skaudle@...> wrote:
\x03\xE7 isn't eight characters, its two, the \x is an identifier that says
'the next two characters = one byte'
From: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> [mailto:Crestron@...<javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>] On Behalf
Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>
Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put
together
(so, I want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions? Thx for time
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
|
Same thing if you stuff it in an SIO - double quotes on each end are ignored.
- Chip
toggle quoted message
Show quoted text
--- In Crestron@..., Steve Kaudle <skaudle@...> wrote: Try firing this:
out="\x03\xE7";
Out into Simpl and watch the value in Debugger (in hex mode, of course), and tell me what you see;)
On Wednesday, June 5, 2013, matt_rasmussen_2000 wrote:
**
somewhat in my defense I look at anything in "" to be a literal string, but ya :-)
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>, "Steve Kaudle" <skaudle@> wrote:
\x03\xE7 isn't eight characters, its two, the \x is an identifier that says
'the next two characters = one byte'
From: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> [mailto:Crestron@...<javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>] On Behalf
Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>
Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put
together
(so, I want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions? Thx for time
|
I understand, that's the but ya part. :) I didn't mean the compiler, I meant what I saw and how leteral strings are represented when you write them out.
toggle quoted message
Show quoted text
--- In Crestron@..., "Chip" <cfm@...> wrote:
Same thing if you stuff it in an SIO - double quotes on each end are ignored.
- Chip
--- In Crestron@..., Steve Kaudle <skaudle@> wrote:
Try firing this:
out="\x03\xE7";
Out into Simpl and watch the value in Debugger (in hex mode, of course), and tell me what you see;)
On Wednesday, June 5, 2013, matt_rasmussen_2000 wrote:
**
somewhat in my defense I look at anything in "" to be a literal string, but ya :-)
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>, "Steve Kaudle" <skaudle@> wrote:
\x03\xE7 isn't eight characters, its two, the \x is an identifier that says
'the next two characters = one byte'
From: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> [mailto:Crestron@...<javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>] On Behalf
Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>
Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put
together
(so, I want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions? Thx for time
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
|
Y'mean there's a different way of writing things out besides Crestron-speak? :)
- Chip
toggle quoted message
Show quoted text
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote: I understand, that's the but ya part. :) I didn't mean the compiler, I meant what I saw and how leteral strings are represented when you write them out.
--- In Crestron@..., "Chip" <cfm@> wrote:
Same thing if you stuff it in an SIO - double quotes on each end are ignored.
- Chip
--- In Crestron@..., Steve Kaudle <skaudle@> wrote:
Try firing this:
out="\x03\xE7";
Out into Simpl and watch the value in Debugger (in hex mode, of course), and tell me what you see;)
On Wednesday, June 5, 2013, matt_rasmussen_2000 wrote:
**
somewhat in my defense I look at anything in "" to be a literal string, but ya :-)
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>, "Steve Kaudle" <skaudle@> wrote:
\x03\xE7 isn't eight characters, its two, the \x is an identifier that says
'the next two characters = one byte'
From: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> [mailto:Crestron@...<javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>] On Behalf
Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>
Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put
together
(so, I want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions? Thx for time
[Non-text portions of this message have been removed]
|
Everyone has a bad day once in a while right? Just so happens it's every other day for me. :)
toggle quoted message
Show quoted text
--- In Crestron@..., "Chip" <cfm@...> wrote:
Y'mean there's a different way of writing things out besides Crestron-speak? :)
- Chip
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:
I understand, that's the but ya part. :) I didn't mean the compiler, I meant what I saw and how leteral strings are represented when you write them out.
--- In Crestron@..., "Chip" <cfm@> wrote:
Same thing if you stuff it in an SIO - double quotes on each end are ignored.
- Chip
--- In Crestron@..., Steve Kaudle <skaudle@> wrote:
Try firing this:
out="\x03\xE7";
Out into Simpl and watch the value in Debugger (in hex mode, of course), and tell me what you see;)
On Wednesday, June 5, 2013, matt_rasmussen_2000 wrote:
**
somewhat in my defense I look at anything in "" to be a literal string, but ya :-)
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>, "Steve Kaudle" <skaudle@> wrote:
\x03\xE7 isn't eight characters, its two, the \x is an identifier that says
'the next two characters = one byte'
From: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> [mailto:Crestron@...<javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>] On Behalf
Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>
Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put
together
(so, I want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions? Thx for time
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
|
Fortunately Crestron used the same string escape codes as C, which is my native language. AMX infuriates me with its ridiculous "'string', $20, 'escape', $20, 'codes', $0D, $0A". So does Extron, for that matter, with its %0D. I also remember dealing with a 232 box (Calypso maybe?) that wanted ASCII codes in decimal. Of all the ridiculous bases! Why not ask for them in trinary, I know those about as well as decimal.
toggle quoted message
Show quoted text
On Thu, Jun 6, 2013 at 9:03 AM, Chip <cfm@...> wrote: Y'mean there's a different way of writing things out besides Crestron-speak? :)
- Chip
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote:
I understand, that's the but ya part. :) I didn't mean the compiler, I meant what I saw and how leteral strings are represented when you write them out.
--- In Crestron@..., "Chip" <cfm@> wrote:
Same thing if you stuff it in an SIO - double quotes on each end are
ignored.
- Chip
--- In Crestron@..., Steve Kaudle <skaudle@> wrote:
Try firing this:
out="\x03\xE7";
Out into Simpl and watch the value in Debugger (in hex mode, of
course),
and tell me what you see;)
On Wednesday, June 5, 2013, matt_rasmussen_2000 wrote:
**
somewhat in my defense I look at anything in "" to be a literal
string,
but ya :-)
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>, "Steve Kaudle" <skaudle@> wrote:
\x03\xE7 isn't eight characters, its two, the \x is an
identifier that
says
'the next two characters = one byte'
From: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> [mailto:Crestron@...<javascript:_e({},
'cvml', 'Crestron%40yahoogroups.com');>]
On Behalf
Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>
Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({},
'cvml', 'Crestron%2540yahoogroups.com');>>
,
"prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({},
'cvml', 'Crestron%2540yahoogroups.com');>>
,
"matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({},
'cvml', 'Crestron%2540yahoogroups.com');>>
,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest =
"\x03\xE7";
Finally: I want take the both hex value of stringtest to
put
together
(so, I want 03E7)and convert this value in an integer to have
999 at the
end.
Any suggestions? Thx for time
------------------------------------
Check out the Files area for useful modules, documents, and drivers.
A contact list of Crestron dealers and programmers can be found in the Database area. Yahoo! Groups Links
-- Jeremy Weatherford
|
I feel your pain... :P
JRW
toggle quoted message
Show quoted text
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote: Everyone has a bad day once in a while right? Just so happens it's every other day for me. :)
--- In Crestron@..., "Chip" <cfm@> wrote:
Y'mean there's a different way of writing things out besides Crestron-speak? :)
- Chip
--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:
I understand, that's the but ya part. :) I didn't mean the compiler, I meant what I saw and how leteral strings are represented when you write them out.
--- In Crestron@..., "Chip" <cfm@> wrote:
Same thing if you stuff it in an SIO - double quotes on each end are ignored.
- Chip
--- In Crestron@..., Steve Kaudle <skaudle@> wrote:
Try firing this:
out="\x03\xE7";
Out into Simpl and watch the value in Debugger (in hex mode, of course), and tell me what you see;)
On Wednesday, June 5, 2013, matt_rasmussen_2000 wrote:
**
somewhat in my defense I look at anything in "" to be a literal string, but ya :-)
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>, "Steve Kaudle" <skaudle@> wrote:
\x03\xE7 isn't eight characters, its two, the \x is an identifier that says
'the next two characters = one byte'
From: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> [mailto:Crestron@...<javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>] On Behalf
Of matt_rasmussen_2000 Sent: Wednesday, June 05, 2013 3:02 PM To: Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');>
Subject: [Crestron] Re: Simpl+ hex manipulation
ITOHEX(999) = "3E7" do you really need that to be "\x03\x07" (8 characters)?
--- In Crestron@... <javascript:_e({}, 'cvml', 'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jprunier@> wrote:
It's not worling like i want. because the result is string = 999 in ASCII but it is string = \x39\x39\x39 in hex...i want string = \x03\xE7
Finally i found a solution, like this: integer i=atoi(x$) ----- i=999d/03E7h integer hi= i/256 integer lo= i MOD 256 string = chr(hi)+chr(lo)
Working good!
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"matt_rasmussen_2000" <mjrtoo@> wrote:
x$ = 03E7
val = HEXTOI(x$)
x = 999 string = ITOHEX(x)
That works right?
--- In Crestron@... <javascript:_e({}, 'cvml',
'Crestron%40yahoogroups.com');> <mailto:Crestron%40yahoogroups.com<javascript:_e({}, 'cvml', 'Crestron%2540yahoogroups.com');>> ,
"prunier514" <jerome.homeprog@> wrote:
Hi guys,
First,I have a string. For example: string stringtest = "\x03\xE7"; Finally: I want take the both hex value of stringtest to put
together
(so, I want 03E7)and convert this value in an integer to have 999 at the end.
Any suggestions? Thx for time
[Non-text portions of this message have been removed]
|