This paper addresses the optimal control problem of the continuous-time piecewise affine (PWA) systems with autonomous switching executed at each sampling time, which we call sampled-data PWA systems. In particular, an optimal continuous-time controller is derived for a more general class of sampled-data PWA systems, which are controllable but whose subsystems in some modes may be uncontrollable in the usual sense. Furthermore, as an application of this approach, we formulate the high-speed and energy-saving control problem of the CPU processing, and show the validity of the approach.