Could someone please help me convert to .hex?

Hi, I have a .c file and have been trying to convert it to a .hex file so that I can upload it to an Arduino using avrdude, but I keep getting a bunch of errors from the compiler.

Could someone please tell me how to convert this code into a hex file?

Thanks :)

This is not an arduino source code file. It contains machine specific registers so it will only run on the processor it was designed to run on what ever that is.

The line :-#define FOSC 12000000L Suggests a 12MHz crystal, an arduino has a 16MHz one so all the baud rate timings will be off.

Do you want it to run on an arduino?

If so the best bet is to simply copy it into a window in the arduino environment and try and compile it, which it won't but then try and work through the errors. Better still write it from scratch using the arduino DMX library.

Hi, this code was designed to be run on an ATMega8-P.

I was going to use the Arduino DMX library, however is contains no functions to read, and I'm not experienced enough to code it myself.

Remove the "main", move "init_port", "init_usart" to "setup" (and translate to "Serial") is the first thing to do. See where you go from there. Without knowing what you've done or what errors you're getting, it is difficult to help further.