User Tools

Site Tools


mycnc:global_variables:key_counter

Incremental key counters

This article is a subsection of the larger Global Variables list.


The following global variables for incremental key counters are implemented in myCNC:

GVAR_KEY_COUNTER_ENTER 8785 Each press of the Enter key increments the value of the corresponding counter
GVAR_KEY_COUNTER_SPACE 8786 Each press of the Space key increments the value of the corresponding counter
GVAR_KEY_COUNTER_RETURN 8787 Each press of the Return key increments the value of the corresponding counter
GVAR_KEY_COUNTER_ESCAPE 8788 Each press of the Escape key increments the value of the corresponding counter

Each press of the relevant key increments the value of its counter, allowing the user to easily perform inputs during PLC operations. For example, here is an example for preheating during gas cutting. This process can contain an automatic mode with a set pause, or alternatively a manual mode where the system is waiting for the Enter/Return button to be pressed:

key_enter=gvarget(8787);//key_enter counter
auto=gvarget(7510);
  if (auto!=0)
  {
    timer=var_preheat_time;
    do{    timer--;    }while(timer>0);
  }else
  { //manual
    done=0;
    do{    timer--;
    if ((timer&0xff)==0)
    {
      key1=gvarget(8787);//key_enter counter
      if (key1!=key_enter) {done=1;};
    };
    }while(done==0);
  }; 
mycnc/global_variables/key_counter.txt · Last modified: 2025/02/21 09:07 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki