How do i use Arduino v1.0.2 software to program uc from a different programmer?

I have AVRuPro+ programmer board that i use to program my ATmega's from. Now, i have this code i'm working on which i assume for the sake of simplicity i would be building using arduino libraries. Since, i use Arduino libraries it becomes essential to use Arduino vx.x software to compile the code in. So, i was wondering if there is a way to use the Arduino software with the same programmer without buying and using an Arduino board maybe?

The board has a 8Mhz crystal on it, and supports speed of programming upto 5KBytes/sec and the it's SCK option is supported to targets with low clock speeds(<1.5Mhz)

A little help would be really appreciated. Thanks in advance. :wink:

Write your source code in Arduino IDE, compile it and generate the hex file. Then use avrdude and your programmer to burn the hex file into your AVR.

Steps:

  • In Arduino 1.0.1->Files->Preferences check "Show verbose output during compilation". This will display a lot of information, when the code is compiled, including the location of the hex file.

  • Go to File->Examples->01.Basics and load Blink example. This will be considered as your source code.

-Go to Sketch menu and press Verify/Compile.

  • When the compilation completes search in the lower side of the screen the path of the generated Blink hex file. It looks like this one:
    C:\Users\Victor\AppData\Local\Temp\build1325897986179133197.tmp\Blink.cpp.hex

  • Select it with the mouse and press Ctrl-C followed by a Paste in Notepad, for instance. You will need the path for avrdude.

Read also point (4) from here: http://pdp11.byethost12.com/AVR/ArduinoAsProgrammer.htm

That seems really helpful. Thanks alot :smiley:
I went through with the steps and now i can access the required hex file for the code i wrote. :slight_smile:
I am ready to upload it into the microcontroller through the ISP i currently have(which is not an arduino hardware), but just one more thing before i do that is, i don't actually have to go through with the bootloading within my ISP to use this hex file, do i? :~
What makes me ask this is that the compiled hex file is from an Arduino based software and the code uses arduino libraries but the ISP hardware is not arduino and i want to avoid all complications before i proceed.
And thanks again, that was really helpful. :slight_smile:

K_Paresh:
i don't actually have to go through with the bootloading within my ISP to use this hex file, do i?

You do not need any bootloader.
The hex file you have just generated can be loaded into your AVR using your programmer like any other hex file generated by other IDEs different from Arduino. The hex file will work, as it is, stand alone. It does not need bootloader.

I have stuff here about programming chips which are not on an Arduino board:

umm.. Simplex, i did the hex file thing, successfully compiled, successfully burnt on the chip through cmd first and then even through a different program directly.
But i dont know what's going wrong, when i try to blink the led on any pin of the uc it doesn't happen. The code is being written and verified succefully though but there is no voltage showing up on the respective pins of the uc that i'm trying to use. Can you please help on where am i going wrong or where does the problem lie?

Nick, that was really great letting me know about those methods on your part and i am really thankful for it but sadly i don't have an Arduino Uno board to upload a bootloader on the desired chip through, infact that is where the problem lies, i want to use just the Arduino IDE with some other ISP. :slight_smile:

K_Paresh:
The code is being written and verified succefully though but there is no voltage showing up on the respective pins of the uc that i'm trying to use.

Show the code please. Inside code tags.

For now i was talking about the one in the > File->Examples->01.Basics > Blink example. Even this wont work, and so wont the PID code i wrote which i was earlier trying to use.

Here is the blink example which is in the arduino IDE, and i suppose there's nothing wrong with the code as it's even being compiled without any error's :

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 1;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

Do you want me to link the PID one too? Well, i think once i figure out how to make this one run, going ahead with the PID one wont be a head-ache.
Also, i tried using the : Tools > Board > "Arduino Uno" as well as switching over to "Arduino NG or older /w ATMega8" because the ISP i have is fixed with an ATMega8L but that too wont solve the problem. Please let me know what i'm doing wrong. :sweat_smile:

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 1;

Please ignore the different number's there, it was 13 actually but in the main board 12 and 13 have the crystal attached to them, so i was using different pins when it wont glow on any(1, 5, 7, 38, 39, 40) of those, i tried like almost every free pin on the uc. :.

K_Paresh:
i did the hex file thing, successfully compiled, successfully burnt on the chip through cmd first and then even through a different program directly.
But i dont know what's going wrong, when i try to blink the led on any pin of the uc it doesn't happen.

  1. What is your target AVR?

  2. The code have to be compiled for your specific target AVR (atmega). If you compile it for Arduino Uno that has an atmega328p on it and your target AVR is different the hex file will not work.

  3. Also, the pins in the code like "pin 13", for example, are the pins of an Arduino board not those of the AVR mounted on it. "pin 13" is connected to a physical pin of the target AVR that is not 13.

The code have to be compiled for your specific target AVR (atmega). If you compile it for Arduino Uno that has an atmega328p on it and your target AVR is different the hex file will not work.

Yeah, i sort of thought of it which made me try changing the board in there. The ISP i have has an ATMega8 but it is used to program the main board which has an ATMega16 on it, so i suppose by target avr it would be ATMega16 then, Right? But then again i guess i don't find any board for the same in the list there.

And for the pin, if those are the pins of the arduino board how would i specify the one's of the target avr?

P.S. Please ignore the stupidity, i am really new into all this arduino thing. :cold_sweat:

K_Paresh:
so i suppose by target avr it would be ATMega16 then, Right? But then again i guess i don't find any board for the same in the list there.

Yes, your target AVR is an Atmega16.
I simply do not know if you can compile code for Atmega16 with Arduino IDE.

And for the pin, if those are the pins of the arduino board how would i specify the one's of the target avr?

You have to take the schematics of the Arduino board (ex. Arduino Uno board) and see which physical pin of the microcontroller on it (atmega328p) corresponds to which pin of the board.

As a remark: Arduino IDE is designed to compile code for the boards it has in its list. Everything else is a kind of hack and you run quickly into huge complications.
You will be much more efficient if you work with BASCOM, Code Vision or AVR Studio.

I simply do not know if you can compile code for Atmega16 with Arduino IDE.

So that simply means i'm screwed now. I'll try to give it another shot that way and if it doesnt work i'm gonna switch back over to the older IDE.

You will be much more efficient if you work with BASCOM, Code Vision or AVR Studio.

As a matter of fact, i was first using the CodeVisionAvr for compiling and building the code but the problem is that i have this PID thing which is part of the code, and i have used the Improving the Beginner’s PID – Introduction « Project Blog Brett's library to make that part of the code which is an Arduino library, without which putting up the PID code turns out to be a real head ache.

But yes i also noticed bringing out the rest of the code into Arduino IDE and there are complications with that too. I'd possibly have the headache in writting the PID again than going through modifying the whole code.

Still, if you can help me fabricating the PID part, that would be great. Thanks again :slight_smile: