#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 */}
Hi Chris,
If you programmed it once and now can't get in this probably is something to do with the fact that
with the QT/Y you can programme a blank part with internal oscillator and no high voltage on
IRQ. But with a non-blank part you need a 9.8MHz crystal and 9 volts on IRQ.
Hope this helps
Regards David
Hi David,
this may solve the Problem i will try it, but i don't understand why i could reprogramm the MC68DEMOQTY there was no crystal on the board and there was no problem reprogramming the Board.
thank you
best regards
Chrisitan Wimmer
Hello,
Doesn't the MC68DEMOQTY board have boot loader code installed so the user code can be re-programmed without the need for the programming voltage and the crystal? Of course I could be wrong! However, if this is so the boot loader code would first need to be programmed to a virgin device (in forced monitor mode), in order to emulate the demo board.
Regards,
Mac
Message Edited by bigmac on 2006-08-15 03:12 PM
Hi all,
Just as a summary for the OP who may be getting a little lost here...
AFAIK everyone is correct here.
There are two main ways to programme these chips (and other similar ones - HC08):
1. Use (or make) a MON08 programmer as I was suggesting.
2. Use a serial bootloader programme. This is some software that you programme into the device (probably with the MON08 programmer in 1.) Then this resident programme accepts the code being downloaded from a serial port and programmes the flash.
It is my opinion that serial bootloaders are not worth bothering with as you are going to need the MON08 type to put the bootloader in in the first place. The only use I see for them is if you want people in the future to update the flash using just a serial cable
Also using a 9.8MHz clock with the MON08 overcomes problems of untrimmed internal oscillators etc
Regards David
Hi David
thanks for your effords! If i understand you right i could enter the forced monitor mode when the MCU is empty (new)?
Somewhere if've found a Aplication Note created by an engineer form Hongkong in which he descirbes who to build an programmer with an cristal-oscillator. Did you know the Note?
Could you send me an schematic of such an programmer?
Thank You
With Best Regards
Christian Wimmer
Hi Chris,
The schematic is in the datasheet.
In the MON section virtually everything except the MCU you can make off-board then connect to the board to programme. You can add some switches to turn off the high voltage for when the part is blank etc.
Regards David