Scaling a Numeric Display Object using a Macro subroutine

Tags: DataMacros

Scaling a Numeric Display Object using a Macro subroutine

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.

style=”width: 480px;” data-filename=”image.png”>

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

style=”width: 526px;” data-filename=”image.png”>

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.

style=”width: 404px;” data-filename=”image.png”>

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”. 

style=”width: 487px;” data-filename=”image.png”>

below is the macro syntax for other data types:

style=”width: 621px;” data-filename=”image.png”>

style=”width: 615px;” data-filename=”image.png”>

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

style=”width: 391px;” data-filename=”image.png”>

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.

style=”width: 480px;” data-filename=”image.png”>

Content Created by Jeff Robertson
Scroll to Top