AnsweredAssumed Answered

not able to toggle a paticlar pin on the MC90S08DN16

Question asked by vikas subramani on Jun 12, 2014
Latest reply on Jun 16, 2014 by vikas subramani

hi i am just toggoling a paticular pin in port a i am not able to get expected result. i have included the code below please take a look

 

 

#include <hidef.h>

 

#include "derivative.h"

void delay(void);

 

 

void main(void)

 

{

EnableInterrupts;

        PTADD_PTADD0 = 1;

PTDPE_PTDPE0 = 0;

 

         while (1)

 

{

PTAD_PTAD0 = 1;

delay();

PTAD_PTAD0 = 0;

delay();

PTAD_PTAD0 = 1;

delay();

PTAD_PTAD0 = 0;

delay();

                __Reset_Watchdog;

          }

}

 

 

void delay(void)

 

{

int i, j;

for (i=0; i<200; i++)

for(j=0; j<200; j++);

}

 

 

The problem that i am facing is that when i run in debug mode setp by setp execution the program counter in not going according to the written program it is getting currupted and the other thing that i noticed is that when last four lines of the code in while loop, except for" __resetwatch dog" is taken out  then the code and the debugger works ablsolutely fine but as soon as i include another toggle in the code the problem starts.

 

 

 

Thanks

Outcomes