CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Help! Code in Timer int now working?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

Help! Code in Timer int now working?
PostPosted: Thu Jan 08, 2009 7:22 am     Reply with quote

Why is this not working?

Code:

#INT_TIMER1                       
void clock_isr()
{               
if (pcComm == 0x00)
{
 if ((dataCount == 22) && (RcvData[18] == 0x39)) Status = 'F';
 else if ((dataCount == 20) && (RcvData[18] == 0x3a)) Status = 'N';
 else if ((dataCount == 13) && (RcvData[11] == 0x33)) Status = 'T';
}
if ((PcComm == 0x01) && (dataCount == 20) && (RcvData[18] == 0x31)) printf(usb_cdc_putc, "Ok.");

}

#INT_RDA
void rda_isr()
{
 disable_interrupts (INT_TIMER1);
 RcvData[dataCount++] = getchar();
 enable_interrupts (INT_TIMER1);
}



Actually it works if i either have this code

if (pcComm == 0x00)
{
if ((dataCount == 22) && (RcvData[18] == 0x39)) Status = 'F';
else if ((dataCount == 20) && (RcvData[18] == 0x3a)) Status = 'N';
else if ((dataCount == 13) && (RcvData[11] == 0x33)) Status = 'T';
}

or
this code
if ((PcComm == 0x01) && (dataCount == 20) && (RcvData[18] == 0x31)) printf(usb_cdc_putc, "Ok.");

but if i have both of them as shown above it does not work. ANY IDEAS?

Thanks and Regards,
Jai
dyeatman



Joined: 06 Sep 2003
Posts: 1924
Location: Norman, OK

View user's profile Send private message

PostPosted: Thu Jan 08, 2009 7:44 am     Reply with quote

When you ask a question please be clear. What do you mean by "not working"?

Without knowing your answer I can already see a potential problem where you trying to PRINTF inside the timer routine. DOZENS of times we have said here to get out of an interrupt as quickly as possble. While in the interrupt routine do not transmit or print anything. It is even advised to avoid floatng point.

Why are you disablng the Timer interrupt in INT_RDA? If a Timer interrupt comes in during INT_RDA it won't be serviced until INT_RDA is completed.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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