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

UART and Errors

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



Joined: 28 Aug 2007
Posts: 99
Location: New Zealand

View user's profile Send private message

UART and Errors
PostPosted: Fri Apr 30, 2010 2:56 am     Reply with quote

I am having a problem understanding the errors part of the #use RS232 function. I want to know if there was a problem during transmission so have set the timeout and errors but don't understand how to know if there was a timeout. If there was a problem I was to resend the data so need to know if there where any problems.

My code:

Code:
#use RS232(Uart1,Baud=9600,Timeout=10,Errors)


I think I read somewhere that Errors would be set to 0 if there had been a timeout so I tried this but it gives me an error.


Code:
 RS232_ERRORS == 0


.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 30, 2010 1:35 pm     Reply with quote

This test program compiles OK with no errors, with vs. 4.107:
Code:

#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, TIMEOUT=500, ERRORS)

//=========================================
void main()
{
int8 c;
int8 result;

c = getc();

if(RS232_ERRORS == 0)
   printf("Got Timeout Error \n\r");

     

while(1);
}
umka



Joined: 28 Aug 2007
Posts: 99
Location: New Zealand

View user's profile Send private message

PostPosted: Sat May 01, 2010 12:48 am     Reply with quote

cheers PCM

got it working now. Had it in an or statement and that was the problem. having never used errors I guessed that was the problem.
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Sat May 01, 2010 2:33 pm     Reply with quote

Errors doesn't end errors they are still there that's why it's called errors instead of error-free. All errors does is allow the uart to continue since your are effectively considered to have handled the error. Now in reality there isn't much you can do with the error since there is no good way to recover the data. The value is that the error is detected and the uart kept alive so a sophisticated program could ask for a retransmission. The value in the variable error is mostly the value in the uart register that informs of the specific error.
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