¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Analog to hex to Serial


Andy Maxey
 

I have an analog value that varies from 1 to 40 that I need to insert into a serial string as hex. My first thought was to use an ascalel to convert the analog to hex then I build my string with an atos. What I need is !1PRS01\x0D, but what I'm getting is !PRS\x01\x0D. Is there a way to do what I want without S+?

Andy


 

Hi Andy,

You need to use the Div/Mod symbol to obtain Tens and Units, then a pair of ASUM's to add ASCII offset using an INIT. You will then have two analogs to feed into an ATOS to generate the strings. Trigger the ATOS using a SOS on the ASCII Units analog.

Lindsay

--- In Crestron@..., Andy Maxey <amaxey@...> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

I might use an ATOD to generate 8 bits from the integer, then run the lower 4 bits (low nibble) into a DTOA, and then shift the upper 4 bits (upper nibble) into a DTOA but put them on bits 1-4 instead of 5-8. That will generate two analog values consisting of two bytes.

IE

5Fh = 05h (high nibble) and 0Fh (low nibble)

sounds like you will know what to do from there. I'm sure there are other ways, but this works in my brain better.

--- In Crestron@..., Andy Maxey <amaxey@...> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


steve_kaudle
 

I pulled a module out of my library and put a TXA on the back end...not sure if it'll do exactly what you want, but I thought it'd be worth a try.

--- In Crestron@..., Andy Maxey <amaxey@...> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols

--- In Crestron@..., Andy Maxey <amaxey@...> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


Witmarquzot
 

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)

--- In Crestron@..., "Witmarquzot" <tdurrant420@...> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

Still can't sleep, and a little confused by your answer, would you mind posting an example? Wouldn't you need a way to determine the right offset since the difference between ASCII digits and letters are different?

--- In Crestron@..., "l_codd" <lindsayc@...> wrote:

Hi Andy,

You need to use the Div/Mod symbol to obtain Tens and Units, then a pair of ASUM's to add ASCII offset using an INIT. You will then have two analogs to feed into an ATOS to generate the strings. Trigger the ATOS using a SOS on the ASCII Units analog.

Lindsay

--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


Witmarquzot
 

check file section.
It could be that I misunderstood the poster.

If not then the equ 1 would go to sio "!PRS01&#92;r" etc etc

If we use a div mod, 2 ascale w/o zero pass, and a sos, we get the value to come out as two analog values that can be input to an analog to serial. I am also guessing that the "!PRS" and "&#92;r" are static.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote:

Still can't sleep, and a little confused by your answer, would you mind posting an example? Wouldn't you need a way to determine the right offset since the difference between ASCII digits and letters are different?

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Hi Andy,

You need to use the Div/Mod symbol to obtain Tens and Units, then a pair of ASUM's to add ASCII offset using an INIT. You will then have two analogs to feed into an ATOS to generate the strings. Trigger the ATOS using a SOS on the ASCII Units analog.

Lindsay

--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


Witmarquzot
 

yeah i totally misunderstood the poster. hold on, i will try again.

--- In Crestron@..., "Witmarquzot" <tdurrant420@...> wrote:

check file section.
It could be that I misunderstood the poster.

If not then the equ 1 would go to sio "!PRS01&#92;r" etc etc

If we use a div mod, 2 ascale w/o zero pass, and a sos, we get the value to come out as two analog values that can be input to an analog to serial. I am also guessing that the "!PRS" and "&#92;r" are static.


--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Still can't sleep, and a little confused by your answer, would you mind posting an example? Wouldn't you need a way to determine the right offset since the difference between ASCII digits and letters are different?

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Hi Andy,

You need to use the Div/Mod symbol to obtain Tens and Units, then a pair of ASUM's to add ASCII offset using an INIT. You will then have two analogs to feed into an ATOS to generate the strings. Trigger the ATOS using a SOS on the ASCII Units analog.

Lindsay

--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@...> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


Witmarquzot
 

Ok i got it to 11 with the AtoS

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote:

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


Witmarquzot
 

