¿ªÔÆÌåÓý

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

Serial sum/multiply


 

Is there an easy way to take a serial number value and multiply it?? I thought of converting to analog and using an analog sum but the serial value is higher than 65535 so that doesn't work

thanks!



 

If you're willing to scale it down, you could use an ASCALE to multiply by a constant (read the help file).? If you need numbers larger than 65535 you have to use S+ (or S#).

On Thu, Nov 10, 2016 at 1:27 PM, rlf79cm@... [Crestron] <Crestron@...> wrote:
?

Is there an easy way to take a serial number value and multiply it?? I thought of converting to analog and using an analog sum but the serial value is higher than 65535 so that doesn't work

thanks!




 

I did look at sclaing down but it's values from a Ted Energy monitoring system so it causes problems later in the code.? Do you know if a S+/S# module anywhere that will allow ana values larger than 65535?? That would be perfect (happy to pay for such a module).

Cheers


 

How are you expecting to output the data?


On Nov 11, 2016 5:25 AM, "rlf79cm@... [Crestron]" <Crestron@...> wrote:
?

I did look at sclaing down but it's values from a Ted Energy monitoring system so it causes problems later in the code.? Do you know if a S+/S# module anywhere that will allow ana values larger than 65535?? That would be perfect (happy to pay for such a module).

Cheers


 

It's a strange setup - the data comes in as serial text but I need to multiply each of the values by 3 (I'm still unsure why - Ted themselves are stumped), so i convert to analog, use ASUM to multiply the 3 values together then convert back to serial (adding a decimal point) to display on the touchpanels.? The ana values are used for the usage gagues.

It all works fine until the weekly/monthly serial inputs exceed 65535.? I guess I could scale the week/month values


 

Not sure what you mean about the analogs, but this code takes a serial in, multiplies it by 3, shifts the decimal point 2 digits, and prints it back as a serial.? Maximum input is 1431655765, which results in 42949672.95.? (maximum value for a LONG_INTEGER, divided by 100)

STRING_INPUT in[50];
STRING_OUTPUT out;

CHANGE in {
??? LONG_INTEGER i, units, frac;
??? i = ATOL(in);
??? i = i * 3;
??? units = i / 100;
??? frac = i % 100;
??? makestring(out, "%lu.%02lu", units, frac);
}


On Fri, Nov 11, 2016 at 9:33 AM, rlf79cm@... [Crestron] <Crestron@...> wrote:
?

It's a strange setup - the data comes in as serial text but I need to multiply each of the values by 3 (I'm still unsure why - Ted themselves are stumped), so i convert to analog, use ASUM to multiply the 3 values together then convert back to serial (adding a decimal point) to display on the touchpanels.? The ana values are used for the usage gagues.

It all works fine until the weekly/monthly serial inputs exceed 65535.? I guess I could scale the week/month values



 

Hi Jeremy, that's exactly what I was after - prefect - thank you so much!