The ADuC7019/20/21/22/24/25/26/27/28/29 datasheet shows how to route the PWM0H output to an external pin on the ADuC7020 using the PLA.
But, this doesn't work for the ADuC7021. Is there another way?
Yes, this is possible.
The pin-out of the ADuC7021 is slightly different to the ADuC7020.
The following code will work for the ADuC7021:
GP1CON = 0x30000003;GP3CON = 0x30000001;GP4CON = 0x30000003;PWMCON = 0x1; //Enables PWM outputPWMDAT0 = 0x55F; // PWM Switching frequency// PLA Config
GP1CON = 0x30000003;
GP3CON = 0x30000001;
GP4CON = 0x30000003;
PWMCON = 0x1; //Enables PWM output
PWMDAT0 = 0x55F; // PWM Switching frequency
// PLA Config
PLAELM0 = 0x59; // Select Element 15 as the Input signal via Mux0, A only.
PLAELM8 = 0x35; // Select Input Pin, P3.0, Select B
PLAELM15 = 0x59; // Select Element 8 as input signal via Mux0, A only.
// Clk Source configuration
PLACLK = 0x0003; // PLA clock source - HCLK
// IRQ output configuration
PLAIRQ = 0x0015; // PLA IRQ0 interrupt source
Retrieving data ...