I'm trying to debug Dallas DS5250. All it's in a simple program but when I introduce the timer0 interrupt the debugger lost communication with the target and the interrupt is not serviced. Wich could be the problem?
that you exspect us to tell you "Wich could be the problem" with no information whatsoever.
you need to post your code and when you do so, replace all tabs in your code with spaces and follow the code posting instructions shown over the post entry window. as a first show the T0 ISR code, maybe that will do.
Erik
int T0_ISR_CODE(int delay) __interupt #1 { TH0 = 5; TL0 = 7; } <endcode>
int T0_ISR_CODE(int delay) __interupt #1
That's not Keil C52 syntax! Besides which:
How do you expect that a parameter can be passed to an ISR?
Where do you expect that the return value for an ISR will go?
What compiler are you using? this is a Keil forum.
If, indeed, you are using Keil C51 you are making a mistake so basic that the only recourse is to work through (NOTE: not 'read') the "getting started guide", or you will only be 5 minutes before you make the next one.
anyhow a Keil interrupt should look like this void ISX_EI0 (void) interrupt 0 using 1 the 'using 1' may, of course be different.
or even omitted.
My code is the following:
void main(){ TMOD = 0x01; ET0 = 1; TH0 = 0xFF; TL0 = 0x9B; TR0 = 1; EA = 1; while(1){ P0 = 0x80; P0 = 0x40; } void Timer() interrupt 1{ TH0 = 0xFF; TL0 = 0x9B; }
But in the moment I'm debugging througt EA = 1 the communicacion is lost.
Thank you for rour help.
Now the tidyed code is this:
void main() { TMOD = 0x01; ET0 = 1; TH0 = 0xFF; TL0 = 0x9B; TR0 = 1; EA = 1; while ( 1) { P0 = 0x80; P0 = 0x40; } } void Timer() interrupt 1 { TH0 = 0xFF; TL0 = 0x9B; }
what you are missing is totally fundamental and the fact you are missing it reveal that you have not taken the time to get to know the chip you are working with.
thus it is "bible time". For this read the section on timers and the section on interrupts in chapter 3.
here are the links to "the bible" Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer’s Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf