Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Tinybootloader GOTO problem

Status
Not open for further replies.

lihker

New Member
i having a problem with tinybootloader, it show me this:

Connected to \\.\COM1 at 19200
HEX: 3 min old, INHX8M,16Fcode+cfg, total=384 bytes.
Searching for PIC ...
Found:16F 876A/877A
WARNING: GOTO not found in first 4 words!
If using a compiler, maybe you should write some directive to enable the use of bootloaders, or maybe you could fix it by adding an interrupt handler to your program.
Overwriting bootloader denied
ERROR!

I am using MPLAB to write c code how do i write some directive to enable the use of bootloaders? below is my program code. Hope anyone can help me.

Code:
#include <pic.h> 


//========================================================================
//	Configuration
//========================================================================
__CONFIG ( 0x3FF2 );				//configuration for the  microcontroller

//=========================================================================									
//	Define
//=========================================================================
#define	Led Display		PORTB			//D0~D7
#define Keypad			PORTC			//K0-K6

//===========================================================================
//	Function prototype				(every function must have a function prototype)
//===========================================================================
void delay(unsigned long data);			
unsigned char colScan(unsigned int);	
	
//	main function						(main fucntion of the program)
//==========================================================================
unsigned int val=0xFF;					// Initialization

void main(void)
{

//set I/O input output
TRISA = 0b00000000;						//configure PORTA I/O direction
TRISB = 0b00000000;						//configure PORTB I/O direction
TRISC = 0b11111111;						//configure PORTC I/O direction
PORTB=0x00;
//program start
	while(1)
{							//Infinity Loop
	// Scan row 0
  		  	PORTC=0xFE; 		// make row 0 low
   		val = colScan(0);				// Scan column
			
			// Scan row 1
  			if(val == 0xFF)				// if no key press scan row 1
			{
	      	PORTC=0xFD; 		// make row 1 low
       		val = colScan(1);				// Scan column
			}

      // Scan row 2
  			if(val == 0xFF)				// if no key press scan row 2
			{
  			   PORTC=0xFB; 		//	make row 2 low
  				val = colScan(2);				// Scan column
			}
     
      // Scan row 3
  			if(val == 0xFF)				// if no key press scan row 3
			{
 			   PORTC=0xF7;		// make row 3 low
		   	val = colScan(3);				// Scan column
			}
			
							
				
			// if got keypress display to output
			if(val != 0xFF)
			{
				delay(2000);					// Switch debounce
				val|=0x80;						// Enable 7-segment
				PORTB=val;			// Output to 7 segment
			}
}
}

//===========================================================================
//	Functions
//===========================================================================

void delay(unsigned long data)			//delay function, the delay time
{										//depend on the given value
	for( ;data>0;data-=1);
}


/*************************************************
*
*      Column scan
*		- Argument: The row number (0 to 3 only)
*		- Return: key value pressed. (0xFF for no key pressed)
*
*************************************************/
unsigned char colScan(unsigned int row)
{
	unsigned char input, output, colCheck;
	output = 0xFF;					// Set no key press value

	row = 1 + row * 3;			// Calculate the value
	input = PORTC;		// Get input from keypad
	
	colCheck = input & 0x10;	// Scan column 0
	
	if(colCheck == 0x00)			// Check if got key pressed
		output = row;				// Set value
	
	colCheck = input & 0x20;	// Scan column 1
	
	if(colCheck == 0x00)			// Check if got key pressed
		output = row + 1;			// Set value
	
	colCheck = input & 0x40;	// Scan column 2

	if(colCheck == 0x00)			// Check if got key pressed
		output = row + 2;			// Set value
	
	return output;					// Return value
}
 
Try adding this

Code:
void interrupt Do_goto(void)
{
}

That should make a a goto at the start
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top