Do an experiment. What if you are getting division by zero ?
I'm not sure what the CCS integer division routines do if you
divide by zero, but it may be causing your restart. Modify
your VARW loop as shown below:
Code:
int16 temp;
for(VARW=0;VARW<=2100;++VARW)
{
// Disable interrupts temporarily when reading a 16-bit number
// that is changed inside an interrupt routine.
disable_interrupts(GLOBAL);
temp = isr_ccp_delta;
enable_interrupts(GLOBAL);
// Put in some protection code.
if(temp == 0) // If divisor is 0, then:
temp = 100; // Set it to a nominal value (You pick the value)
another test to do....
since this is some kind of AC motor controller, remove the AC motor and it's driver and run the program. Does it run fine or restart ?
Also describe the interface and motor. Has any of that been changed
It'd difficult to undestand how this program worked 'fine' in the 877 but fails in this PIC.
All times are GMT - 6 Hours Goto page Previous1, 2
Page 2 of 2
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