实验目的: 串口回显程序实验环境: mini2440(arm920t)串口工具(超级终端)
工具: ads1.2 h-jtag1.0
步骤:
1.在ads中新建led工程,添加文件init.s main.c如下
init.s
- area init,code,readonly
- start
- ldr sp,=4096
- import main
- bl main
- end
main.c
- #define rGPHCON (*((volatile unsigned *)0x56000070))
- #define rGPHDAT (*((volatile unsigned *)0x56000074))
- #define rULCON0 (*((volatile unsigned *)0x50000000))
- #define rUCON0 (*((volatile unsigned *)0x50000004))
- #define rUFCON0 (*((volatile unsigned *)0x50000008))
- #define rUMCON0 (*((volatile unsigned *)0x5000000c))
- #define rUBRDIV0 (*((volatile unsigned *)0x50000028))
- #define rUTXH0 (*((volatile unsigned *)0x50000020))
- #define rURXH0 (*((volatile unsigned *)0x50000024))
- #define rUTRSTAT0 (*((volatile unsigned *)0x50000010))
- int main()
- {
- rGPHCON |= 0xa0;
- rULCON0 = 0x3;
- rUCON0 = 0x5;
- rUFCON0 = 0x0;
- rUMCON0 = 0x0;
- rUBRDIV0 = 18;
-
- while(1)
- {
- while(!(rUTRSTAT0 & 0x1));
- while(!(rUTRSTAT0 & 1<<2));
- rUTXH0 = rURXH0;
- }
- return 0;
- }
2.ADS AXD H-JTAG的配置同led程序。超级终端设置 115200 8 n 1 无。备注:
rUTXH0,rURXH0的地址要视大小端情况,刚才开始没注意到一直使用的大端的地址。光盘的示例程序中有2440addr.h文件,可以查找各寄存器的地址。
阅读(370) | 评论(0) | 转发(0) |