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?
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.
Erik
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