I kind of thought that beginners need advice on programming. Now I think that beginners need advice on simple debugging. Well, same thing, but every tutorial forgets the debugging part.
Step Zero:
Never trust a simulator.
You can simulate things, but first you need to know the component you are simulating.
You can't learn the component by simulating.
Step one:
Write a simple program that blinks a LED..
If that works, check that the timing is ok. Make the LED blink at 1 Hz interval and time it..
If that works.. you can be almost sure that the chip is ok and CPU frequency is (probably) correct.. Sometimes when the chip just resets itself it can look like everything is ok.