View previous topic :: View next topic |
Author |
Message |
will
Joined: 28 May 2012 Posts: 24 Location: france
|
interruption |
Posted: Mon May 28, 2012 8:15 am |
|
|
Hello
I try to make a break with two micro switches.
The program compiles fine but no detection. The LED does not light either.
why??
My program:
I put all my interruptions, see bold character
}
}[/b]
Thank you very much.
Last edited by will on Thu May 31, 2012 5:02 am; edited 2 times in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Mon May 28, 2012 8:22 am |
|
|
Three things:
if (droit)==0) {
Needs to be
if (input(droit)==0) {
Second, you are not enabling INT_RB.
Third, you are 'pushing' the interrupt speed for your timer. Technically you could be interrupting about every 285 instructions. Depending on what is in 'mot_generation_pwm', you may not have any time to actually do much else.....
Best Wishes |
|
|
will
Joined: 28 May 2012 Posts: 24 Location: france
|
|
Posted: Mon May 28, 2012 8:30 am |
|
|
thanks
Quote: |
Second, you are not enabling INT_RB.
|
why?
I do not understand, what should I do? |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1358
|
|
Posted: Mon May 28, 2012 7:23 pm |
|
|
you have an interrupt service routine setup for RB but never turn it on with enable_interrupts() like you do the other interrupt. |
|
|
will
Joined: 28 May 2012 Posts: 24 Location: france
|
|
Posted: Tue May 29, 2012 4:56 am |
|
|
thank you
like this? but it does not work.
Last edited by will on Thu May 31, 2012 5:02 am; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Tue May 29, 2012 5:32 am |
|
|
You've really only shown us part of your code.
You do have a main ? |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Tue May 29, 2012 5:36 am |
|
|
Read the CCS forum guide.
Learn to use the code buttons.
Post a SHORT but complete compilable version of you code that we can test.
Give us some idea of your schematic.
Mike |
|
|
|