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 CCS Technical Support

How to check out RS232 status?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Mon Nov 08, 2004 3:19 pm     Reply with quote

Twom thing important to understand from your posting.
one is Never put those huge delays in there
another is There is no #int_rda with a software USART

thank you guys
Twitie



Joined: 08 Nov 2004
Posts: 11

View user's profile Send private message

PostPosted: Mon Nov 08, 2004 5:34 pm     Reply with quote

Quote:

5. Never put those huge delays in there. Better to set a flag and handle in main.
6. Better use "ERRORS" in the #use RS232 if using the hardware uart.


Sorry guys for interrupt~ I have some doubt regarding your postings. Hope that anyone of you can answer my doubt.

Q1> Why we shouldn't use those huge delays in the program? 300ms is considered huge?

Q2> If so, what is the better way to implement delay? (coz I am using delay in my program too... just like young)

Q3> What is the usage of "ERRORS" in #use RS232?

Thank you very much! Looking forward for your replies~
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 08, 2004 6:14 pm     Reply with quote

Quote:
Q1> Why we shouldn't use those huge delays in the program? 300ms is considered huge?


Okay for a program but you shouldn't do them in an interrupt.

Quote:
ERRORS
Used to cause the compiler to keep receive errors in the variable RS232_ERRORS and to reset errors when they occur.


He is not doing any error checking. A buffer overrun will cause the receive to stop working unless the error is handled. The ERROR parameter will do this for him.
Twitie



Joined: 08 Nov 2004
Posts: 11

View user's profile Send private message

PostPosted: Mon Nov 08, 2004 7:16 pm     Reply with quote

Thx Mark~ ^^

Quote:
Okay for a program but you shouldn't do them in an interrupt.


One more question. What should I do if I need to implement delay in intterupt?

Thx.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 08, 2004 8:21 pm     Reply with quote

Rewrite it so you don't Very Happy

Usually you can set a flag and then handle the interrupt in the main loop. Ints are supposed to be as short and fast as possible.
Twitie



Joined: 08 Nov 2004
Posts: 11

View user's profile Send private message

PostPosted: Mon Nov 08, 2004 8:27 pm     Reply with quote

That's mean I use the interrupt subroutine only to set the flag and the all the work for interrupt will be done in main()...

Thx Mark, I think I get your point~~ Very Happy
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
Page 2 of 2

 
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