|
|
View previous topic :: View next topic |
Author |
Message |
pylin Guest
|
COLD RESET |
Posted: Sat Jun 29, 2002 4:10 pm |
|
|
<font face="Courier New" size=-1>I had some problems with RS232. The PUTC stops working after expriencing some problems (remote disconnected abruptly). Yes, I do have ERRORS option in my RS232 line. So I simply want to recycle the CPU when such abrupt condition occurs. I did the RESET_CPU() function, it does not seem to put PIC16F628 into POWER UP mode, so PUTC still not working while of course, cycling the power switch did the trick, but that ain't pretty.
Here is the beginning of the code that are most relvent, I think . .
#if defined(__PCM__)
#include <16F628.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=11059200)
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1, PARITY=N, BITS=8, ERRORS)
#endif
Any ideas please? Thanks in advance.
</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 5247 |
|
|
Tomi Guest
|
Re: COLD RESET |
Posted: Sun Jun 30, 2002 8:17 am |
|
|
I think the posted code is pretty general and irrelevant. Without handshake the serial transmit must work with or without remote device.
The reset:
I never use reset_cpu(). I always use WDT and something like this:
bit_clear(PCON,1); // reset the POR bit
while (1) ; // leave the WDT to do the job
Of course I always have separated code for power-up init (clearing the POR bit forces the PIC to execute that code).
Without WDT you can use something like this (intead of the while(1) loop):
*0x0A = 0; // set PCLATH to 0
#asm
goto 0 // jump to RESET location
#endasm
:=<font face="Courier New" size=-1>I had some problems with RS232. The PUTC stops working after expriencing some problems (remote disconnected abruptly). Yes, I do have ERRORS option in my RS232 line. So I simply want to recycle the CPU when such abrupt condition occurs. I did the RESET_CPU() function, it does not seem to put PIC16F628 into POWER UP mode, so PUTC still not working while of course, cycling the power switch did the trick, but that ain't pretty.
:=
:=Here is the beginning of the code that are most relvent, I think . .
:=
:=#if defined(__PCM__)
:=#include <16F628.h>
:=#fuses HS,NOWDT,NOPROTECT
:=#use delay(clock=11059200)
:=#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1, PARITY=N, BITS=8, ERRORS)
:=#endif
:=
:=
:=Any ideas please? Thanks in advance.
:=
:=</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 5254 |
|
|
pylin Guest
|
Re: COLD RESET |
Posted: Sun Jun 30, 2002 4:24 pm |
|
|
:=I think the posted code is pretty general and irrelevant. Without handshake the serial transmit must work with or without remote device.
:=The reset:
:=I never use reset_cpu(). I always use WDT and something like this:
:=bit_clear(PCON,1); // reset the POR bit
:=while (1) ; // leave the WDT to do the job
:=Of course I always have separated code for power-up init (clearing the POR bit forces the PIC to execute that code).
:=Without WDT you can use something like this (intead of the while(1) loop):
:=*0x0A = 0; // set PCLATH to 0
:=#asm
:=goto 0 // jump to RESET location
:=#endasm
:=
:=
:=:=<font face="Courier New" size=-1>I had some problems with RS232. The PUTC stops working after expriencing some problems (remote disconnected abruptly). Yes, I do have ERRORS option in my RS232 line. So I simply want to recycle the CPU when such abrupt condition occurs. I did the RESET_CPU() function, it does not seem to put PIC16F628 into POWER UP mode, so PUTC still not working while of course, cycling the power switch did the trick, but that ain't pretty.
:=:=
:=:=Here is the beginning of the code that are most relvent, I think . .
:=:=
:=:=#if defined(__PCM__)
:=:=#include <16F628.h>
:=:=#fuses HS,NOWDT,NOPROTECT
:=:=#use delay(clock=11059200)
:=:=#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1, PARITY=N, BITS=8, ERRORS)
:=:=#endif
:=:=
:=:=
:=:=Any ideas please? Thanks in advance.
:=:=
:=:=</font>
Thanks, this piece of code is going to stay in my HD for a while . . . thanks a lot.
___________________________
This message was ported from CCS's old forum
Original Post ID: 5262 |
|
|
|
|
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
|