采用s12xep100
我没有用过外扩模式,不好意思。不过就我的理解而言,对于16位机是以字为单位访问在的,先访问奇地址,再访问偶地址,然后联合成一个字。
对于XEP而言,FLASH与RAM如果不是不够用,就不要用外扩模式了,用IO口线当地址用,也许更好更方便一点,
你是只要一个时钟还是要RAM里面的数据,对于DS1643也可以用口线去访问的.
我现在的现象是偶地址访问数据错误!strongchen大侠具体指点一下,硬件该怎么接,软件该怎么配置和访问!不胜感激!!
原文:
Interfacing to 8-bit Peripherals
The External Bus Interface is primarily designed to interface the MCU to 16-bit peripherals. However, with
certain limitations, it can also be used to interface to an 8-bit peripheral (for example, an LCD driver). In
this case, the HDBE bit in EBICTL0 register is cleared, only the lower half of the data bus is used, and the
LDS and UDS signals are not used by the external bus interface. Registers of the peripheral are then
visible on odd addresses only. The fact that the peripheral!ˉs registers are visible on every other address
in the memory space presents a problem only if the peripheral contains some sort of linear buffer. Such
a buffer would ideally be addressed by the application as a linear array of bytes. In this case two simple
workarounds exist:
?Make the array twice as big, and address only every other location in the array.
?Create the array as an array of words, rather than bytes, and ignore the upper byte of every word
in the array.
Both workarounds lead to a slight software overhead in the application, but this is relatively minor and can
usually be tolerated.
有些地方理解得不是很明白!请赐教!
www.freescale.com/files/
上面这个地址可以下载!
这段话的意思是说,如果将EBICLT0寄存器中的HDBE位清零,那么数据总线中只有低8位有效,同时/LDS和/UDS脚也不再作为扩展总线信号使用。这样,可以腾出很多脚做普通I/O口。但同时,由于ADDR0位与/UDS是共用的,这样ADDR0也没有输出了。此时一般会将ADDR1接道外设的ADDR0。这样,对于S12X来说,外设的寄存器就只能每间隔一个地址才有一个有效地址了。
多谢strongchen指点!
那是否意味着外扩8bit外设时必须将ADDR1接外设的ADDR0,访问地址时先将待访问地址左移一位,再将最低位置1(保证为奇地址),这样就能访问所有的空间了!
不知道这样理解是否正确?
strongchen大侠能否提供相关的例子!多谢了!
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |