ATMEGA328P Custom Designed Board, Codeblocks IDE and USBAsp Programmer

Hi Friends,

I have an ATMEGA328P Custom designed Board. The microcontroller does not has bootloader installed. I am using Codeblocks IDE for Arduino and using an external usb programmer USBASP to program the ATMEGA328P microcontroller.

I am using following code to blink an led:

#include <Arduino.h>

/*
  Turns on an LED on for one second, then off for one second, repeatedly.
*/

void setup()
{
	//Serial.begin(9600);

	// initialize the digital pin as an output.
	// Pin 13 has an LED connected on most Arduino boards:
	pinMode(13, OUTPUT);
}

void loop()
{
	//Serial.println("Hello world!");

	delay(1000);              // wait for a second
	digitalWrite(13, HIGH);   // set the LED on
	delay(1000);              // wait for a second
	digitalWrite(13, LOW);    // set the LED off
}
  1. I select Arduino UNO in Codeblocks IDE,
  2. and then press Build Button to compile
  3. I then select upload via usbasp option from Tools > Upload Via USBasp

The code gets compiled successfully, and also gets programmed successfully. But the led blink runs very slow. It looks like as if the blink time is 10 times slower than what it should be.

Can anyone suggest what may be wrong with Codeblocks IDE that it generate a code which is slow?

Kind Regards
Asim

(deleted)

Thanks spycatcher2k for great tip!

I have googled programming fuse in code but dont seems to land into solution.
Can someone suggest, how can i set fuse (lfuse, hfuse, efuse) bits in code? are there any #pragmga type of keywords that could be used for setting the fuses? or are there any library functions that i can use for programming fuses?

Regards

Use the IDE to burn the Uno bootloader, that pulls in the correct fuse values from boards.txt for 16 MHz operation.