View previous topic :: View next topic |
Author |
Message |
Piet Fourie Guest
|
RS-232 TX Problem |
Posted: Mon Jul 14, 2003 11:21 am |
|
|
Hi
I just upgraded to the latest compiler available from CCS webpage.
The problem;
If I transmit a specific character over the RS-232 the pic (F877) crashes. Any other code transmitted is ok.
Example of Basic problem
a = 0x10 ;
putc(a) ; //No Problem the thing works
a = 0x05 ;
putc(a) ; //The program crashes.
I have removed all other code from the program which is very big and only have the RS-232 section working and everytime the code is 0x05 the pic crashes.
Hope somebody can help, I am very frustrated and the deadline is upon me.
Regards
Piet
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515958 |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: RS-232 TX Problem |
Posted: Mon Jul 14, 2003 11:46 am |
|
|
:=Hi
:=I just upgraded to the latest compiler available from CCS webpage.
:=The problem;
:=If I transmit a specific character over the RS-232 the pic (F877) crashes. Any other code transmitted is ok.
:=
:=Example of Basic problem
:=a = 0x10 ;
:=putc(a) ; //No Problem the thing works
:=
:=a = 0x05 ;
:=putc(a) ; //The program crashes.
:=
:=I have removed all other code from the program which is very big and only have the RS-232 section working and everytime the code is 0x05 the pic crashes.
:=
:=Hope somebody can help, I am very frustrated and the deadline is upon me.
:=Regards
:=Piet
The biggest difference in those numbers is how many consecutive zero bits follow the start bit in the byte transmition. How accurate is your clock and baud rate?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515959 |
|
|
Sherpa Doug Guest
|
Re: RS-232 TX Problem |
Posted: Mon Jul 14, 2003 12:00 pm |
|
|
:=The problem;
:=If I transmit a specific character over the RS-232 the pic (F877) crashes. Any other code transmitted is ok.
:=
:=Example of Basic problem
:=a = 0x10 ;
:=putc(a) ; //No Problem the thing works
:=
:=a = 0x05 ;
:=putc(a) ; //The program crashes.
:=
What do you mean by "crash"? Does the processor reset? Does the clock keep running? Does it crowbar the power supply?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515960 |
|
|
John Taylor Guest
|
Re: RS-232 TX Problem |
Posted: Mon Jul 14, 2003 12:21 pm |
|
|
Chr 0x05 is an ENQ, is it possible that you are getting an immediate response from the other side of the RS232 connection that you don't expect? If you transmit with an interrupt handler, a new character into your input buffer could overrun your hardware receive buffer (Because you don't process it) and make all other reception impossible until the error is cleared.
//Check status of bit oerr once "Crashed" in 16F877:
#byte rcsta=0x18 //UART overrun error control variables
#bit cren=rcsta.4 //adjust addressing for processor
#bit oerr=rcsta.1
//If oerr is high, it can only be cleared by toggling cren...
//-----------------------------------------------------------
//overrun error clearing, perform every system loop -
//-----------------------------------------------------------
if (oerr) //if overrun is true
{
cren=false; //toggle rcsta, cren bit to clear
cren=true;
}
//-----------------------------------------------------------
:=:=Hi
:=:=I just upgraded to the latest compiler available from CCS webpage.
:=:=The problem;
:=:=If I transmit a specific character over the RS-232 the pic (F877) crashes. Any other code transmitted is ok.
:=:=
:=:=Example of Basic problem
:=:=a = 0x10 ;
:=:=putc(a) ; //No Problem the thing works
:=:=
:=:=a = 0x05 ;
:=:=putc(a) ; //The program crashes.
:=:=
:=:=I have removed all other code from the program which is very big and only have the RS-232 section working and everytime the code is 0x05 the pic crashes.
:=:=
:=:=Hope somebody can help, I am very frustrated and the deadline is upon me.
:=:=Regards
:=:=Piet
:=
:=The biggest difference in those numbers is how many consecutive zero bits follow the start bit in the byte transmition. How accurate is your clock and baud rate?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515964 |
|
|
|