//************************************************************************************
//**  
//**  File name:     C:\Documents and Settings\INTEG PROGRAM\My Documents\FlowCode Files\New Folder\Switch a  LED..c
//**  Generated by:  Flowcode v4.2.3.58
//**  Date:          Friday, March 12, 2010 08:52:55
//**  Licence:       Professional
//**  Registered to: Integration Technology 
//**  
//**  
//**  http://www.matrixmultimedia.com
//************************************************************************************


#define MX_PIC

//Defines for microcontroller
#define P18F458
#define MX_EE
#define MX_EE_TYPE3
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_C
#define MX_SPI_SDI 4
#define MX_SPI_SDO 5
#define MX_SPI_SCK 3
#define MX_UART
#define MX_UART_C
#define MX_UART_TX 6
#define MX_UART_RX 7
#define MX_I2C
#define MX_MI2C
#define MX_I2C_C
#define MX_I2C_SDA 4
#define MX_I2C_SCL 3
#define MX_PWM
#define MX_PWM_CNT 1
#define MX_PWM_TRIS1 trisc
#define MX_PWM_1 2

//Functions
#define MX_CLK_SPEED 19660800
#ifdef _BOOSTC
#include <system.h>
#endif
#ifdef HI_TECH_C
#include <pic18.h>
#endif

//Configuration data
#ifdef _BOOSTC
#pragma DATA 0x300000, 0xff
#endif
#ifdef _HI_TECH_C
//__CONFIG(, );
#endif
#ifdef _BOOSTC
#pragma DATA 0x300001, 0x22
#endif
#ifdef _HI_TECH_C
__CONFIG(1, 0x22ff);
#endif
#ifdef _BOOSTC
#pragma DATA 0x300002, 0xd
#endif
#ifdef _HI_TECH_C
//__CONFIG(, );
#endif
#ifdef _BOOSTC
#pragma DATA 0x300003, 0xe
#endif
#ifdef _HI_TECH_C
__CONFIG(2, 0xe0d);
#endif
#ifdef _BOOSTC
#pragma DATA 0x300004, 0xff
#endif
#ifdef _HI_TECH_C
//__CONFIG(, );
#endif
#ifdef _BOOSTC
#pragma DATA 0x300005, 0xff
#endif
#ifdef _HI_TECH_C
__CONFIG(3, 0xffff);
#endif
#ifdef _BOOSTC
#pragma DATA 0x300006, 0x84
#endif
#ifdef _HI_TECH_C
//__CONFIG(, );
#endif
#ifdef _BOOSTC
#pragma DATA 0x300007, 0xff
#endif
#ifdef _HI_TECH_C
__CONFIG(4, 0xff84);
#endif
#ifdef _BOOSTC
#pragma DATA 0x300008, 0xf
#endif
#ifdef _HI_TECH_C
//__CONFIG(, );
#endif
#ifdef _BOOSTC
#pragma DATA 0x300009, 0xc0
#endif
#ifdef _HI_TECH_C
__CONFIG(5, 0xc00f);
#endif
#ifdef _BOOSTC
#pragma DATA 0x30000a, 0xf
#endif
#ifdef _HI_TECH_C
//__CONFIG(, );
#endif
#ifdef _BOOSTC
#pragma DATA 0x30000b, 0xe0
#endif
#ifdef _HI_TECH_C
__CONFIG(6, 0xe00f);
#endif
#ifdef _BOOSTC
#pragma DATA 0x30000c, 0xf
#endif
#ifdef _HI_TECH_C
//__CONFIG(, );
#endif
#ifdef _BOOSTC
#pragma DATA 0x30000d, 0x40
#endif
#ifdef _HI_TECH_C
__CONFIG(7, 0x400f);
#endif

//Internal functions
#include "C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h"

//Macro function declarations


//Variable declarations
char FCV_ON;


//Defines:

/**** Macro Substitutions ****
portb = LED Port Register
trisb = LED Data Direction Register
64 = LED Pin Mask
1 = LED Active Polarity
******************************/




//LED0: //Macro function declarations

void FCD_LED0_LEDOn();
void FCD_LED0_LEDOff();



//LED0: //Macro implementations


void FCD_LED0_LEDOn()
{
	
		trisb = trisb & ~64;			//Convert pin to output

		if( 1 )					//Active high polarity
			portb = portb | 64;
		else					//Active low polarity
			portb = portb & ~64;

}

void FCD_LED0_LEDOff()
{
	
		trisb = trisb & ~64;			//Convert pin to output

		if( 1 )					//Active high polarity
			portb = portb & ~64;
		else					//Active low polarity
			portb = portb | 64;

}

//Macro implementations

void main()
{
	
	//Initialisation
	adcon1 = 0x07;


	//Interrupt initialisation code
	


	//Loop
	//Loop: While 1
	while (1)
	{
		//Input
		//Input: A0 -> on
		trisa = trisa | 0x01;
		FCV_ON = ((porta & 0x01) == 0x01);


		//Decision
		//Decision: on=1?
		if (FCV_ON==1)
		{
			//Call Component Macro
			//Call Component Macro: LED(0)::LEDOn
			FCD_LED0_LEDOn();


		} else {
			//Call Component Macro
			//Call Component Macro: LED(0)::LEDOff
			FCD_LED0_LEDOff();


		}


	}


	mainendloop: goto mainendloop;
}

void MX_INTERRUPT_MACRO(void)
{
}



