打印
[AVR单片机]

请教M64访问16C554A的问题,谢谢

[复制链接]
2237|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
zergfan|  楼主 | 2007-5-15 00:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
大家好,我做了一个小的系统,其中用到了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); 
            
        } 
   } 
相关链接:https://bbs.21ic.com/upfiles/img/20075/200751503644759.rar

相关帖子

沙发
HotPower| | 2007-5-15 01:33 | 只看该作者

总能接收数据吧~~~554应该很容易控制,除非虚焊~~~

使用特权

评论回复
板凳
zrfeng| | 2007-11-12 11:38 | 只看该作者

请问问题解决了吗?我使用时好像和你的现象一样。

我用的是dsp接的16c554,不知道是否和你的问题一样。

使用特权

评论回复
地板
zxdong0612| | 2013-2-25 00:28 | 只看该作者
我现在也在调554 ,看这个帖子有些许收获

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