Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/21/02 16:06
Read: times


 
#32886 - RE: PCA CEX Output
Ok, further to this I was able to find out about and set up Interrupt 6 to manually reset the PCA clock and generate the 32k frequency.

The problem I have now is that if the PCA interrupt is enabled, the serial port interrupt no longer fires.
If I disable the PCA interrupt the serial port works fine. The code I have now is:


//-----------------------------------------------------------------------------
// Initialise the timer and the serial interrupts
//-----------------------------------------------------------------------------
void initInterrupts(void)
{
EA = FALSE; // Disable all interrupts
// Serial Port
SCON = 0xD0; // serial control (SM0, SM1, REN set)
ES = TRUE; // enable UART (and Serial Peripheral Interface) interrupts
RI = FALSE; // Clear Data Flags
TI = FALSE;
REN = TRUE; // receive enable
TCLK = 0; // serial clock uses timer 1 not timer 2
RCLK = 0;
TR1 = 0; // stop timer 1
ET1 = 0; // disable timer 1 interrupt
PCON |= 0x80; // 0x80=SMOD: set serial baudrate doubler
TMOD &= ~0xF0; // clear timer 1 mode bits
TMOD |= 0x20; // put timer 1 into MODE
TH1 = 0xF5; // 9600 Baud
TR1 = 1; // Start Timer 1
// Enable ADC Lines
ADCF = 0xE6; // 11100110
ADCON |= 0x60;
// Timer
TMOD = 0x22; // 8 Bit Auto Reload Timer
TCON = 0x69; // Counter Control
TH0 = 0x59; // Set to .1ms
EX1 = FALSE; // Disable Interupt 1
ET0 = TRUE; // Enable Timer
TR0 = TRUE; // Start Timer
// Optic Clock output on pin P1_0 for CPLD @ 625khz Using Timer2
T2MOD |= 0x02; // T20E Set
T2CON = 0x00; // Clear CT2
RCAP2H = 0xFF;
RCAP2L = 0xF8; // 65536 - 8 for timer count (156 = 32)
TH2 = 0xFF;
TL2 = 0xF8; // Repeat in Timer
T2CON |= 0x04; // TR2 Run control
// Optic Clock Output on pin P1_3 for temp/humid @ 32khz using PCA
CMOD |= 0x02; // Using Internal Clock FPca/2
CCAP0H = 0xFF; // Value for compare
CCAP0L = 0xFA; // 65536 - 13 Value for compare
CCAPM0 = 0x4D; // Tog, Mat, Ecom, Int = CEX Output for Module 0 (P1.3)
EC = TRUE;// Enable PCA interrupts
CCON |= 0x40; // Start Timer with interrupts
// Enable Interrupts
EA = TRUE;
}
//-----------------------------------------------------------------------------
// Perform a manual auto reload on the PCA timer
//-----------------------------------------------------------------------------
void pcaReset(void) interrupt 6
{
CH = CCAP0H;
CL = CCAP0L;
}

I am using Timer1 for the Serial Port, Timer0 for internal routine handling, Timer2 for the 625khz output (P1.0)

The line
EC = TRUE;// Enable PCA interrupts
is the one that when enabled, stops the serial port from working. But disabling this, stops the 32khz PCA output....




List of 9 messages in thread
TopicAuthorDate
PCA CEX Output            01/01/70 00:00      
RE: PCA CEX Output            01/01/70 00:00      
RE: PCA CEX Output            01/01/70 00:00      
RE: PCA CEX Output            01/01/70 00:00      
RE: PCA CEX Output            01/01/70 00:00      
RE: PCA CEX Output            01/01/70 00:00      
RE: PCA CEX Output            01/01/70 00:00      
RE: PCA CEX Output added link            01/01/70 00:00      
RE: PCA CEX Output -- David            01/01/70 00:00      

Back to Subject List