Programming Arduino without IDE and setup() etc. functions

Hello,

I'm considering buying an Arduino Uno and use it as a motherboard in my 5DOF Robotic Arm project. I'm not quite good in making PCB's (actually, I've neved done this before), deadline is coming faster and faster and also Arduino has built-in all needed parts (capacitors/resistors/crystal oscillator etc.) to run ATmega32's without much work on it so I thought I can use it as ordinary evaluation board.

Only problem I have is that I'm not quite sure how can I write a program on Arduino without using all this "setup()", "loop()" and other functions and instead of this use pure-C commands as PORTA |= (1 << 4) etc. I see that there are ISP ports (either for ATmega32 and ATmega16) but I'm afraid I will erase some important things on uC and something will explode if I use Atmel Studio or WinAVR tools :smiley:

Can someone help me and tell is there a way to simply programme uC on Arduino via ISP without crushing something? And if there is a way, can you tell me how to make it? Also, just in case, will there be a way to "reset a board to fabric" (you know, write back a bootloader and other stuff) if I do things explained above?

~greeqmaster

uhhhhhh you got me very interested too haha, i am sure its possible. but unsure on if your project will explode......

what programmers do Atmel Studio or WinAVR tools support? do you have those already? did you check how to program AVR ATmega32 chip without bootloader of arduino, i mean are you already setup? if you have a setup and pretty ready to program, can you provide the way your doing it / going to do it. that way we are able to tell if it will explode or not 8)
nick

You can do that:

int main ()
  {
   
  // do stuff here
  
  }

I'm afraid I will erase some important things on uC and something will explode if I use Atmel Studio or WinAVR tools

I doubt that, but I would stay away from playing with the fuses until you know what you are doing.

Thank you for your response, guys.

I haven't got Arduino yet. I'm just considering buying it (I edited first sentence before your posts :D) and I almost sure I will buy it but I'm just... You know, afraid of THINGS.

Couple of minutes ago I downloaded Arduino IDE and wrote simple:

#include <avr/io.h>

int main()
{
  while(1)
  {
    PORTC |= (1 << 3);
  }
}

It was veryfied and compiled and I'm really happy because of this but I still don't have physical board in front of me so I'm still not sure if it will work.

Nick G. - can I write such (yours or mine) program to Arduino via USB cable? I don't have to use this setup() etc. stuff?

Sure you can, if it has a bootloader on it, like the Uno does.

You know, afraid of THINGS.

Aren't we all?

If you want to get closer to the hardware, see my post about breadboard Arduinos.

You know, afraid of THINGS.

oh, trust me, i know that too hahaa, especialy on low budget that feeling will be back to haunt you :smiling_imp:

but very interesting to use int main(){} , thats the same as c++'s scope hell i didnt know IDE suported this, i feel happy now :D!!

nick

Barebone, i made it too, it gives good insight yes. i recommend it.

Haha, yeah!

nickn4:
oh, trust me, i know that too hahaa, especialy on low budget that feeling will be back to haunt you :smiling_imp:

That's the point. Still the student. Still not sleeping on the money :smiley:

Nick G., I saw Arduino documentation, I knw the wirings etc. and I think I even would be able to create my own one. But as I said in my first message... Deadline :frowning:

One last thing - I removed "#include <avr/io.h>" line and it still compiles - in Atmel Studio I receive a message that it is an error - why doesn't Arduino IDE report me a similar one? I just want to have full control over a program file - here I see that IDE add a library itself - can I modify this somewhere? In File->Preferences window I don't se any useful options, in "Preferences.txt" also...

And also, with electronics I'm still on the level where I understand schematics, I know what is what but I'm still afraid I can destroy something even if I know it's probably impossible. That's why I'm asking all of these questions..

the compiler avrdude suports lots of extra arguments, i dont know if you will find anything, but i think it will be worth for you to look into "Command Promp Line" compiling with AVRdude

see
http://www.nongnu.org/avrdude/
and

edit; new link

nick

I know avrdude, I even use it sometimes via commad line, for example for changing fusebits what I can't do with USBasp programmer + Atmel Studio 6.
What I'm trying to understand is tha fact if I can do some "deeper things" via Arduino IDE :smiley:

Anyway, thank you for your response :slight_smile: