试了n次 我不知道该 怎么弄 哪位 帮我 看下。中断也没触发,字符也没读进来。
板子是lpc2210
宏变量:
/*timer 0*/
#define t0pr (*(long *)0xe000400c) #define t0mcr (*(long *)0xe0004014) #define t0mr0 (*(long *)0xe0004018) #define t0tcr (*(long *)0xe0004004) #define t0pc (*(long *)0xe0004010) #define t0ccr (*(long *)0xe0004028) #define t0emr (*(long *)0xe000403c) #define t0tc (*(long *)0xe0004008)
/*timer 1*/
#define t1tcr (*(long *)0xe0008004) #define t1tc (*(long *)0xe0008008) #define t1pr (*(long *)0xe000800c) #define t1pc (*(long *)0xe0008010) #define t1mr0 (*(long *)0xe0008018) #define t1mcr (*(long *)0xe0008014)
/*vic interrupt*/
#define vicprotection (*(long *)0xfffff020) #define vicintenclr (*(long *)0xfffff014) #define vicintselect (*(long *)0xfffff00c) #define vicdefvectaddr (*(long *)0xfffff034) #define vicvectcntl0 (*(long *)0xfffff200) #define vicvectaddr0 (*(long *)0xfffff100) #define vicvectcntl1 (*(long *)0xfffff204) #define vicvectaddr1 (*(long *)0xfffff104) #define vicintenable (*(long *)0xfffff010)
/*interupt*/
#define vectint (*(long *)0xfffff018) #define funaddr (*(long *)0xfffff034)
/*pin*/
#define pinsel0 (*(long *)0xe002c000) #define beepcon 1<<7 #define io0dir (*(long *)0xe0028008) #define ioclr (*(long *)0xe002800c) #define ioclr0 (*(long *)0xe002800c) #define io1set (*(long *)0xe0028014)
/*serial port output*/
#define paddr (*(long *)0xe000c000) #define u0rbr (*(long *)0xe000c000)
/*ura interupt*/ #define u0fcr (*(long *)0xe000c008) #define u0ier (*(long *)0xe000c004) #define u0lcr (*(long *)0xe000c00c) #define u0dll (*(long *)0xe000c000) #define u0dlm (*(long *)0xe000c004)
/* values */ #define fosc 11059200 #define fcclk (fosc*4) #define fpclk (fcclk/4)*1
/* interupt register */ #define u0iir (*(long *)0xe000c008)
初始化:
int bak;
pinsel0=0x5; u0lcr=0x80; bak=(fpclk>>4)/115200; u0dlm=bak>>8; u0dll=bak&0xff; u0lcr=0x03; u0fcr=0x47; u0ier=u0ier|0x01; vicintselect=0x0; vicintenable=0x00000040;
vicvectcntl0=0x26; vicvectaddr0=(int)testirq; io1set=0xffffffff;
读取: int i; for(i=0;i<1;i++) { temp=u0rbr; } 哪位知道 应该 怎么初始化,有没有简单的例子,那种用信号量的方法太复杂了,哪位能给我个例子,最好是几句话的只要能读入就好了,就像 输出只要u0rbr='a';这样就可以了,
|