导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→请教16C554A的访问方法

* 105249: 请教16C554A的访问方法

   zergfan 
zergfan发表的帖子 

 请教16C554A的访问方法

点击浏览该文件
大家好,我做了一个小的系统,其中用到了16C554A,但是怎样也发送不出数据.下面附上一段相关的程序和

原理图,请各位费心,谢谢! 
我没有用中断,用的是16C554A的FIFO POLLED MODE.初始化之后,直接发数据. 
CPU为,MEGA64,16M晶振. 

#define TL16c554A_Base ((volatile unsigned char*) 0x8000) 
#define TL16c554B_Base ((volatile unsigned char*) 0xa000) 
#define TL16c554C_Base ((volatile unsigned char*) 0xc000) 
#define TL16c554D_Base ((volatile unsigned char*) 0xe000) 

#define RBR 0 
#define THR 0 
#define DLL 0 
#define DLM 1 
#define IER 1 
#define IIR 2 
#define FCR 2 
#define LCR 3 
#define MCR 4 
#define LSR 5 
#define MSR 6 

SREG=0x80;                     //Enable all interrupt. 
MCUCR=0xc0;                    //Enable external memory extending. 
XMCRA=0x02;                    //Disable Bus holding 
XMCRB=0x00;                    //Disble Bus release. 
XDIV=0x00;                     //Disable system clk divide. 

void Init_UART(void) 
   { 
     TL16c554_RST=0; 
     _delay_ms(1); 
     TL16c554_RST=1; 
     _delay_ms(1); 
     TL16c554_RST=0; 
     *(TL16c554A_Base+FCR)=0x0f;           // FIFO polled mode . 
     *(TL16c554A_Base+LCR)=0x80; 
     *(TL16c554A_Base+DLL)=0x06; 
     *(TL16c554A_Base+DLM)=0x00; 
     *(TL16c554A_Base+MCR)=0x00; 
     *(TL16c554A_Base+LCR)=0x03; 
     *(TL16c554A_Base+IER)=0x00; 
      
   } 

void Tx_UART(void) 
   { 
     unsigned char temp=0,i; 

     temp=*(TL16c554A_Base+LSR); 

     //Serial_TX(temp); 
     if(temp&0x60==0x60)  //读取LSR的值为0x60,表示发送寄存器和发送移位寄存器空. 
        {          //但是还是发不出数据.(通过串口发送LSR的值,可以确定为0x60) 

         *(TL16c554A_Base)=0xff; 
         _delay_ms(20); 
            
        } 
   }

发表时间:2007年5月15日0:46:59

  
回复该帖

本主题共有 2 帖,分页:>>>>>该主题的所有内容[2]条

 *树形目录 只列出部分跟帖的标题以及简单的摘要信息 该主题的部分跟帖如下:

  105280.[详细]读写控制
摘要:我看你程序里好象没有读写控制啊? 是不是这个原因???? ......(58字)
- [soong][751次] 2007年5月15日

[上一篇帖子]:求救--如何用单片机实现长时间计时????? [求助]   &
[下一篇帖子]:这样MOV   DPTR,TABLE CLR &nb