There is two ways to comunication between CPU and periphals: A) Polling - CPU ask periphals about its' state B) Event - CPU waiting to interrupt from periphal, and then CPU trigger handler. Every periphal have they own handler, and it's separate program. It's calling automatic, programmer don't call it.