#include "../mscbemb.h"#include "pca_internal.h"Functions | |
| void | pca_operation (unsigned char mode) |
| void pca_operation | ( | unsigned char | mode | ) |
00017 { 00018 // signed char i; 00019 if (mode == 1) { 00020 // PCA setup for Frequency Output Mode on CEX0 00021 // Set P0.4 as CEX0, requires RX/TX+SDA/SCK to be enable in the XBAR0 00022 SFRPAGE = CONFIG_PAGE; 00023 P0MDOUT |= 0x10; // Add pin 4 (CHG_PMP_CLK) to PushPull 00024 XBR0 = 0x0D; // Route SMB (SDA and SCL); Route UART (TX and RX);and Route CEX0(CHG_PMP_CLK) to their pins 00025 XBR2 = 0x40; // Enable Xbar 00026 00027 SFRPAGE = LEGACY_PAGE; 00028 PCA0MD = 0x02; // Sysclk (default CKCON [2MHz]) 00029 PCA0CPL0 = 0x00; 00030 PCA0CPM0 = 0x46; // ECM, TOG, PWM 00031 PCA0CPH0 = 10 ; // (for ~2MHz) 00032 PCA0CN = 0x40; // Enable PCA Run Control 00033 00034 } else if (mode == 2) { 00035 SFRPAGE = LEGACY_PAGE; 00036 PCA0CN = 0x00 ; //Turn off the PCA counter 00037 00038 } else if (mode == 3) { 00039 SFRPAGE = LEGACY_PAGE; 00040 PCA0CN = 0x40 ; //Turn on the PCA counter 00041 } 00042 00043 }
1.4.7