If you plan to write your own firmware from scratch, I encourage you to look at Marlin or Repetier firmware for a starting point.
If you are not a programmer and using a common electronics setup like the RAMPS/Mega2560, Repetier firmware has a menu-driven web configuration tool that does a lot of the work for you:
http://www.repetier.com/firmware/v091/ . Just open up the resultant download package in the Arduino IDE and flash it to your board.....