xu__changhua 发表于 2025-3-20 23:37:07

AI8051U在8位状态下硬件仿真没成功,今用古老的ISD51进行弥补,MON51也可以。

LED流水程序配合ISD51程序如下(在AI8051U上实测,单步、全速、运行到该行等命令没发生意外情况)


#include "reg51.h"
#include "intrins.h"
#include "ISD51.H"

#define FOSC      11059200UL
#define BRT         (65536 - FOSC / 57600 / 4)

sfr   AUXR    =   0x8e;
sfr   T2H   =   0xd6;
sfr   T2L   =   0xd7;

sfr   P1M1    =   0x91;
sfr   P1M0    =   0x92;

void uart_init()
{
    SCON = 0x50;
    T2L = BRT;
    T2H = BRT >> 8;
    AUXR = 0x15;
}

void main()
{
                unsigned char i;

    P1M0 = 0x00;
    P1M1 = 0x00;

    uart_init();//ISD51所必需
    EA = 1;                        //ISD51所必需(ES不用设为1,否则编译时有警告,估计是和ISD51中断地址冲突,不确定)
                ISDinit();        //非必需
                ISDwait();        //非必需,但ISDcheck()要运行,ISDwait()、ISDcheck()二者保留其一。
    while (1)
                {
                        P1=~(0X01<<(i%8));
                        i++;
                        //ISDcheck();//非必需,但ISDwait()要运行,ISDcheck()、ISDwait()二者保留其一。
                }
}

除了这个C程序外,还要将KEIL\C51\ISD51目录里ISD51.A51添加到项目里一同编译产生.HEX。
接着将该.HEX下载到芯片里,程序等待KEIL-ISD51发命令,点KEIL调试按钮就链接上了。关于keil-ISD51设置参考目录里的ISD51.PDF。

跟STC8硬件仿真不同的是,一旦退出ISD51仿真状态再想进入仿真需要重新给芯片上电。

程序里的软件延时删掉了,所以上述程序需加上延时程序全速运行才能观察LED流水。

ISD51对软件延时问题简述一下,仿真时如果进入软件延时程序里,按跳出函数按钮不管用,可以用运行到某行按钮退出。还有就是延时时间与程序实际延时时间不太符合等等。感觉对软件延时挺感冒。

设断点测试了可用。

神农鼎 发表于 2025-3-21 00:15:08



https://www.stcaimcu.com/data/download/Datasheet/AI8051U.pdf

国芯人工智能 发表于 2025-3-20 23:38:00

针对AI8051U在8位状态下硬件仿真未成功的问题,采用ISD51进行弥补是一种可行的解决方案。ISD51作为一款经典的仿真工具,能够有效支持8051系列单片机的调试需求。从提供的代码片段来看,程序结构清晰,采用了标准寄存器定义和ISD51库,确保了调试环境的兼容性。<br><br>在具体实现中,FOSC定义为11.0592MHz,BRT用于波特率计算,确保了串口通信的准确性。AUXR和T2H等特殊功能寄存器的定义,进一步扩展了芯片的功能配置。结合LED流水灯程序,实测结果显示单步、全速及运行到指定行等调试命令均未出现异常,表明ISD51在AI8051U上的调试功能运行稳定。<br><br>建议在后续调试中,继续关注硬件仿真环境的优化,同时结合MON51等其他调试工具,进一步提升开发效率。<br><br>[本文内容由国芯人工智能辅助生成,仅供参考]

xu__changhua 发表于 2025-3-20 23:59:19

如果需要实际运行程序,需要屏蔽掉与ISD51有关的语句,上述程序中有4行,包括头文件。

xu__changhua 发表于 2025-3-21 00:10:30

顺便说一下,AI8051U在32位状态下硬件仿真实测完全正常。

还有上述程序需要单片机实际运行的话,不必移除ISD51.A51,留着它下次仿真查故障只需要把屏蔽掉的4行语句恢复便可。

xu__changhua 发表于 2025-3-21 00:22:29

https://developer.arm.com/documentation/101655/0961/ISD51-User-s-Guide/Program-Integration/Project-Configuration?lang=en
这个网页有ISD51设置的两个图。和下面的文字。
Project Configuration
Once you have added ISD51 to your program, you must configure the µVision IDE and Debugger for communication with the 8051 target system.

Start the 8051 application on the target system before you start the µVision Debugger.
isd51 uv2 debug In µVision, select Project — Options for Target — Debug: Use: Keil ISD51 In-System Debugger.
Enable Load Application at Startup so that the µVision Debugger loads the symbolic information for your 8051 program.
Disable Go till main. Your user program is started by the hardware reset of the 8051 target system.
Click Settings to open the ISD51 Driver Settings dialog and configure the ISD51 Options
isd51 driver

COM Port Settings
These options configure how the PC serial port communicates with your target hardware.

Port: PC COM port used to connect to the 8051 target hardware.
Baudrate: Communication baud rate with the 8051 target hardware.
RTS and DTR: Level on the RTS or DTR lines of the COM Port.
Always High (Active): Signal is always active during µVision Debugger communication.
Always Low (Inactive): Signal is always inactive during µVision Debugger communication.
Reset High 500ms (Active): Signal is active for 500 mSec on Reset Command of µVision Debugger.
Reset Low 500ms (Inactive): Signal is inactive for 500 mSec on Reset Command of µVision Debugger.
Reset Pulse: 500ms High, 10ms Low: Signal is active for 500 mSec then inactive for 10ms on Reset Command of µVision Debugger.
Reset Pulse: 500ms Low, 10ms High: Signal is inactive for 500 mSec then active for 10ms on Reset Command of µVision Debugger.
Cache Options
The ISD51 driver implements memory caches to speed-up screen updates.

Disable the cache options to view actual (un-cached) values of DATA (and SFR), IDATA, or XDATA space when you halt program execution. This way you can be certain you are viewing the current values of I/O ports, timers, or memory-mapped peripherals.
Enable the cache options to obtain maximum performance.
Code Breakpoint Options
This option selects whether or not ISD51 uses software breakpoints, hardware breakpoints, or a combination of both.

If your target 8051 device does not support hardware breakpoints, you must select software breakpoints only.
If your target 8051 device supports hardware breakpoints, you must use software breakpoints when no hardware breakpoints are available.
Miscellaneous Options
Verify if Application in ROM is identical to current Project: Selects whether or not the µVision ISD51 Debugger Driver compares the program code in the 8051 target with the program code of the current project when initializing ISD51 communications. You may disable this option to speed-up the connection time of the debugger with the target system.

If you do not wish to compare the entire application range or if your application contains configuration areas that should be excluded, you may configure the verify address range with CMP_START and CMP_END in the ISD51.H header file.
ISD51 Identification
This box displays the version number and other status information when the µVision Debugger connects to the ISD51 running on the 8051 target system. You may check this information when you open the ISD51 Driver Settings dialog during debugging.

xu__changhua 发表于 2025-3-21 00:34:57

神农鼎 发表于 2025-3-21 00:15
https://www.stcaimcu.com/data/download/Datasheet/AI8051U.pdf

那图中选择的是32位,我试过没问题。8位的话UART仿真不成功,8位USB仿真没测试,估计玄乎。
页: [1]
查看完整版本: AI8051U在8位状态下硬件仿真没成功,今用古老的ISD51进行弥补,MON51也可以。