/*******************************************************************
* FileName:        (change filename of template).c
* Processor:       PIC18F4520
* Compiler:        MPLAB C18 v.3.06 
*
* This file does the following....                                                                 
*
* Creation and Revisions:
*      Author               Date			Comments
*   (Your name here)    
********************************************************************/

/** Header Files ***************************************************/     
#include <p18f4520.h> 
#include <stdio.h>

/** Configuration Bits *********************************************/     
#pragma config OSC = EC  // EC = External 4MHz Crystal for PICDEM board only
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config BOREN = OFF
#pragma config XINST = OFF

/** Define Constants Here ******************************************/
#define SAMPLE 100

/** Local Function Prototypes **************************************/
void goPrint(int);

/** Global Variables ***********************************************/
int sampleVariable = 0;
	
/*******************************************************************
* Function:        void main(void)
********************************************************************/
#pragma code
void main (void) {

    int try_no;
    try_no=1;
    while (try_no < 1000) {
        goPrint(try_no);
	try_no=try_no+try_no;
    }

	while (1) { }
}

/*******************************************************************
* Function:			void sample(void)
* Input Variables:	none
* Output Return:	none
* Overview:			Use a comment block like this before functions
********************************************************************/
void goPrint(int try_no) {

    if (try_no <= 500){
	printf("Hello, try %d \n",try_no);
    } else {
	printf("Goodbye, try %d \n",try_no);
    }
}