Macros are a powerful and flexible tool that complement built-in features with their complex logic operations and data processing capability. The task of writing macros may seem daunting at first, however, macros have fixed syntax rules that are checked by the compiler and there are manuals detailing macro use and TechTips on our website. However, like most coding tasks, macro debugging is necessary if you encounter unexpected results. In cMT Diagnoser, a Macro Debug Tool has been developed to help users quickly identify macro errors and reduce development time. The Macro Debug Tool is easy-to-use. Simply create your macro, compile Continue reading New Feature Announcement – Macro Debug Tool for Weintek cMT Series
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.
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
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
In this TechTip we’re looking at using tags in a project and how they work in a macro. Address Tags are a great way to maintain control of elements you may wish to reassign later to an alternative address. In our simple example, we have 2 tags set up in the Address Tag Library using local bits. They are called “Lamp” and “Lamp2” mapped to LB10 and LB100. In our Macro we can pick Tags by ticking the “User-defined tag” box on the macro helper: Macro from our example project is as follows… note the use of Tags “Lamp” and Continue reading TechTip: Using Project Tags In a Macro On a Weintek HMI
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
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