TechTip: Calculating The Difference Between Two Values Using a Macro In a Weintek HMI

This TechTip is about using a macro for a simple calculation to determine the difference between 2 values. To calculate the difference between 2 values, first we use the “>=” operator to determine if value1 is greater than or equal to value2, if this is the case, our result is calculated value1 – value2. If value2 is greater than value1 then our result calculation is value2 – value1. The macro is shown below: As usual there’s a demo project available for you to try out using EasyBuilder Pro’s excellent simulator. Download the demo here.

TechTip: Using a Macro On a Weintek HMI to Generate a QR Code For The History Upload Address

Introduction This TechTip is about using a Macro to generate a QR code to scan with a phone to access via FTP* the HMI to upload history files etc from it. As usual, we’ll break it down so you can see what we’re doing here. *It’s worth noting that some browsers do not support parsing passwords etc in the address. As of today, Mozilla Firefox works ok. Using with Mozilla Firefox Macro The required string is in the following format: “ftp://uploadhis:[email protected]/“ Declare variables The first part, “ftp://uploadhis:” is fixed, so we’ll declare that in our macro: Next is the ftp Continue reading TechTip: Using a Macro On a Weintek HMI to Generate a QR Code For The History Upload Address

TechTip: Ramp Up and Down a Value Using a Macro On Weintek HMI

This TechTip is about using For/Next loops to ramp up and down a value on a Weintek HMI. The macro is using local word LW 100 as the output, the time in mS between steps is set by “time” (LW 101), the value to increment/decrement by is variable “IncDecValue” (LW 102) and the number of iterations is “steps” (LW 103). The Macro: macro_command main() short value = 0 // “value” is a short (16bit) – this has been zeroed – just in case! short IncDecValue // change the increment/decrement value here short i // i is a short to be used Continue reading TechTip: Ramp Up and Down a Value Using a Macro On Weintek HMI

TechTip: Enabling EasyAccess 2.0 on a cMT-GXX Gateway

The reduced interface in EasyBuilder Pro for the cMT-GXX series Gateway means that to start the EasyAccess 2.0 service we have to find a way to set the EasyAccess Control word LW 10820 to “1” to start the service. (At this point it is assumed that you have already purchased EasyAccess 2.0 and assigned it to your cMT-GXX gateway using PC Activator or the online service in on the web portal.) The Macro below will set the required control word to enable the service: =========================================== macro_command main() short EA2Enable = 1 // EA2Enable is a short (16bit word) and we’re Continue reading TechTip: Enabling EasyAccess 2.0 on a cMT-GXX Gateway

TechTip: Using StringCat in a Macro on Weintek HMI

This TechTip is about using “StringCat” in a Weintek HMI macro. You may already be familiar with using CONCAT in Microsoft Excel to link different text strings together to form a new string, this is what StringCat does. In this example, we’ll be looking at a scenario where a number needs to be joined to a 4 character ASCII string. For example “number “+ “text” = “outputstring”. i.e. 1234+ABCD = 1234ABCD First off, we’ll declare the variables, we have “number” (which we’ll get from an HMI LW register LW0), “text” which we’ll get from LW2 (2 words – 4 characters) and the result will Continue reading TechTip: Using StringCat in a Macro on Weintek HMI

TechTip: For-Next Loop in Weintek HMI Macro

In this TechTip, we’ll be looking at For-Next loops in the Weintek HMI macro language. It will be assumed that you’ve already got some basic knowledge of Weintek macros. As in other macro TechTips we’ll start off by declaring some variables: macro_command main() // Declare variables bool Lamp // Lamp is a bit (bool) short i // i is the loop variable short millisecs // the time for delay in mS short loop //number of loops set using LW1 We’ll use GetData to get the values for DELAY from LW0 and for the number of loops from LW1 (we could Continue reading TechTip: For-Next Loop in Weintek HMI Macro

TechTip: Simple Macros in Weintek HMI

Weintek HMI have a very powerful macro language enabling scripts to be written to implement control, perform calculations and much more. For those new to macros it can be quite daunting to get started. The example shown in this TechTip Article are designed as a “leg-up” to get you started with macros. Step 1 The Macro button is on the project tab within EasyBuilder Pro: Step 2 We need to create a macro by clicking “New…” Step 3 Let’s break down what you need to know to get started with writing a macro. First off we need to declare variables. Continue reading TechTip: Simple Macros in Weintek HMI