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

EX_SISR.C - how do I look for a specific charachter?

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



Joined: 29 Dec 2003
Posts: 3

View user's profile Send private message

EX_SISR.C - how do I look for a specific charachter?
PostPosted: Sat Jun 12, 2004 2:08 pm     Reply with quote

Hi

The CSC EX_SISR.C works just fine - but how do I search the buffer for a unique charachter?



Rgds

Jesper
dyeatman



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

View user's profile Send private message

Start Char
PostPosted: Sat Jun 12, 2004 4:21 pm     Reply with quote

If you are looking for one specific character (for example one to start a packet) , the best place to check is in the ISR. Check the incoming character in the ISR to see if it is the desired start char then set a START Flag true.

Every time you enter the ISR for an incoming char you check the START flag.

IF START is false THEN you check the incoming char for (compare against) the START char ELSE IF it is true THEN you put the incoming char straight in the buffer.

If you are looking for more than one start char it may get somewhat more complicated depending on how many you need to match..
ljbeng



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 7:17 am     Reply with quote

Code:

char = getc();
if (char == 'a'){
//do something
}
ljbeng



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

PostPosted: Tue Jun 15, 2004 10:03 am     Reply with quote

Example code above had error.... fixed now.
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