??? 11/23/09 11:21 Read: times |
#171059 - Another Program to test my interrupt !! Responding to: ???'s previous message |
to check out my interrupt pin if it is working or not, i mads this small program but the LED's are still not glowing. The program should light up the LED for 9 mili-seconds and then switch it off for 1 mili-seconds and this cycle should continue infinitely. But the problem is that the LED's are not glowing. When i switch on the power they glow for an instant but then go off.
The hardware is same for both the programs. Is there something wrong with my programs of is there no pulses present at my P3.2. As i have no oscilloscope so cannot check the pulses. Is there any other way thoough a program to check if the pulses are present or not ?? #include <REG52.H> #include <generic1.h> sbit YELLOW = P3^6; sbit GREEN = P3^7; bit hit_ = 0; /*============================================================================= /*----------------------------------------------------------------------------- When the Edge trigger is recieved 'hit' is set and the control returns to the main function -----------------------------------------------------------------------------*/ void ex0_isr (void) interrupt 0 { hit_ = 1; } /*============================================================================= ==============================================================================*/ void main (void) { /*----------------------------------------------- Configure INT0 (external interrupt 0) to generate an interrupt on the falling-edge of /INT0 (P3.2). Enable the EX0 interrupt and then enable the global interrupt flag. ------------------------------------------------------------------------------*/ IT0 = 1; // Configure interrupt 0 for falling edge on /INT0 (P3.2) EX0 = 1; // Enable EX0 Interrupt EA = 1; // Enable Global Interrupt Flag /*------------------------------------------------------------------------------ The control remains outy of the main function na d as soon as 'hit is set the LED is switched on for 9 mili-seconds and then switched off Now as there is an edge trigger every 0.01 seconds, thus the led glows for 9 mili-second then switches off for 1 mili-second and then again glo ws for 9 mili-second and so on infinitely untill the trigger is presnt at the P3.2 ------------------------------------------------------------------------------*/ while(1) { if(hit_ ==1) { YELLOW = 0; GREEN = 0; msec_wait(9); YELLOW = 1; GREEN = 1; hit_ = 0; } } } /*============================================================================= =============================================================================*/ |
Topic | Author | Date |
Intensity control | 01/01/70 00:00 | |
show some CODE | 01/01/70 00:00 | |
Dear Erik | 01/01/70 00:00 | |
where are the comments? | 01/01/70 00:00 | |
We can't read your mind | 01/01/70 00:00 | |
Erik & Richard | 01/01/70 00:00 | |
What prevents you from putting in the required comments? | 01/01/70 00:00 | |
While putting in comments i saw one error | 01/01/70 00:00 | |
Hmmmm... | 01/01/70 00:00 | |
Jitter | 01/01/70 00:00 | |
still no luck | 01/01/70 00:00 | |
We have not seen the schematics | 01/01/70 00:00 | |
Its working | 01/01/70 00:00 | |
Another Program to test my interrupt !! | 01/01/70 00:00 | |
Code legibility![]() | 01/01/70 00:00 |