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

reset rs232

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







reset rs232
PostPosted: Thu Jul 24, 2003 6:27 pm     Reply with quote

basicly how do I "completly" reset the com port

Having a slight problem with a 16F876. im transmitting coms to it at 56700 in a noisy/glitchy environment, without noise it works fine but when noise is applied my dta corrupt trap alerts me to say its rcvd garbage. I simply ignore this packet and wait for the next. however it never recovers(ie the loop runs ok it just always gets garbage now), all packets become garbage and fall into my trap. Even if I remove the noise it wont recover. A hardware rest is the only way.
I have used rs232 sniffing techniques to ensure the debug is correct. it points directly to the PIC uart rcv as the only problem, I suspect its out of sync or something. I have #use RS2332 errors on. I have even tried to clear CREN.
I even tried putting a #use rs232 line in again..
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516333
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: reset rs232
PostPosted: Fri Jul 25, 2003 2:00 am     Reply with quote

:=
:=how do I "completely" reset the com port
-------------------------------------------------

In one of my old programs, I have this function:

#byte RCSTA=0x18 // Receive Status and Control

#define SPEN_BIT 7 // Bit position of SPEN within RCSTA

void reset_uart(void)
{
bit_clear(RCSTA, SPEN_BIT); // Reset the serial port
delay_ms(1);
bit_set(RCSTA, SPEN_BIT);
delay_ms(1);
}

This was for a 16F876.

I suggest that you try that, and also use the ERRORS directive
in your #use rs232 statement.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516341
vector
Guest







reset rs232
PostPosted: Sun Jul 27, 2003 8:49 pm     Reply with quote

Tried this to no avail. have moved onto other projects. will revist as time permits.


:=:=
:=:=how do I "completely" reset the com port
:=-------------------------------------------------
:=
:=In one of my old programs, I have this function:
:=
:=#byte RCSTA=0x18 // Receive Status and Control
:=
:=#define SPEN_BIT 7 // Bit position of SPEN within RCSTA
:=
:=void reset_uart(void)
:={
:= bit_clear(RCSTA, SPEN_BIT); // Reset the serial port
:= delay_ms(1);
:= bit_set(RCSTA, SPEN_BIT);
:= delay_ms(1);
:=}
:=
:=This was for a 16F876.
:=
:=I suggest that you try that, and also use the ERRORS directive
:=in your #use rs232 statement.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516414
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