So, back to basics then.
Make sure you don't have anlog functions enabled on the pins you're trying to use. Verify that you can control the state of each indivivual pin that you're using.
After that (or before if you'd rather) it's time to hook up the scope or logic analyzer to verify that what you get is what you want.