Hi Every one
What his wrong with this
Thank’s
Marcus
//////////////////////////////////////////////////////////////////////////
#class auto
//Prototype
void Timer();
int count;
void main(void)
{
printf("begin test
");
count = 0;
// Det PB.2 has an output
WrPortI(PBDDR, &PBDDRShadow, 4);
SetVectIntern(0x01,Timer);//Below
printf("Starting SWDT
");
// init timer at 313 + 12 us tick timer interrupt
WrPortI(SWDTR, NULL, 10);
// hit crash here
WrPortI(WDTCR, NULL, 0x5F); // <<< hit crash here
printf("SWDT is running
");
while(1)
{
if (count == 3)
{
count = 0; // reset count
// Toggle PB.2 each 1ms BitWrPortI(PBDR,&PBDRShadow,!BitRdPortI(PBDR,2),2);
}
}
}
#asm
Timer::
push af
push hl
; determine why the interrupt occurred and take appropriate action
ld hl, (count)
inc hl ; increment counter
ld (count), hl
ld a, 10 ; timeout period of 11/32kHz = 331us
ioi ld (SWDTR), a ; clear the interrupt request
pop hl
pop af
ipres
ret
#endasm