I am using Atmel Studio 6.1 and ANDLoad to flash ATMega16 MCU. If I compile code with this function called, ANDLoad gives me "Error in Flash Hex File 359". 359 line is 3rd line from the end of hex file. If I call function with no code inside it works nice, but I has no point. Adding only one line of code gives me error again.
I call it like this:
start(maxSpeed, 0, speed_1); //function call
//CODE//
void start (uint8_t maxSpeeda, uint8_t dir,uint8_t speed){
uint8_t ii=0;
if (dir==1)
setbit(PORTD,6);
else if (dir==0)
clrbit(PORTD,6);
OCR1A = 0xFFFF; //set low frequency of PWM
TCCR1A |= ( (0<<COM1A1) | (1<<COM1A0) ); //PWM generator ON
tqOFF(); //Enable 100% torque
for (ii=0; ii<maxSpeeda; ii++){ //linear start of stepper motor
OCR1A = tab[ii]; // Tab of 16-b OCR1A values for linear start
_delay_ms(speed);
}
}
Do anyone has idea what am I doing wrong? Thank you. David