Image by solidxsnake13224 via Flickr
In 1967, behavioural psychologists Martin Seligman and Steve Maiers discovered quite by accident (while investigating simple conditioning) that dogs which were unable to escape from an unpleasant situation (small electrical shocks given through the floor of their box) gave up even trying. They were conditioned to be helpless, and would just lie there and take the shocks even when free to move.
The ethics and humanity of the experiment are a topic for another time, but they gave psychologists a valuable insight into one of the causes of depression and demotivation - learned helplessness.
Fortunately decades of behavioural research have also shown that what has been trained can be untrained. You just need to create a string of situations where you are visibly achieving what you set out to do.
Set yourself well-defined goals
Keep your successes visible