Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

AVR Studio breakpoints

2012-08-19 by englsprogeny1

As some of you know, I'm migrating to include AVR studio in my projects, instead of just what comes with WinAVR

Below I try to set a breakpoint but AVR Studio moves this breakpoint down:


I set the breakpoint at the line:  PORTA = inputButtons;

but AVR Studio moves this breakpoint down to PORTA = ~counter;


Looking at the code I do not believe that the line that I want to break on is optimized out.

Why is AVR Studio moving my breakpoint?

Thanks for any input.


//----- Include Files ---------------------------------------------------------
#include <avr/io.h>		// include I/O definitions (port names, pin names, etc)
#include <avr/interrupt.h>	// include interrupt support
#include <avr/signal.h>
#include <avr/delay.h>


unsigned char localBufferLength = 0x20;

unsigned char dataRead;

void PrintMenu(void);
void ProgMain(void);

//----- Begin Code ------------------------------------------------------------

int main(void)
{


	//Port A is output
	DDRA=0xFF;	
	
	
	//Port A is input
	DDRB=0x00;	
	PORTB = 0xFF;  //Pullups
	
	ProgMain();
	
	return 0;
}


void ProgMain(void)
{
	
	unsigned char counter = 0;
	unsigned char inputButtons;
 
	while(1)
	{
	
		_delay_ms(20);
		
		inputButtons = PINB;
		
		
		if(counter<255)
		{
			counter++;
		}
		else
			counter = 0;
		
	
		inputButtons = inputButtons & 0x0F;
	
		if(inputButtons != 0x0F)
		{
		
			PORTA = inputButtons;
		}
		else
		{
			PORTA = ~counter;
		}
	
		
			
	}
		
		

		

	


}

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.