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

PIC failure, serial communication and watchdog
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
Gon
Guest







PostPosted: Wed Mar 15, 2006 5:44 am     Reply with quote

Hello,

it is true ! It is ok, it goes out of the loop.

Many thanks !!!

What could re enable the UART ?
I know there are a CREN and OERR bits.
But when it goes out of the loop, the UART works again ...

What do you think it should be ?

Best regards.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Mar 15, 2006 9:14 am     Reply with quote

Gon wrote:
What could re enable the UART ?
I know there are a CREN and OERR bits.
But when it goes out of the loop, the UART works again ...


See a previous post
Ttelmah wrote:
Adding the 'ERRORS' statement to the USE RS232 command, tells the code to check for such an overrun, and reset the UART.


The best solution is to re-design your reception of data so that your main program can do whatever it has to do without disturbing the receive. A common solution to this problem is to create an intermediate buffer that is filled by an Rx-interrupt driven routine in the background. Whenever your main routine has time it can check the buffer to contain new data and process this.
For the buffer you can use either a linear or circular buffer type, see this thread for a description of when to use which buffer type.

An example of a circular buffer implementation is ex_sisr.c in the CCS example directory. An explanation of the internal workings of this example is given at http://www.ccsinfo.com/forum/viewtopic.php?t=19083

An example of a linear buffer can be found in the post of Humberto in http://www.ccsinfo.com/forum/viewtopic.php?t=19117

Search this forum for the keywords 'circular buffer' to find many more implementation examples.
mpfj



Joined: 09 Sep 2003
Posts: 95
Location: UK

View user's profile Send private message Send e-mail Visit poster's website

Re: Gon
PostPosted: Wed Mar 15, 2006 10:32 am     Reply with quote

ckielstra wrote:
600 * 10ms delay = 60 seconds
600 * printf("\n\r case default") = 10 seconds
-------------------
Total 70 seconds

Urm ... my calculator tells me that 600 * 10ms = 6 seconds Shocked
Ttelmah
Guest







PostPosted: Wed Mar 15, 2006 10:51 am     Reply with quote

It is just a missing zero. :-)
the delay is 100mSec per loop, plus about 13 character times (the last couple are in the hardware buffer).
So 13.5mSec, pus 100mSec, times 600.
Just under 70seconds.
Probably just a keyboard like mine, which ignores what you type sometimes (the stupid thing here, is that my 'old' AT style Cherry, and IBM keyboards are fine, however modern keyboards - including quite up market units, - often miss keystrokes, both on the key descending, and coming up again - it is amazing how often I find the system returning strings of a character, not having 'seen' me release the key...).
So if anybody knows a really good USB keyboard that desn't have this problem, it'd save me a lot of grief (I have tried the obvious names...).

Best Wishes
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