//************************************************************************************
//**  
//**  Source name:   C:\Users\Apa\OneDrive\Mellékletek\Asztal\Flowcode1.fcfx
//**  Title:         
//**  Description:   
//**  Device:        PIC.12F.12F675
//**  
//**  Generated by:  Flowcode v10.1.2.40
//**  Date:          Sunday, October 11, 2026 07:01:47
//**  Users:         1

//**  
//**  
//**     NOT FOR COMMERCIAL USE
//**  
//**  https://www.flowcode.co.uk
//**  
//************************************************************************************


#define MX_PIC

#define MX_CAL_PIC

#define MX_CLK_SPEED 4000000

#define FCP_NULL Unconnected_Port


#include <xc.h>
#include <math.h>
//Chip Configuration Settings
__PROG_CONFIG(0x1, 0x3FC4);

/*========================================================================*\
   Use :Include the type definitions
\*========================================================================*/
#include "C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\internals.c"





/*========================================================================*\
   Use :Include the chip adaption layer
\*========================================================================*/
#include "C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\includes.c"


/*========================================================================*\
   Use :User Project
       :Variable declarations
       :Macro implementations
\*========================================================================*/
#define FCV_FALSE (0)
#define FCV_TRUE (1)
MX_GLOBAL MX_UINT8 FCV_GOMB = (0x0);
MX_GLOBAL MX_BOOL FCV_GOMBFLAG = (0);
MX_GLOBAL MX_UINT8 FCV_SZAMOL2 = (0x0);
MX_GLOBAL MX_UINT8 FCV_SZAMOL1 = (0x0);



/*========================================================================*\
   Use :Main
\*========================================================================*/
void main()
{
	#ifdef INTOSCHELPER
		INTOSCHELPERCODE
	#endif
ANSEL = 0x20;
CMCON = 0x07;

OPTION_REG = 0xC0;


  // Loop
  while (1)
  {
    // Input
    FCV_GOMB = GET_PORT_MASK(A,0x03);

    // Switch
    switch (FCV_GOMB)
    {
      case 1:
      {

        // Decision
        if (FCV_GOMBFLAG == 0)
        {        

          // Calculation
          FCV_SZAMOL1 = FCV_SZAMOL1 + 1;
          FCV_GOMBFLAG = 1;

          // Decision
          if (FCV_SZAMOL1 >= 3)
          {          

            // Output
            SET_PORT_PIN(A,4,(0));

            // Calculation
            FCV_SZAMOL1 = 0;

          } else {

            // Output
            SET_PORT_PIN(A,4,(1));

            // Output
            SET_PORT_PIN(A,5,(0));

            // Calculation
            FCV_SZAMOL2 = 0;

          }

        // } else {

        }

        break;
      }
      case 2:
      {

        // Decision
        if (FCV_GOMBFLAG == 0)
        {        

          // Calculation
          FCV_SZAMOL2 = FCV_SZAMOL2 + 1;
          FCV_GOMBFLAG = 1;

          // Output
          SET_PORT_PIN(A,5,(1));

          // Decision
          if (FCV_SZAMOL2 >= 3)
          {          

            // Output
            SET_PORT_PIN(A,5,(0));

            // Calculation
            FCV_SZAMOL2 = 0;

          } else {

            // Output
            SET_PORT_PIN(A,4,(0));

            // Output
            SET_PORT_PIN(A,4,(0));

            // Calculation
            FCV_SZAMOL1 = 0;

          }

        // } else {

        }

        break;
      }
      // default:

    }

    // Decision
    if (FCV_GOMBFLAG == 1 & FCV_GOMB == 0)
    {    

      // Calculation
      FCV_GOMBFLAG = 0;

    // } else {

    }

  }

	mainendloop: goto mainendloop;
}



/*========================================================================*\
   Use :Interrupt
\*========================================================================*/
void MX_INTERRUPT_MACRO(void)
{

}




