//************************************************************************************
//**  
//**  File name:     C:\Documents and Settings\Cris\Desktop\New Folder\BUTTON TEST.c
//**  Generated by:  Flowcode v3.6.11.53
//**  Date:          Thursday, February 25, 2010 09:09:10
//**  Licence:       Professional
//**  Registered to: Criston Lee
//**  
//**  
//**  http://www.matrixmultimedia.com
//************************************************************************************


#define MX_PIC

//Defines for microcontroller
#define P18F1230
#define MX_EE
#define MX_EE_TYPE3
#define MX_EE_SIZE 128
#define MX_UART
#define MX_UART_A
#define MX_UART_TX 2
#define MX_UART_RX 3

//Functions
#include <system.h>
#pragma CLOCK_FREQ 4000000

//Configuration data
#pragma DATA 0x300000, 0xff
#pragma DATA 0x300001, 0x2
#pragma DATA 0x300002, 0x19
#pragma DATA 0x300003, 0x1e
#pragma DATA 0x300004, 0xe
#pragma DATA 0x300005, 0x88
#pragma DATA 0x300006, 0xb9
#pragma DATA 0x300007, 0xff
#pragma DATA 0x300008, 0x3
#pragma DATA 0x300009, 0xc0
#pragma DATA 0x30000a, 0x3
#pragma DATA 0x30000b, 0xe0
#pragma DATA 0x30000c, 0x3
#pragma DATA 0x30000d, 0x40

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

//Macro function declarations


//Variable declarations
char FCV_BUTTON_1;



//Supplementary defines


//Macro implementations

//Supplementary implementations


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


	//Interrupt initialisation code
	


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


		//Decision
		//Decision: BUTTON_1 = 1?
		if (FCV_BUTTON_1 == 1)
		{
			//Output
			//Output: BUTTON_1 -> B0
			trisb = trisb & 0xfe;
			if (FCV_BUTTON_1)
				portb = (portb & 0xfe) | 0x01;
			else
				portb = portb & 0xfe;


			//Delay
			//Delay: 1 s
			delay_s(1);


			//Output
			//Output: 0 -> B0
			trisb = trisb & 0xfe;
			if (0)
				portb = (portb & 0xfe) | 0x01;
			else
				portb = portb & 0xfe;


		} else {
			//Delay
			//Delay: 1 s
			delay_s(1);


			//Output
			//Output: 1 -> B1
			trisb = trisb & 0xfd;
			if (1)
				portb = (portb & 0xfd) | 0x02;
			else
				portb = portb & 0xfd;


			//Delay
			//Delay: 1 s
			delay_s(1);


			//Output
			//Output: 0 -> B1
			trisb = trisb & 0xfd;
			if (0)
				portb = (portb & 0xfd) | 0x02;
			else
				portb = portb & 0xfd;


		}


	}


	mainendloop: goto mainendloop;
}

void interrupt(void)
{
}



