That doesn't mean the code isn't the problem - for example if the I/O pins are set as open-collector that could well cause problems as the voltage increases.
However, as this is the ARM forum, why does your diagram show a PIC18F? - I would also assume an ARM is 3.3V only, and you can't feed the PNP transistors from much higher than that or they will always be ON, just like you're experiencing.
THis is why you need to post exactly what you've built, and not a schematic for something totally different.