User Tools

Site Tools


plc:plc_show_custom_message_box

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
plc:plc_show_custom_message_box [2019/05/17 09:21] skirillovplc:plc_show_custom_message_box [2019/05/17 10:53] ivan
Line 1: Line 1:
-==== Show Custom Message Box from PLC ====+===== Show Custom Message Box from PLC =====
  
-In [[plc:plc_gas_cutting_implementation|previous article]] we showed how to implement oxyfuel gas cutting procedure. Preheat process in gas cutting can last 30-120 seconds. It is convenient to have on screen message that shows preheat progress. Let'add message box with preheat progress countdown for gas cutting.+In order to create a custom popup window in myCNC software for an event like an emergency button press, a software PLC procedure can be added to the myCNC software for the user'specific needs and requirementsIn order to do so, go to CNC Settings > PLC > Software PLC, then create a new popup window following the instructions below:
  
-Global variables 9100-9163 are reserved to show/hide enumerated Popup message box. +1. Press the **Create New** button in the Software PLC window 
-Writing "1" to register (9100+N) will show Message Box #N on the main screenWriting "0" will hide the Message Box.+{{:plc:001-open-create-window.jpg}}
  
-Content for message box #0...#63 defined in cnc-variables.xml configuraton file by item **cnc-popup-message-0** ... **cnc-popup-message-15** +2Name your new window and press the **Confirm** button 
 +{{:plc:002-custom-box-name.jpg}}
  
-<code xml> +3. Click **Save** and **Build All** 
-<value name="cnc-popup-message-0"  +{{:plc:003-custom-box-save-build-all.jpg}}
-  header="Preheat Countdown" footer="sec" message="%d"  +
-  headerHeight="60" footerHeight="30" width="300" height="150" +
-  fontSize="60" headerFontSize="30" footerFontSize="20"  +
-  timeout="5" dest="cnc-gvariable-99" K="0.001">0</value> +
-</code>+
  
-Message box contains 3 lines. Lines defined by attributes **header** (top line)**message** (middle line), **footer** (bottom line)Font size for each line defines by attributes **headerFontSize**, **fontSize** and **footerFontSize**+At this pointthe popup window's code must be edited to appear when a specific event occurs
  
-Line height for each line defined by attributes **headerHeight**, **height** and **footerHeight**.+4Copy and paste the following code into the window: 
 +<code> 
 +main()
  
-Attributes **width** and **height** define message box width and height in pixels. +{
-Popup Messagebox will be automatically hidden if variable value was not changed longer than time defined in **timeout** attribute.+
  
-Parameter value can be printed in Message Box. To print a value -  +do    
-  * Message attribute should contain C-style contains format line (ie "%d", "%7.3f"+{
-  * Attribute **dest** should define variable number  +
-  * Attribute **K** defines scale ratio.+
  
-For example if  +if (portget(3)!=0) 
-  * message="%d" +
-  * dest="cnc-gvariable-99"  + gvarset(9101,1);   
-  * K="0.001"+};
  
-Variable #99 value multiplied by K-ratio will be printed: if variable value is 95000, value **95** will be shown.+}while(1);
  
-{{plc:mycnc-eco-popup-message-01.png}}+}; 
 +</code> 
 + 
 +5. In order to edit the newly created window, we can open CNC Settings > Screen > Popup Messages 
 + 
 +====Deprecated version==== 
 +[[plc:plc_show_custom_message_box:old_version|Showing a custom message box in older software]]
  
-Source code to show Message Popup is  
-<code c> 
-  gvarset(9100,1);  //show the Message Box 
-  portset(OUTPUT_OXY_HEAT_HI); //turn ON preheat Valve 
-  timer=time_preheat; 
-  break_heating=1; //Set Heating variable.  
-  //if the value will be clearen outside of PLC, abort Preheat procedure 
-  do { 
-    timer--; 
-    if (portget(6)!=0) //if start key is pressed - start piercing 
-      { 
- timer=0; //exit from heating 
-      };  
-    if (break_heating==0)   //if start key is pressed - start piercing 
-      { 
- timer=0;     //exit from heating 
-      };  
-    if ((timer&0xff)==0) 
-      { 
- gvarset(99,timer); //update Countdown value every 256msec 
-      }; 
-   }while(timer>0);        //Preheat loop 
  
-  gvarset(9100,0);         //hide Message Box 
-</code> 
  
plc/plc_show_custom_message_box.txt · Last modified: 2019/09/16 15:54 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki