打印

LPC2119 uart1不进中断

[复制链接]
2452|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
gghhz|  楼主 | 2011-10-13 14:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
高手帮忙看看啊,一直不进中断,发送的信号有,接收的信号也有

#include "uart1_display.h"
#define    FPCLK      2764800L
UARTMODE uart1_set;
uint8 num_uart1_receive[50];
uint8 num1_receive;
uint8 receive_buf[50];           //
/*******************************************/
uint8 UART1_Init(uint32 baud,UARTMODE set)
{
  uint32  bak;
  /*????*/
  if((0==baud)||(baud>115200))return(0);
  if((set.datab<5)||(set.datab>8))return(0);
  if((0==set.stopb)||(set.stopb>2))return(0);
  if(set.parity>4)return(0);
  PINSEL0 |= (0x01<<16|0x01<<18);          //
  PINSEL1 |= 0x00000000;

  /*???????*/
  U1LCR=0x80;                         //DLAB??1
  bak=(FPCLK>>4)/baud;
  U1DLM=bak>>8;
  U1DLL=bak&0xff;
  /*??????*/
  bak=set.datab-5;                    //?????
  if(2==set.stopb)bak|=0x04;          //?????2????
  if(0!=set.parity){set.parity=set.parity-1;bak|=0x08;}
  bak|=set.parity<<4;                 //??????
  U1LCR=bak;
return(1);
}
/*******************************************/
void UART1_Set(uint32 baud)
  {
   uart1_set.datab=8;               //8????
   uart1_set.stopb=1;               //1????
   uart1_set.parity=0;              //??????
   UART1_Init(baud,uart1_set);       //???????
   U1FCR=0x81;                      //??FIFO,???????8??
   U1IER=0x01;                         //??RBR??,?????
   /*??????*/
   VICIntSelect=0x00000000;         //???????IRQ??
   VICVectCntl0=0x27;               //UART0???????IRQ Slot0,??????
   VICVectAddr0=(int)IRQ_UART1;     //??UART0????
   VICIntEnable=0x00000080;         //??UART0??
   }
/*******************************************/
void __irq IRQ_UART1(void)
{

uint8 i;
if((U1IIR&0X0F)==0X04)                   //u0 interrupt identification register
   {
    num_uart1_receive[num1_receive++] = U1RBR;
    if(num1_receive==7)
      num1_receive=0;
        }
  VICVectAddr = 0x00;  
}

/******************************************/
void Uart1_Send_Byte(uint8 data)
{
   IO1SET|= (0X01<<4);                  //
   U1THR  = data;                       //
   while( (U1LSR&0x40)==0);          //
   IO1SET&=~(0X01<<4);                  //
}
/******************************************/
void UART1_Operate(uint8 *p)
{
uint8 i;
for(i=8;i>0;i--)
  Uart1_Send_Byte(*(p++));
}
/******************************************/
void Display_Hand(void)
{
uint8 hand[8]={0xaa,0x00,0xcc,0x33,0xc3,0x3c};
UART1_Operate(hand);
}  
/*************************************************/
void Sensor_Data_Display(uint8 num,uint8 *p,uint16 x,uint16 y)
{
uint8 i;
uint8 data[50];
uint8 code1[6],code2[4];
for(i=0;i<num;i++)
  {
   data[i]=p[i];
   }
code1[0] = 0xaa;                        //
code1[1] = 0x6f;                        //
code1[2] = (uint8)x>>8;                        //
code1[3] = (uint8)x;                        
code1[4] = (uint8)y>>8;                        //
code1[5] = (uint8)y;  
UART1_Operate(code1);            
UART1_Operate(data);  
code2[0] = 0xcc;                       //
code2[1] = 0x33;
code2[2] = 0xc3;
code2[3] = 0x3c;
UART1_Operate(code2);
}

相关帖子

沙发
ranqiong1124| | 2011-10-30 22:26 | 只看该作者
没进中断,数据怎么接收到的啊。你怎么确定没有进中断?是DEBUG么,单步时是把子函数当一步程序执行的,要点进入到函数里面的那个才能够看到一步一步执行

使用特权

评论回复
板凳
ycz9999| | 2011-10-30 22:37 | 只看该作者
好像没有看到main函数   你应该是修改了启动文件吧?

使用特权

评论回复
地板
mage心寒| | 2011-11-1 15:01 | 只看该作者
一起求助,我也遇到这样的问题了,我调试外部中断的时候复位的时候怎么进中断了。。

使用特权

评论回复
5
Morn| | 2011-11-1 19:20 | 只看该作者
没有main函数。。

使用特权

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

本版积分规则

3

主题

70

帖子

2

粉丝