13 with an exception catch if the programmer tries to put in a values greater then 255, else it will print two Ascii Characters as hex equivalent of analog number.

2 is still the minimal,

--- In Crestron@..., "Witmarquzot" <tdurrant420@...> wrote:

Ok i got it to 11 with the AtoS

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

My catch was limiting the analog input into the module to 255. :). 2 would be if you wanted to edit an SIO for all the possibilities yes. But he asked about the atos. Perhaps the 1-40d values, or, 1-255d could be useful for other commands too, using an atos. Would be much faster than editing multiple SIO 'lookup tables' when shift+F4 would onky work for part of the values.

I can't beat my 5 symbols to generate the 2 ascii'fied hex bytes from a single hex/decimal byte. Would be interested in seeing a solution that does though!

--- In Crestron@..., "Witmarquzot" <tdurrant420@...> wrote:

13 with an exception catch if the programmer tries to put in a values greater then 255, else it will print two Ascii Characters as hex equivalent of analog number.

2 is still the minimal,

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

Ok i got it to 11 with the AtoS

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


Witmarquzot
 

I don't see your 5 symbol solution in the file section.

could do the conversion in three(5 total with the ATOS and SOS)

EQU(all 64 values), two inits, one to generate the upper byte and for the lower

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote:

My catch was limiting the analog input into the module to 255. :). 2 would be if you wanted to edit an SIO for all the possibilities yes. But he asked about the atos. Perhaps the 1-40d values, or, 1-255d could be useful for other commands too, using an atos. Would be much faster than editing multiple SIO 'lookup tables' when shift+F4 would onky work for part of the values.

I can't beat my 5 symbols to generate the 2 ascii'fied hex bytes from a single hex/decimal byte. Would be interested in seeing a solution that does though!

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

13 with an exception catch if the programmer tries to put in a values greater then 255, else it will print two Ascii Characters as hex equivalent of analog number.

2 is still the minimal,

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

Ok i got it to 11 with the AtoS

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

I couldn't upload it, on my phone now, but will tomorrow. Although, here's how it goes.

Single byte value -- DIVMOD (divisor 16d)
High byte(nibble here though) value --> equate (0-16 params)
Low byte(nibble here though) value --> equate (0-16 params)
high equate --> init (hex values for appropriate ascii representation)low equate --> init (hex values for appropriate ascii representation)

That's it, if you include the SOS and ATOS it's 7 then.

I see your solution though, instead of divmod you just do a big equate and send that to two inits with the appropriate values. Nice

--- In Crestron@..., "Witmarquzot" <tdurrant420@...> wrote:

I don't see your 5 symbol solution in the file section.

could do the conversion in three(5 total with the ATOS and SOS)

EQU(all 64 values), two inits, one to generate the upper byte and for the lower

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

My catch was limiting the analog input into the module to 255. :). 2 would be if you wanted to edit an SIO for all the possibilities yes. But he asked about the atos. Perhaps the 1-40d values, or, 1-255d could be useful for other commands too, using an atos. Would be much faster than editing multiple SIO 'lookup tables' when shift+F4 would onky work for part of the values.

I can't beat my 5 symbols to generate the 2 ascii'fied hex bytes from a single hex/decimal byte. Would be interested in seeing a solution that does though!

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

13 with an exception catch if the programmer tries to put in a values greater then 255, else it will print two Ascii Characters as hex equivalent of analog number.

2 is still the minimal,

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

Ok i got it to 11 with the AtoS

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

...or, maybe the winner is the number of signals. Lol :)

--- In Crestron@..., "Witmarquzot" <tdurrant420@...> wrote:

I don't see your 5 symbol solution in the file section.

could do the conversion in three(5 total with the ATOS and SOS)

EQU(all 64 values), two inits, one to generate the upper byte and for the lower

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

My catch was limiting the analog input into the module to 255. :). 2 would be if you wanted to edit an SIO for all the possibilities yes. But he asked about the atos. Perhaps the 1-40d values, or, 1-255d could be useful for other commands too, using an atos. Would be much faster than editing multiple SIO 'lookup tables' when shift+F4 would onky work for part of the values.

