why does aux1 doesn't work?

Here is the code and from some reason doesn’t work.

if(p1_sw_aux1==1)
{
g=1;
}
if(g==1)
{
z++;
}
if((z<=30)&&(a==1))
{
relay1_fwd=1;
}
else
a=0;

First of all, it would help if you explained what you wanted the code to do. Secondly, it would help to describe what you’ve proven works or doesn’t work. For example, have you used this code with another switch and it worked correctly? Have verified that p1_sw_aux1 doesn’t switch, or do you not really know?

If I had to guess at what the problem is with no other information, I’d say that z (and maybe some of the other variables, depending on the rest of your code) are not declared static.

I tried to turn the Globe engine for 0.8 seconds when I press aux1.
Appearently, it doesn’t work even the variables are declered as static.
Is the code correct?

is “a” initialized as 1?

As a side note,

if(g==1)
{
z++;
}

can be written as

if(g)
z++;

just to save time (but some people don’t like it). same with everything else that will only be 1 or 0. the brackets are only needed if there is more than 1 line of code.

I’m working with him on the code and a is intializied as 1. Should all the int varibles be static?

At the very least, it is incomplete.

What does happen when you press aux1? Does the Globe motor start running and never stop? There is nothing in your code to turn it off after the time has elapsed.

do you have aux1 defined in your header file? check to see if it is going to the right place and not into a different file. Recheck your variables and make sure your definitions are what you want them to be.