GZ60 demo and WATCHDOG

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GZ60 demo and WATCHDOG

1,994 Views
RChapman
Contributor I
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
Posted: Mon Oct 31, 2005 8:27 am    
 
Hi Everyone,

I'm an absolute beginner and just managed to get started my HC08-GZ60 DEMO board and CodeWarrior 3.1.

Now I am looking for some simple code for this MCU to analyse the functions and learn how to program the controller. Especially samples to send and receive information on the COM-port are very welcome.

Further I need some explanation about the code below. I found it while looking for some delay routine examples. The loop itself is no probleme, but the WATCHDOG makes me stumble.

What's the WATCHDOG for and how does it work?



void Delay(unsigned int n)
{
unsigned int stopTime = 30 * n;
while (stopTime != 0)
{

#ifdef PET_WATCHDOG
PET_WATCHDOG();
#endif

stopTime--;
}
}



INFORMATION out of the HEADER file

/* Types definition */

#ifndef __RESET_WATCHDOG_MACRO
#define __RESET_WATCHDOG_MACRO
/* Watchdog reset macro */
#ifdef _lint
#define __RESET_WATCHDOG() /* empty */
#else
#define __RESET_WATCHDOG() {asm sta COPCTL;} /* Just write a byte to feed the dog */
#endif
#endif /* __RESET_WATCHDOG_MACRO */


Ciao ciao
Posted: Mon Oct 31, 2005 2:28 pm    
 
I've written a simple com test routine for the mc9s08gb60 which may be helpful to you. The routine simply sends out 256 characters on the transmit pin and expects them to be looped back (somehow, up to you) to the receive pin, then confirms the validity of each received byte.
The program is written in assembly.
If you're interested contact Ron at Techsupport@gadgetwerksinc.com and I will email you the code.
Posted: Tue Nov 01, 2005 4:05 pm    
 
Hi,
The Watchdog is to make sure the micro is still running.
On GZ, it is call COP = Computer Operating Properly.
It is a 'register' in which you need to write often enough for it not to time out.
Your regular application will kick the dog through the code (NEVER in interrupts) and, if your software gets stuck somewhere, the watchdog won't get refreshed and will create a reset.
On HC08, to feed the dog, you just need to write anything at $FFFF and the timer is restarting from scratch.
On S12 you need to write $AA $55 alternatively in a certain order to make sure your software follows the proper sequence of execution.

On small applications or, to learn, don't use the COP as it is boring and will give you headaches. Just disable it in CONFIGx register, bit COPD. Then you won't have to feed it.

Posted: Wed Nov 02, 2005 8:33 am    
 
Hi,

thank you for your explanation. I think expecially the advice to switch the watchdog off will ease my learning phase.

And please let me take the chance to ask you for some simple routines to share with me. Like already shown with my watchdog question I am an absolute beginner and need all the help I can get.

So if you can offer any code which could be useful to learn about the HC08 and programming, just let me know.


thanks
Posted: Wed Nov 02, 2005 12:12 pm    
 
Bijour,

I'd say a good idea to get going whould be to follow few of the online courses available from the Embedded Learning Center for Free of course...
You could get code example from the OSCookBook here on Freegeeks or by looking at Application Notes on Freescale Web.
You'll get a full project where you just have to press compile and it works. Then you'll be able to make your changes.
Posted: Wed Nov 02, 2005 3:52 pm    
 
Bonjour,

the GZ60 seems not to be the most common solution. So I did not find so much at the cookbooks.

And the progs at Freescale, I checked out so far, were all a little bit....let's say "big".

But I will keep on searching and may be I find any chunk I can chew ;o).



Thanks
Labels (1)
0 Kudos
0 Replies