I can't beat my 5 symbols to generate the 2 ascii'fied hex bytes from a single hex/decimal byte. Would be interested in seeing a solution that does though!

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

13 with an exception catch if the programmer tries to put in a values greater then 255, else it will print two Ascii Characters as hex equivalent of analog number.

2 is still the minimal,

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

Ok i got it to 11 with the AtoS

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

Then Lindsay would probably win is what I was inferring, not me. :)

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@...> wrote:

...or, maybe the winner is the number of signals. Lol :)

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

I don't see your 5 symbol solution in the file section.

could do the conversion in three(5 total with the ATOS and SOS)

EQU(all 64 values), two inits, one to generate the upper byte and for the lower

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

My catch was limiting the analog input into the module to 255. :). 2 would be if you wanted to edit an SIO for all the possibilities yes. But he asked about the atos. Perhaps the 1-40d values, or, 1-255d could be useful for other commands too, using an atos. Would be much faster than editing multiple SIO 'lookup tables' when shift+F4 would onky work for part of the values.

I can't beat my 5 symbols to generate the 2 ascii'fied hex bytes from a single hex/decimal byte. Would be interested in seeing a solution that does though!

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

13 with an exception catch if the programmer tries to put in a values greater then 255, else it will print two Ascii Characters as hex equivalent of analog number.

2 is still the minimal,

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

Ok i got it to 11 with the AtoS

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy


 

Appreciate the company during my insomnia! Looks like we whittled it down pretty good. Be interesting to see what happens in the morning. :)

--- In Crestron@..., "Witmarquzot" <tdurrant420@...> wrote:

I don't see your 5 symbol solution in the file section.

could do the conversion in three(5 total with the ATOS and SOS)

EQU(all 64 values), two inits, one to generate the upper byte and for the lower

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

My catch was limiting the analog input into the module to 255. :). 2 would be if you wanted to edit an SIO for all the possibilities yes. But he asked about the atos. Perhaps the 1-40d values, or, 1-255d could be useful for other commands too, using an atos. Would be much faster than editing multiple SIO 'lookup tables' when shift+F4 would onky work for part of the values.

I can't beat my 5 symbols to generate the 2 ascii'fied hex bytes from a single hex/decimal byte. Would be interested in seeing a solution that does though!

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

13 with an exception catch if the programmer tries to put in a values greater then 255, else it will print two Ascii Characters as hex equivalent of analog number.

2 is still the minimal,

--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

Ok i got it to 11 with the AtoS

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Without reverting? I thought the challenges were the fewest symbols. :)

--- In Crestron@..., "l_codd" <lindsayc@> wrote:

Yep, I was thinking decimal but of course he want's hex equivalent and the conversion to A,B,C... Can be done with two more DIV/MODs, ASUMs etc without reverting to EQUs and INITs

Lindsay

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

Yeah, I got it down to 5 and then a TXA if you want to include that. Using Divmod divisor 16d, two equates and two inits. Thinking too much in the literal version, but interesting anyway, Rube Goldberg iteresting..lol.

I'd like to see your solution, always like to learn. :)



--- In Crestron@..., "Witmarquzot" <tdurrant420@> wrote:

you can do it in two with an equ and sio, but that really isn't elegant and would only cover 40 cases.

I can do it in 4, but that will only insert the proper value into an analog to serial, so i guess that makes 5.

--- In Crestron@..., "matt_rasmussen_2000" <mjrtoo@> wrote:

I can't sleep, so here's my attempt at the project. It's a very literal conversion, but seem to work well. 14 symbols



--- In Crestron@..., Andy Maxey <amaxey@> wrote:

I have an analog value that varies from 1 to 40 that I need to insert
into a serial string as hex. My first thought was to use an ascalel to
convert the analog to hex then I build my string with an atos. What I
need is !1PRS01&#92;x0D, but what I'm getting is !PRS&#92;x01&#92;x0D. Is there a
way to do what I want without S+?

Andy