Problem I can't solve from main.c to sketch

Hello eveybody. My name is Frank and I have a problem.

I have some code I used before to program an AT tiny but this is written in C+. My problem is that I want to use te code of the main.c file into sketch because I bought a Arduino Uno. If i copy and paste all of it and and press check it gives me all kind of errors. First of all I didn’t write the code myself. I downloaded it from mosfetkiller.de and is free to use. As for electronics I am not new to it, but to solve these error in the code I have not enough knowledge of it. The code could not be copyed here because it’s to long. I have attached the file in my post.

I hope that somebody is kind enough to help me on the way with this.

Regards,

Frank Geleijns

main.c (12 KB)

The code seems not be one for arduino.. Try winavr compiler or something like that..

ADCSR -> ADCSRB PORTA _> PORTwhatever.

etc

Try using AVR studio.

Mark

holmes4: Try using AVR studio.

Mark

Hello Mark,

So you are telling me that with AVR Studio I can program my Arduino and it will work. I user AVR Studio before to program the ATtiny26 to use this code. The only problem is that I want to use the code in my Arduino Uno. If you tell me this can, then I will try that.

Thanks in advance,

Frank

Of course AVR studio can be used to program the UNO (and all the rest bar the linux processor of the YUN).

Mark

So I will not get the errors like before in sketchup. What about the pinouts of the microchip because it's written to use the ATtiny 26. and the Arduino uses the ATMEGA328P. But I will try it with AVR Studio to see what happens. For now thanks for your quick replies and a wishfull, happy an healthy 2014.

Frank

fgel:
I have some code I used before to program an AT tiny…
I user AVR Studio before to program the ATtiny26 to use this code.

ATtiny84?

My problem is that I want to use te code of the main.c file into sketch because I bought a Arduino Uno. If i copy and paste all of it and and press check it gives me all kind of errors.

The errors are because the Uno lacks some of the ports / registers (e.g. it has no I/O port A) and has different names and locations for various registers and bits.

As for electronics I am not new to it, but to solve these error in the code I have not enough knowledge of it.

You are very likely going to have to learn.

I hope that somebody is kind enough to help me on the way with this.

Help? Yes. Port the code to the ATmega328 processor for you? Not I.

holmes4: Try using AVR studio.

It won't help. And, the Arduino IDE is a reasonable choice.

This is more complex than just using another dev tool - the code seems to use registers that dont exist on a 328P (looks like it might be intended originally for an Atmega16)

So even if you managed to get it compiled somewhere else, it wont run on a UNO if it uses hardware features that a UNO doesn't have!

This topic may help, but the answer isnt going to be quick or simple!

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=394800

Thanks BareMetal,

I will take a look into these comparision docs to see if I can solve the problem.

Frank