Понадобилось переключить aduc на внешний кристалл, в даташите пишут:
Код
To switch to an external crystal, users must follow this procedure:
1. Enable the Timer1 interrupt and configure it for a timeout period of >120 μs.
2. Follow the write sequence to the PLLCON register, setting the OSEL bits to [10] and clearing the EXTCLK bit.
3. Force the part into nap mode by following the correct write sequence to the POWCON register.
4. When the part is interrupted from nap mode by the Timer1 interrupt source, the clock source has switched to the external crystal.
Example source code
T1LD = 0x80; // 32,768 clock ticks
T1CON = 0xC0; // Periodic mode, enable timer, 32,768 Hz clock/1
IRQEN |= 0x10; // Enable Timer1 interrupt source
PLLKEY1 = 0xAA; // Switch to external crystal
PLLCON = 0x2;
PLLKEY2 = 0x55;
POWKEY1 = 0x1; // Enter nap mode
POWCON0 = 0x73;
POWKEY2 = 0xF4;
Сделал простейший код, генерирующий импульсы на P0.2, когда вставил в него приведенный кусок - импульсов нема. Ощущение, что ядро не выходит из power-down. Почитав еще немного, заметил, что хотя везде говорится про "nap mode", в примере получается не "nap" а "pause". Поменял. Не работает. В какую сторону копать?