|
|
View previous topic :: View next topic |
Author |
Message |
GagoX Guest
|
CCP2 and external interrupt |
Posted: Fri Apr 28, 2006 7:05 am |
|
|
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
|
|
Posted: Fri Apr 28, 2006 1:45 pm |
|
|
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 |
|
|
|
|
|
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
|