jeepers52004 Posted October 10, 2015 Report Share Posted October 10, 2015 Hi forum goers. I would like to combine two values from two separate INT16 registers into a single INT16 register without adding or subtracting them. For example: INT16-1 contains the value "34" INT16-2 contains the value "56" I'd like INT16-3 to contain "3456" Is this possible and if so, can you show me the way. Thanks! Michael Quote Link to comment Share on other sites More sharing options...
Saragani Posted October 12, 2015 Report Share Posted October 12, 2015 This is not always possible (since the result might exceed the limit of INT16, for example: Int16-1: 123 Int16-2: 456 You will get 123456, while the limit of Int16 is 32787 (and uint16 is 65535). As for the math, count the number of digits in the right number (the lowest part), if it has 2 digits, then it means that you need to multiply the higher number by 10^2 (which is 100), so you get: 34 * 100 + 56 If you need it as a string, then you can use the message builder. Quote Link to comment Share on other sites More sharing options...
jeepers52004 Posted October 12, 2015 Author Report Share Posted October 12, 2015 Would you then use the real to int function to put the result into a single register and just create a "dummy" register to hold the fractional part of the real to int function result? On a related "newbie" type question, is there a means to set or reset multiple coils in a single instruction or is the only method to use the set and reset coil elements for each individual coil to set or reset? Thanks! Michael Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.