A lot of people feel, howbeit superficially, that they "get" NPN operation - the NPN conducts when its Base is at a potential more positive than its Emitter. Understanding a "high-side switch" supposes knowledge of PNP transistor operation.
Comparatively, the PNP is a little understood device. Looking back at some textbooks, they're never presented inside the "+V and GND" paradigm. The PNP is presented with an electrode connected to a negative voltage (gasp!), which provokes apoplexy and panic, or it gets mentioned in passing ("..there are PNP transistors, too, but you won't see them much and I don't like them, so let's move on..") and so is left to languish in obscurity, something to be avoided (ley de hielo.)
The PNP conducts when its Base is at a potential less positive (more negative) than its Emitter. Equally important, but what's not grasped, is that it does not stop conducting till its Base is at or near its Emitter - just as an NPN does not stop conducting till its Base is at or near its Emitter. When the PNP's Emitter is at +12V, you cannot turn it off by presenting +5V to its Base - because 5V is still less positive than Emitter potential (in fact, 7 volts less positive).
Here our PNP is configured Common Emitter (and definitely not to be confused with an "Emitter Follower" - a/k/a Common Collector). It's a "high-side switch", it opens/closes the current path to +V.
The NPN switches the PNP's Base. The output enable, the input to the NPN's Base, is a logic-level signal from a microcontroller.
The 22KΩ pull-up to +12 biases the PNP off. When the NPN is biased on, its Collector goes to Ground, taking the PNP's base, via its RB, to Ground (a potential much less positive than +V) which turns it on.
The PNP's IB = (+12V - VBE) / 4K7. The PNP IC, the current available to the load, is basically = hFE * IB
When little current is drawn, VCE is negligible. As IC increases, so does VCE. In my test circuit, using a 2N3904 (NPN) and a 2N3906 (PNP), VCE was 200mV when IC = 200mA.
- an "anode driver" in a LED matrix
- a MOSFET driver
- in an H-bridge
The advantage over grabbing something ULN/UCN/UDN is that you may likely have these components on hand.
And, you learn something.