Get yourself an enormous piece of paper (butcher paper, or something from an art store), and make a big drawing, in pencil, of the entire project and how everything will fit together. Do it at an appropriate detail level to fill a good portion of the paper.
This has multiple benefits... it gets all your ideas written down, it gets the project organized (and helps identify potential problems before they're in code), it makes for nicely visible pieces of a larger puzzle, and, perhaps most importantly, it gets you away from the computer where you have coder's block.
The one best piece of code I've ever written, which had all sorts of interprocess communication and synchronization problems to overcome, etc., I started with a big drawing, which lent itself very nicely to a fully pseudocoded skeleton of the program (fully doxygened and line-by-line commented before any code went in), followed by the actual code, which practically wrote itself at that point. Not only did this keep the process going, but it also helped me eliminate and compensate for a whole bunch of technical and design issues, before I had even written the code that I would have had to fix. After addressing a few rogue syntax errors, the program ran correctly the first time.
Unfortunately, while effective, this process left me completely spent. Having written what was, by my standards, a perfect piece of code, I saw little further for me to accomplish in my career, and I was especially devastated when I saw that it was fairly likely that my contribution would not make it into the final product. A mere shell of a programmer remained, and I have steadily lost interest in programming since. I'm enrolling in graduate school for music in the fall.