Auto clear watchdog with RS232

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Auto clear watchdog with RS232

Post by medelec35 »

Auto Clear Watchdog.

I had an issue of watchdog timeout caused by time sending chars to RS232 exceeding 18mS with internal osc set to 4MHz
Was using prescaler with timer0, so could not assign to watchdog
I did get round problem by adding clear_wdt();
In PIC_RS232.c as follows:

Code: Select all

void RS232_Delay(char mode)
{
/*Macro_RS232_Delay_Start*/
	unsigned int iterations;
	unsigned int delay = %m_SW_BAUD;

	if (mode)
		delay = delay + 1;
		clear_wdt();
	for (iterations = 0; iterations < delay; iterations++);
/*Macro_RS232_Delay_End*/
}
This does not appear to affect any characters displayed on HyperTerminal via software TX/RX at both 2400 and 4800 baud

Not able to test 9600 as that did not work too well without wd and without editing PIC_RS232.c

My suggestion is when auto Clear Watchdog is selected,
CLRWDT is automataly added to RS232 component maco same way as already added to Delay component macro.
Perhaps go one stage further and add to ADC component as well. That way the user does no need to add any clear_wdt(); within C boxes.
Martin

Post Reply