Keyboard Shortcuts
Likes
Search
Serial sum/multiply
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:
|
How are you expecting to output the data? On Nov 11, 2016 5:25 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 |
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:
|