|
技术交流 | 电路欣赏 | 工控天地 | 数字广电 | 通信技术 | 电源技术 | 测控之家 | EMC技术 | ARM技术 | EDA技术 | PCB技术 | 嵌入式系统 驱动编程 | 集成电路 | 器件替换 | 模拟技术 | 新手园地 | 单 片 机 | DSP技术 | MCU技术 | IC 设计 | IC 产业 | CAN-bus/DeviceNe |
请教:P89C669不能正常运行的问题,急 |
作者:scwjx2008 栏目:MCU技术 |
请教周工: 我在用keilC编写P89C669的的程序时,如果在子程序后加上“reentrant"关键字后,编译后无错误,在调试时,到执行子程序时会出现“*** error 65: access violation at 0x007FFE : no 'write' permission”这种错误, 如果将编译后的Hex文件写入P89C669,程序不能正常运行,且PSEN脚输出周期脉冲。如果将“reentrant"关键字去掉,程序不论是调试还是在芯片上运行都正确。请问这是什么原因?急盼回复。谢谢先! |
2楼: | >>参与讨论 |
作者: zlgmcu 于 2006/12/19 16:50:00 发布:
完全是程序问题,及编译环境的设置问题, 与P89C669没有关系. 解决方法,c51bbs.com有个论坛精华贴合集, 可以下载下来,用搜索栏搜索一下,可以找到很多解决办法. |
3楼: | >>参与讨论 |
作者: scwjx2008 于 2006/12/20 11:31:00 发布:
但是如果把单片机改为p89c60x2或其他单片机一切正常 程序如下: “START_MX.A51" $MOD_MX51 ;------------------------------------------------------------------------------ ; This file is PART of the PK51 Professional Developers Kit ; Startup Code for the PHILIPS 80C51MX architecture ; COPYRIGHT (c) 2000-2002 Keil Elektronik GmbH and Keil SOFTWARE, Inc. ; Version 1.03 ;------------------------------------------------------------------------------ ; START_MX.A51: This code is executed after processor reset. ; You may add this file to a uVision2 project. ; ; To translate this file manually use AX51 with the following invocation: ; ; AX51 START_MX.A51 ; ; To LINK the MODIFIED START_MX.OBJ file to your application use the ; following LX51 invocation: ; ; LX51 START_MX.OBJ, <your object file list> <CONTROLs> ; ;------------------------------------------------------------------------------ ; ; Setup 80C51MX Configuration Register (MXCON) ; ; Extended Call Return Mode (intermixed subroutine call with ECALL/LCALL/ACALL) ; ECRM Val DESCRIPTION ; --- --- ----------- ECRM EQU 0 ; 0 = classic CALL/RET instructions with 2-byte stack frame ; ; 1 = CALL/RET save and restore the full 3-byte program counter ; NOTE: ECRM is ONLY available on some devices, check your chip specification ; ; Extended Addressing Mode (enable upper address multiplex on PORT 2) ; EAM Val DESCRIPTION ; --- --- ----------- EAM EQU 0 ; 0 = do not change configuration state of the CPU ; ; 1 = enable extended addressing mode (multiplex A16..A22 on PORT 2) ; ; Extended Stack MEMORY Mode (16-bit Stack Pointer) ; ESMM Val DESCRIPTION ; ---- --- ----------- ESMM EQU 1 ; 0 = classic 8051 stack pointer (8-bit) addressing IDATA space ; ; 1 = extended 16-bit stack pointer addressing EDATA space ; ; Extended Interrupt Frame ; EIFM Val DESCRIPTION ; -- --- ----------- EIFM EQU 0 ; 0 = classic 8051 interrupt frame (16-bit address pushed) ; ; 1 = extended 24-bit interrupt frame (3 bytes pushed on interrupt) ; ; ; ; Setup Additional Features (AUXR, AUXR1) ; ; XDATA access (External XDATA space) ; EXTRAM Val DESCRIPTION ; --- --- ----------- EXTRAM EQU 1; 0 = access on-chip XDATA RAM ; ; 1 = disable on-chip XDATA and access off-chip XDATA space ; ; ALE (Address Latch Enable) OUTPUT Signal ; AO Val DESCRIPTION ; -- --- ----------- AO EQU 0 ; 0 = ALE signal is generate at a constant rate ; ; 1 = ALE signal is active ONLY during a MOVX or MOVC instruction ; ; Low Volatage (Vcc) configuration ; LPEP Val DESCRIPTION ; ---- --- ----------- LPEP EQU 0 ; 0 = chip supply volatage (Vcc) is above 4V ; ; 1 = chip supply volatage (Vcc) is below 4V ;------------------------------------------------------------------------------ ; ; CPU Stack Size Definition ; ; The following EQU statement defines the stack space available in extended ; stack mode (ESMM set to 1) for the application program. It should be noted ; that the stack space must be adjusted according the actual requirements of ; the application. ; STACKSIZE EQU 100H ; set to 100H Bytes. ; ;------------------------------------------------------------------------------ ; ; User-defined Power-On Initialization of MEMORY ; ; With the following EQU statements the initialization of MEMORY ; at processor reset can be defined: ; ; ; the absolute start-address of IDATA MEMORY is always 0 IDATALEN EQU 0FFH ; the length of IDATA MEMORY in bytes. ; XDATASTART EQU 0H ; the absolute start-address of XDATA MEMORY XDATALEN EQU 8000H ; the length of XDATA MEMORY in bytes. ; PDATASTART EQU 0H ; the absolute start-address of PDATA MEMORY PDATALEN EQU 0H ; the length of PDATA MEMORY in bytes. ; ; Notes: The IDATA space overlaps physically the DATA and BIT areas of the ; 80C51MX CPU. ;------------------------------------------------------------------------------ ; ; Reentrant Stack Initilization ; ; The following EQU statements define the stack pointer for reentrant ; functions and initialized it: ; ; Stack Space for reentrant functions in the SMALL MODEL. IBPSTACK EQU 0 ; set to 1 if small reentrant is used. IBPSTACKTOP EQU 0FFH+1 ; set top of stack to highest location+1. ; ; Stack Space for reentrant functions in the LARGE MODEL. XBPSTACK EQU 1 ; set to 1 if large reentrant is used. XBPSTACKTOP EQU 7FFFH+1; set top of stack to highest location+1. ; ; Stack Space for reentrant functions in the COMPACT MODEL. PBPSTACK EQU 0 ; set to 1 if compact reentrant is used. PBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1. ; ;------------------------------------------------------------------------------ ; ; Page Definition for Using the Compact MODEL with 64 KByte xdata RAM ; ; The following EQU statements define the xdata page used for pdata ; variables. The EQU PPAGE must conform with the PPAGE CONTROL used ; in the LINKer invocation. ; PPAGEENABLE EQU 0 ; set to 1 if pdata ob |
4楼: | >>参与讨论 |
作者: scwjx2008 于 2006/12/20 11:32:00 发布:
图2 |
5楼: | >>参与讨论 |
作者: zlgmcu 于 2006/12/20 14:11:00 发布:
如果改成p89c60x2没有问题, 那么与Start_MX.a51 及keil的设置有很大关系. 如果您选择p89c60x2可以,那就保持这个选择. 没必要一定要选P89C669的, |
6楼: | >>参与讨论 |
作者: scwjx2008 于 2006/12/21 9:12:00 发布:
谢谢,问题已经解决,原因为Start_MX.a51的设置问题 |
7楼: | >>参与讨论 |
作者: zlgmcu 于 2006/12/21 14:19:00 发布:
如果方便,不知道能否把a51文件中设置出问题的地方列出来, 这样,下次有人碰见了,只要叫他来翻这个贴子就行了. 谢谢. |
|
|
免费注册为维库电子开发网会员,参与电子工程师社区讨论,点此进入 |
Copyright © 1998-2006 www.dzsc.com 浙ICP证030469号 |