Abstract: A dual chamber rate responsive pacemaker with automatic mode switching between the DDD mode, the VVIR mode, and the DDIR mode, based on the difference between the average sensor rate and the average atrial rate. The primary pacing mode of operation is DDD, unless that mode is contraindicated by too great a difference between the average sensor rate and the average atrial rate. When the average sensor rate and average atrial rates are not too different, the DDD mode prevails. During bouts of sustained atrial tachyarrhythmia or atrial oversensing, the average atrial rate is greater than the average sensor rate. When that difference exceeds a programmable function of the two rates, the mode is switched to VVIR to avoid tracking high atrial rates. Conversely, if there is atrial chronotropic incompetence or atrial undersensing, then the average sensor rate is greater than the average atrial rate.