At some point you're going to have to come to grips with what motivates you. Writing code just for the sake of writing code will always get old eventually.
Find a company where you can see the purpose of your work. Where work is something other than a constant stream of assignments to be completed. If all you do is assignments, the work will never be fulfilling. Make sure that your work drives the success of the business/effort that you're working for.