Hello everybody,
i'm a neeby in programming freescale MCUs. At work we have the MC68DEMOQTY and it was easy to program the MCU. At home i've tried to build a simple circuit. For this i used the AN2305. To programm the MCU i'm using the CW 5.7.
With the first program i want to switch the LED on and off by pressing the switch.
Code:#include <hidef.h> /* for EnableInterrupts macro */#include "derivative.h" /* include peripheral declarations */void MCU_init(void){ /*** ### MC68HC908QT4 "Cpu" init code ... ***/ /*** PE initialization code after reset ***/ /* System clock initialization */ /* Common initialization of the write once registers */ /* CONFIG1: COPRS=0,LVISTOP=0,LVIRSTD=0,LVIPWRD=0,LVI5OR3=0,SSREC=0,STOP=0,COPD=1 */ CONFIG1 = 0x01; /* CONFIG2: IRQPUD=0,IRQEN=0,OSCOPT1=0,OSCOPT0=0,RSTEN=0 */ CONFIG2 = 0x00; /* Common initialization of the write once registers */ OSCTRIM = *(unsigned char*far)0xFFC0; /* Initialize OSCTRIM register from a non volatile memory */ /* Common initialization of the CPU registers */ /* PTAPUE: OSC2EN=0 */ PTAPUE &= (unsigned char)~0x80; /* ### Init_GPIO init code */ /* PTA: PTA1=1 */ PTA |= (unsigned char)0x02; /* PTAPUE: PTAPUE2=1,PTAPUE1=0 */ PTAPUE = (PTAPUE & (unsigned char)~0x02) | (unsigned char)0x04; /* DDRA: DDRA1=1 */ DDRA |= (unsigned char)0x02; /* ### */ /* Common peripheral initialization - ENABLE */ /* KBSCR: ACKK=1,IMASKK=0 */ KBSCR = (KBSCR & (unsigned char)~0x02) | (unsigned char)0x04; asm CLI; /* Enable interrupts */} /*MCU_init*/void main(void) { /* Uncomment this function call after using Device Initialization to use the generated code */ MCU_init(); EnableInterrupts; /* enable interrupts */ /* include your code here */ for(;;) { if(PTA_PTA2 == 0) PTA_PTA1 = 1; __RESET_WATCHDOG(); /* feeds the dog */ } /* loop forever */ /* please make sure that you never leave this function */}
After compiling the file i've started the debuger and transfered the program with the Mon08 serial Cable into the MCU. The Configuration was Class 3 calble, Baud Rate: 9600, No Rest button.
During the programming process i've pressed the Button at /IRQ and switched the supply power on and off.
When i want to reprogramm the MCU i could not conect to the MCU any longer. The Connection Summary was YNNNN
Thank you for your help
With best regards
Christian Wimmer