代码来自俄罗斯的网站,我改动过 isd还有一些不太明白的问题,大家讨论一下 单步执行到ISDwait (); 老是跳不出去 ,那位用过介绍一下经验
TEST.C: ISD51 Demo for classic 8051 devices like Philips 89C51RD2/89C66x Copyright 2002 Keil Software, Inc.
Modified by Alexey Selischev, Aug., 2002 ------------------------------------------------------------------------------*/ #include <reg52.h> //stc89C516RD+(P89C51RD**)ISD连接pass #include <intrins.h> //stc89LE58RD+(WE78LE58) ISD连接pass #include <absacc.h> #include "ISD51.h"
sbit P15 = P1^0; sbit P16 = P1^1; sbit P17 = P1^2;
#define LEDS XBYTE [0xFFFF] // 0 - on, 1 - off
void delay(void) { unsigned int i; i = 0x800; while(i--); }
void main (void) { unsigned int j; unsigned char ext_reg = 0;
SCON = 0x50; //PCON &= 0x7F; T2CON &= 0xF0; /* EXEN2=0; TR2=0; C/T2#=0; CP/RL2#=0; */ T2CON |= 0x30; /* RCLK = 1; TCLK=1; */ RCAP2H=0xFF; /* reload value, 9600 Bds at 18.432MHz */ RCAP2L=0xC4; /* reload value, 9600 Bds at 18.432MHz */ ES = 1; /* Enable serial interrupt */ EA = 1; /* Enable global interrupt */ TR2 = 1; /* Timer 2 run */
// TMOD = 0x20; // TH1 = 0xfd; // TR1 = 1; REN = 1; EA = 1;
ISDinit (); // initialize uVision2 Debugger and continue program run ISDwait (); // wait for connection to uVision2 Debugger
P17 = 0; P16 = 0; P15 = 0; //耜铐翳泱痂痤忄螯 P15..P17 赅?鲨麴钼铋 怩钿
while (1) { // init ISD51 only when the uVision2 Debugger tries to connect ISDcheck(); // initialize uVision2 Debugger and continue program run _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
ext_reg = (char) P15; ext_reg = ext_reg << 1; ext_reg = ext_reg + (char) P16; LEDS = ext_reg; j++;
if (P17 == 0) { ext_reg = 0; j = 0; // you may use ISDbreak when ISD51 is started with ISDcheck or ISDwait // ISDbreak (); // hard coded stop (breakpoint) ISDbreak (); // hard coded stop (breakpoint) }
_nop_(); _nop_(); _nop_();
delay();
_nop_(); _nop_(); _nop_(); } }
|