Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/20/04 20:15
Read: times


 
#74522 - LPC932 Interrupt Solution
Hi I want to access a variable in my timer0 SRI, after External interrupt 1 has been triggered. The variable i need to access is Sec. For some reason it does not do it. After Interrupt 1 has been called, it calls a function called tdata(); This last function reads some memory values, displays them on the LCD every 5 Seconds. Or at least that is what it is supposed to do. Every time the program enters tdata(); it stops at while(Sec < 6); and does not do anything. Since I am using the emulator EPM900 I can stop the program and re-started. Then it starts doing what is supposed to do...which is reading that Sec variable from the timer0 ISR, waits until condition is met and displays the info.
If I disable Enternal interrupt and call void tdata(void); from Main, then it has no problem and works very well, but I need it to be called after IE1=1;
Can any one see what is happening?
Is it something with the way I placed the condition
while (Sec < 6); ?

Thanks in advance

Here is the Program:
=====================================================
void c_counter(void)
{
ET0 =1;
//TR0 = 0;
TMOD |= 0x01;
TAMOD = 0x00;
T0_counter();
EA = 1;
//TR0 = 1;
}

void T0_counter(void)
{
TR0 = 0;
TH0 = (65535-34816)/256; // 34816 //chage these values for clock
TL0 = (65535-34816)%256; // .2
TF0 = 0;
TR0 = 1;
}


void Card_Present(void) interrupt 2
{
EX1 = 0;
WriteInstrReg (CLEAR_DISPLAY);
display(p_start);
t_counter = 0;
read_par = 0x1A;
tdata();

return;
}

void timer0(void) interrupt 1
{
T0_counter();

if (--ticks == 0)
{
ticks = 108;
if (++Sec == 7)
Sec = 0;
}
return;
}

void tdata (void)
{

while(Sec < 6);

do
{
Sec = 0;
read_par--;
WriteInstrReg (CLEAR_DISPLAY);
WriteInstrReg(0x80);
if (read_par == 0x19)
display(mid); // display parameter name

if (read_par == 0x17)
display(sequ); // display parameter name

if (read_par == 0x15)
display(time); // display parameter name

if (read_par == 0x13)
display(costu); // display parameter name

if (read_par == 0x11)
display(tlit); // display parameter name

if (read_par == 0x0F)
display(no_w); // display parameter name

if (read_par == 0x0D)
display(wdt); // display parameter name

numdsp(9, ++recvar, 0, 10000); // display value
WriteInstrReg (CLEAR_DISPLAY);
WriteInstrReg(0xC0); // display line two
while (Sec < 6); }
while (++t_counter < 7);
}





List of 14 messages in thread
TopicAuthorDate
LPC932 Interrupt Solution            01/01/70 00:00      
   RE: LPC932 Interrupt Solution            01/01/70 00:00      
      RE: LPC932 Interrupt Solution            01/01/70 00:00      
         RE: LPC932 Interrupt Solution            01/01/70 00:00      
            RE: LPC932 Interrupt Solution            01/01/70 00:00      
               RE: LPC932 Interrupt Solution            01/01/70 00:00      
                  RE: LPC932 Interrupt Solution            01/01/70 00:00      
                     RE: LPC932 Interrupt Solution            01/01/70 00:00      
                        RE: LPC932 Interrupt Solution            01/01/70 00:00      
                           RE: LPC932 Interrupt Solution            01/01/70 00:00      
                              RE: LPC932 Interrupt Solution            01/01/70 00:00      
                                 RE: LPC932 Interrupt Solution            01/01/70 00:00      
                                    RE: LPC932 Interrupt Solution            01/01/70 00:00      
   RE: LPC932 Interrupt Solution            01/01/70 00:00      

Back to Subject List