导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→救命!!关于AT89C2051的P1口的用法!!??[xiao_die]

 *第13454篇: 救命!!关于AT89C2051的P1口的用法!!??

  
楼 主:xiao_die 2003年6月14日12:17
 救命!!关于AT89C2051的P1口的用法!!??
利用仿真器能够顺利通过!当把程序写入芯片运行时,怎么也运行不了!

注:P1口作为输入和输出口,P1.0和P1.1口线作为输出口时,要接上拉电阻,而作为输入口时,要接下拉电阻。但是程序就是不能运行!!


P1口作为键盘扩展口,其中利用到P1.0,P1.1,P1.2以及P1.4,P1.5,P1.6六个口线!

  
2楼:Kuang-chingTsui 2003年6月14日12:22
 p1.0,p1.1要加上拉,不要下拉。。。。。。。。
你把下拉电阻去掉试试。
  
3楼:xiao_die 2003年6月14日12:35
 P1.0和P1.1我都没有下拉电阻!!
  
4楼:alvinyang 2003年6月14日13:40
 可你刚刚说过有的啊 看看你开始的帖子
  
5楼:xiao_die 2003年6月14日13:48
 不好意思!我写错了!
  
6楼:alvinyang 2003年6月14日13:50
 P1口我也认为
P1口我也认为不要加下拉
  
7楼:xiao_die 2003年6月14日14:14
 问题以及解决!谢谢各位!
问题产生的原因:

   现在把P1口描叙如下:    
    Port 1
    Port 1 is an 8-bit bi-irectional I/O port. Port pins P1.2 to P1.7 provide internal Pullups. P1.0 and P1.1 require exter-nal pullups. P1.0 and P1.1 also serve as the positive input (AIN0) and the negative input (AIN1), respectively, of the on-chip precision analog comparator. The Port 1 output buffers can sink 20 mA and can drive LED displays directly.When 1s are written to Port 1 pins, they can be used as inputs. When pins P1.2 to P1.7 are used as inputs and are externally pulled low, they will source current (I IL ) because of the internal pullups.
    Port 1 also receives code data during Flash programming
and verification.

  
8楼:alvinyang 2003年6月14日14:23
 p2和p0口的资料您给我们也看看吧
  
9楼:xiao_die 2003年6月14日14:35
 AT89C2051没有P2和P0口!
Port 3
  Port 3 pins P3.0 to P3.5, P3.7 are seven bi-irectional I/O pins with internal pullups. P3.6 is hard-wired as an input to the output of the on-chip comparator and is not accessible as a general purpose I/O pin. The Port 3 output buffers can sink 20 mA. When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (I IL ) because of the pullups.
  Port 3 also serves the functions of various special features
of the AT89C2051 as listed below:
  Port 3 also receives some control signals for Flash pro-gramming
and verification.

  Port Pin Alternate Functions
  P3.0 RXD (serial input port)
  P3.1 TXD (serial output port)
  P3.2 INT0 (external interrupt 0)
  P3.3 INT1 (external interrupt 1)
  P3.4 T0 (timer 0 external input)
  P3.5 T1 (timer 1 external input)

  
10楼:alvinyang 2003年6月14日14:23
 那P2口和P0
  
11楼:xiao_die 2003年6月14日14:39
 COME,ON!
Restrictions on Certain Instructions
The AT89C2051 and is an economical and cost-effective member of Atmel’s growing family of microcontrollers. It contains 2K bytes of flash program memory. It is fully com-patible with the MCS-51 architecture, and can be programmed using the MCS-51 instruction set. However,there are a few considerations one must keep in mind when utilizing certain instructions to program this device.
  All the instructions related to jumping or branching should be restricted such that the destination address falls within the physical program memory space of the device, which is 2K for the AT89C2051. This should be the responsibility of the software programmer. For example, LJMP 7E0H would be a valid instruction for the T89C2051 (with 2K of memory), whereas LJMP 900H would not.
1. Branching instructions:
LCALL, LJMP, ACALL, AJMP, SJMP, JMP @A+DPTR
  These unconditional branching instructions will execute correctly as long as the programmer keeps in mind that the destination branching address must fall within the physical boundaries of the program memory size (locations 00H to 7FFH for the 89C2051). Violating the physical space limits may cause unknown program behavior.
CJNE [...], DJNZ [...], JB, JNB, JC, JNC, JBC, JZ, JNZ With these conditional branching instructions the same rule above applies. Again, violating the memory boundaries
may cause erratic execution.
For applications involving interrupts the normal interrupt service routine address locations of the 80C51 family archi-tecture have been preserved.
2. MOVX-related instructions, Data Memory:
  The AT89C2051 contains 128 bytes of internal data mem-ory.Thus, in the AT89C2051 the stack depth is limited to 128 bytes, the amount of available RAM. External DATA memory access is not supported in this device, nor is exter-nal
PROGRAM memory execution. Therefore, no MOVX [...] instructions should be included in the program. A typical 80C51 assembler will still assemble instructions,
even if they are written in violation of the restrictions men-tioned above. It is the responsibility of the controller user to know the physical features and limitations of the device being used and adjust the ins t ructions used correspondingly.
  
12楼:alvinyang 2003年6月14日14:48
 谢谢!你在那里找到的?
你用过双串口的MCU吗?你有这方面的资料吗?我现在急需!谢谢你!、
  
13楼:xiao_die 2003年6月14日14:53
 没有用过,你去www.21ic.com看看!
我目前只知道W77E58,DS80C320有双串口!

>>>>>>对该主题发表你的看法

本主题贴数13,分页: [第1页]


[上一篇主题]:不关单片机!

[下一篇主题]:想买一个能写FLASH的编程器,大家推荐推