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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/17/04 08:09
Read: times


 
#72623 - RE: P89C51RD2 PCA Interrupts Not working
Responding to: ???'s previous message
hi,

you have not indicated the vendor so I assume it is Atmel`s chip.

CMOD = 0x01 /* Enable Ints */

No, it does not enable "Ints". Bit 0 of CMOD (called ECF) enables PCA Counter Overflow interrupt only. For rest PCA interrupts there are individual bits ECCFn in CCAPMn registers. So do you really need with overflow interrupt?
Another thing about interrupts: there is one more enable bit called EC. This is PCA Interrupt Enable bit inside IEN0 register which enables/disables PCA interrupts globally. Do not forget to set it as well as EA in the same register.

CCON = 0x40/* Enable Counter */

Yes, the bit CR turns the PCA Timer/Counter on. As well this command clears CCFn bits which is the right idea.
BTW: this bit just enable/disable input of PCA clock; for detection of negative/positive transition you do not need with this bit (indeed, as long as you do not need with capture of timer value at the transition).

CCAPMn = 0x31 /* Postitive and Negative Edge Capture, Enable Ints

Here I am confused. Some lines above you wrote:

I am attempting to use the PCA in the 'RD2 chip in Negative Edge Capture mode.


So why do you allow both transitions` detections?
For negative edge it should be CCAPMn = 0x11;

Now what is about how do you process an event inside ISR? You have code not posted. May an error be there?

Regards,
Oleg


List of 10 messages in thread
TopicAuthorDate
P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
   RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
      RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
         RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
            RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
   RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
      RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
      RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
      RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      
      RE: P89C51RD2 PCA Interrupts Not working            01/01/70 00:00      

Back to Subject List