CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

CCP2 and external interrupt

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
GagoX
Guest







CCP2 and external interrupt
PostPosted: Fri Apr 28, 2006 7:05 am     Reply with quote

Dear people, my problem is the following,

I am programing the 18F442 pic with the compiler from CCS (PIC-C).
I need to use the PWM module (CCP2) to drive a motor from pin B3.
I have to use this pin because the hardware is already designed.
ok, after a lot of efford in order to use the ccp2 in pin B3 as PWM,
(because the compiler doesn�t set properly the TRISB register, so one has to do it manually)
i have a big problem.
I also need to get the position of the motor with an encoder (channel A,B and index) that is connected to the pins (B0,B1 and B2). Normaly I would use the int_ext to get the signal, but because I am using the pwm in pin B3 as soon as I enable the external interrupt my program stops working...and of course...I understand the reason....every pulse from the pwm in RB3 provokes an interrupt.
So the question, is can I disable the pin B3 from the PWM si it doesn�t call an external interrupt while I am using it?, but of course I want the other pins from port B to call the interrupt.
I have heard it is possible but I am running out of time with this project...is it possible????
Does anyone knows.???
Or if it is not possible...what can I do?...the only thig is that I cannot change the hardware configuration.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 28, 2006 1:45 pm     Reply with quote

Quote:

Normaly I would use the int_ext to get the signal, but because I am using
the pwm in pin B3 as soon as I enable the external interrupt my program
stops working...and of course...I understand the reason....every pulse
from the pwm in RB3 provokes an interrupt


The 18F442 has three external interrupts. CCS has a different constant
for each one, as given in the 18F442.H file. None of these interrupts
are on Pin B3:
Quote:

INT_EXT: Pin B0
INT_EXT1: Pin B1
INT_EXT2: Pin B2
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group