Eric Allison

Can't disable COP properly on SPYDER

Discussion created by Eric Allison on Feb 27, 2010
Latest reply on Mar 1, 2010 by Eric Allison

One of the SPYDER demo programs has this line of code to disable the COP:

 

SOPT1 &= 0x7F;

 

That demo program runs fine.  But when I try that same line of code in my program, I keep getting the error "Lost communication with the target device".  I don't see anything else in the demo program that pertains to disabling the COP.  Why isn't my program working?  I have pared down the program to simply disable the COP and then turn on the LED, but it still doesn't work.  Here is the entire program:

 

#include <hidef.h> 

#include "derivative.h"

void main(void) {
  EnableInterrupts;
  SOPT1 &= 0x7F;
  PTADD = 0x01;
  PTAD = 0x01;
}

Outcomes