View previous topic :: View next topic |
Author |
Message |
yie23
Joined: 09 Dec 2010 Posts: 11
|
help me with interrupt |
Posted: Thu Dec 09, 2010 3:18 pm |
|
|
Code: |
#include <16f877a.h>
#use delay(clock=200000000)
#fuses hs,noprotect,nowdt,nolvp
#byte portb=6
void main(){
set_tris_b(0b00000000);
enable_interrupt(INT_EEPROM);
enable_interrupt(global);
do{
output_high(pin_B1);
delay_ms(2000);
output_low(pin_B1);
delay_ms(2000);
}while(1)
}
|
what's wrong with my coding ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19516
|
|
Posted: Thu Dec 09, 2010 3:57 pm |
|
|
You must _never_ enable an interrupt, without the code to handle it being present.
Why on earth, do we seem to have dozens of posters, suddenly trying to use 'interrupts' for things that they are not designed for, without the first idea of reading the data sheet, and some basic books about processor hardware first...
|
|
|
yie23
Joined: 09 Dec 2010 Posts: 11
|
|
Posted: Thu Dec 09, 2010 4:01 pm |
|
|
im very sorry , but this is my homework .that's why im really need help here . this work's covers 20% of our grade . |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19516
|
|
Posted: Thu Dec 09, 2010 4:07 pm |
|
|
Then _you_ need to do the learning.
Sorry, but my niece was handling code better than this at 5 years old. Her biggest problem was spelling the instructions, a custom dictionary to the spelling checker soon solved that.
_Everything_ you need to know, is available on the web, with some research, this is _not_ a schoolroom, it is a group to _help_ people having specific problems with the CCS compiler. Your questions are far more basic than this... |
|
|
yie23
Joined: 09 Dec 2010 Posts: 11
|
|
Posted: Thu Dec 09, 2010 4:10 pm |
|
|
Hahaha, ok. Thanks a lot for your comment. It goes straight to my heart. |
|
|
|