Ruth Hendrix

COP and executing programs

Discussion created by Ruth Hendrix Employee on Jan 24, 2006
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: Fri Dec 02, 2005 7:56 pm  

I have some problem with executing my programs in Normal Mode. It only works in Monitor Mode. I tried to disable COP by set 1 to COPD bit in CONFIG register, in my main function, but it didn't help. I use MC68HC908JB8. Please tell me that I do wrong?

I thank very much in advance for your help.

PS. Please forgive my English, but I have still learnt it.
Posted: Sat Dec 03, 2005 4:33 pm    

When you attempt to set the COPD bit in CONFIG, this will need to be done within the same instruction as for the other bits, rather than a separate instruction. Is this so with your code? This is necessary because the CONFIG register can only be written once after a reset.

Regards, Posted: Sat Dec 03, 2005 6:00 pm    

Is this so with your code?

Thank You for your reply.

Yes, this is in my main function: CONFIG_COPD = 1;
Mayby it must be in start08.c, but where I must put it?
Posted: Mon Dec 12, 2005 5:42 am    

Yes, this is in my main function: CONFIG_COPD = 1;
Mayby it must be in start08.c, but where I must put it?

The implication of this instruction is that you are setting only a single bit. It would be better to use the instruction, for example: CONFIG = 0x01;
where all bits of CONFIG are explicitly set to their required value. However, this will still not work if there is any prior reference to CONFIG register within the code. You will need to check this out, and modify any such code. You should also check for references within the file 'start08.c'.

Are you certain that the watchdog is not being disabled? Test this by reading the CONFIG register after initialisation has taken place.

As an alternative to disabling the watchdog, you could periodically reset the watchdog timer from within main(), and see if your problem still persists?