Support Center - Help topic

Home > Support Center > Search > Help Topic
Contact Us
Can't find what you're looking for in our Tech Support Library? Send us a message.
Contact Us
Scaling a Numeric Display Object using a Macro subroutine
Tags: Data Macros

Numeric objects in EBPro have the option of using a Macro subroutine to scale the value displayed from the actual value stored in the read register.

First, open the properties of the numeric object and navigate to the Format tab. Take note of the Device data format. The Macro subroutine must have the same data type as the display format for it to be used with that numeric object.


Close the object properties window and go to Project > Macro to open the Macro Manager. Click Library.

With the Project tab selected, click New... to create a new macro subroutine.

The new subroutine defaults to the "short" datatype, which is a 16-bit Signed type.

Since the data type of the numeric object is 16-bit Unsigned, the data type of the subroutine and the first argument need to be changed to "unsigned short". 

below is the macro syntax for other data types:


Compile and save the macro subroutine. It will now appear in the Macro Function Library.

Exit the Macro Function Library and close the Macro Manager.

Open the properties for the Numeric Object and navigate to the Format tab.

For Scaling Method, select Macro subroutine from the drop down.

In this example, we want to scale the way the register value is displayed. For Read conversion, select the macro subroutine "scale" from the list.



Content Created by Derek Thompson