|
|
View previous topic :: View next topic |
Author |
Message |
vector Guest
|
reset rs232 |
Posted: Thu Jul 24, 2003 6:27 pm |
|
|
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
|
Re: reset rs232 |
Posted: Fri Jul 25, 2003 2:00 am |
|
|
:=
:=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 |
Posted: Sun Jul 27, 2003 8:49 pm |
|
|
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 |
|
|
|
|
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
|