A PCA device is programmed by healthcare professionals to deliver a pre-set dose of pain medication when the patient presses a button. The device is set with specific limits to prevent overdosing and ensure safe administration. The medication is typically delivered via an intravenous (IV) line, but can also be administered through other routes depending on the patient's needs.