You never want triangles on a mesh you are going to subdivide as they will result in pinching.
The images above seem to have some, introduced by the bevel tool probably.
Using a pair of edge loops to sharpen the rings, and then a pair of edge loops top and bottom per crenelation you can get close to the shape you want. But there is some blockiness when you look down from top view.

If you want a smoother circumference, you can
-select the face loop you have inset near the top and hide them. (Hiding faces will prevent edge loops from continuing past them when added.)
-Add some additional "spoke" edge loops as shown. As there is one ring hidden, the loops won't cross the entire object, creating some ngons in the inset area.

-Scale the new short edge loops up just slightly on the not z. scale the entire section above the hidden faces down about half that much to split the difference
I know, I just said don't use triangles and then here I go introducing poles in to your mesh, but they are nicely tucked away, it works and it's easy :P


http://www.pasteall.org/blend/31346
Source: I just finished watching 4 hours worth of topology videos by Jonathan Williamson, the cg cookie guy.