Ok, take the heaiest based pan you have. Pour in sugar, place over a low to medium heat, and shake the pan as it starts to caramelise on the bottom. Never stir as this causes crystalisation. When all the sugar has melted and colour is uniform, plunge the base of the pan (with care) into iced water to stop the cooking process. Do with it then whatever you need. For non-coloured sugar work, dissolve sugar with equal amount of water, bring to a rapid boil. Using a thermometer to record the temperature, brush the sides of the pan regularly with a pastry brush and clean water. This prevents crystisation. once required temp is reached, plunge pan (again, with care) into cold water to stop any further cooking
You start with a little bit of water to make a syrup. That way the sugar heats more evenly, can be mixed so that there is a minimum of burning. By the time you get to hard crack stage, all the water is gone.
Very low heat.
Use a thick pan/pot.
The idea is that you don't want the sugar to burn. If you have any hotspots, it will. The thick pan will create an evenly heated surface. Low heat will give the sugar a chance to heat up uniformly. Stirring constantly will help distribute heat from hotter areas to cooler areas in your sugar. If you continue past melting, the sugar will start to brown. This will give it a different flavor.
Good Luck! ...and post your results as an I'ble :D
What is it being melted for?
I would have it on a low heat in a heavy bottomed pan if you have one and never ever stir it, That might be where you went wrong!