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

Reset the microcontroller on the WDT
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ttelmah



Joined: 11 Mar 2010
Posts: 12835

View user's profile Send private message

PostPosted: Mon Oct 16, 2017 8:08 am     Reply with quote

It won't 'interrupt the interruption'.
Is the compiler giving you a warning 'interrupts disabled to prevent re-entrancy'?. If not interrupts are functioning as they should be.

You need to actually start to learn, rather than flinging code around.

The interrupt still fires, and the data is still received, but there is nothing in the loop to say 'exit' when the data is received. If you look at the button example Temtronic pointed you to, you will see that it exits when the button is seen or when the count is completed. You need to do the same. Also if you want to throw the first line, you need to clear the data when this happens before calling the delay again (you are also clearing the buffer twice at the start of each routine 'clear' as posted before clears the buffer _or_ the repeated read does - you don't want to waste having both).
You need to start thinking.
So:
'I need to wait for a maximum of xxx seconds, and exit when this expires or when data is seen', would be the definition for 'delayr'.
Then to call it again throwing the data away, 'I need to get rid of the data, and clear the flag, then call it again'.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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