音影先锋亚洲天堂网|电影世界尽头的爱完整版播放|国产 熟女 91|高清无码免费观看欧美日韩|韩国一区二区三区黄色录像|美女亚洲加勒比在线|亚洲综合网 开心五月|7x成人在线入口|成人网站免费日韩毛片区|国产黄片?一级?二级?三级

登錄 免費(fèi)注冊 首頁 | 行業(yè)黑名單 | 幫助
維庫電子市場網(wǎng)
技術(shù)交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術(shù) | 電源技術(shù) | 測控之家 | EMC技術(shù) | ARM技術(shù) | EDA技術(shù) | PCB技術(shù) | 嵌入式系統(tǒng)
驅(qū)動(dòng)編程 | 集成電路 | 器件替換 | 模擬技術(shù) | 新手園地 | 單 片 機(jī) | DSP技術(shù) | MCU技術(shù) | IC 設(shè)計(jì) | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe

請問周工關(guān)于串口接收的問題

作者:eaivip 欄目:ARM技術(shù)
請問周工關(guān)于串口接收的問題
以下是我的一塊程序:

void __irq uart0IRQ()
{
    uint8 u8data,handShake[6];
    uint8 cmmd;
    uint8 shakeFlag,downFlag,r;
    uint16 i,TEMP;
    uint32 addr;
    
    shakeFlag=TRUE;
    downFlag=TRUE;
    
    if(U0IIR & 0x0f)
    {
        VICIntEnClr=0x06;        // clear the interrupt
        
        //************ handshake *****************
        for(i=0;i<4;i++)
        {
            r=uartGetByte(&u8data);
            if(!r)
            {
                shakeFlag=FALSE;
                break;
            }
            handShake[i]=u8data;
        }
        
        while(++i==0);
            
        for(i=0;i<4;i++)
            uartSendByte(handShake[i]);
        
        //*********** command execution **********
        
        
        
    }
    
    
    VICVectAddr=0;        // clear the interrupt    
    
    VICIntEnable=0x06;
}

/********************************************
**                uartInit()
********************************************/

void uartInit(void)
{
    uint32 TEMP;
    uint16 Fdiv;
    
    TEMP=(PINSEL0&0xfffffff0)|0x05;  //SELECT RxD0 & TxD0
    PINSEL0=TEMP;
    
    U0LCR=0x83;                        //set the work mode
    Fdiv=(Fpclk/16)/UART0BAUD;        //set the baud rate
    U0DLM=Fdiv/256;
    U0DLL=Fdiv%256;
    U0LCR=0x03;
    
    // set the UART0's interrupt
    U0IER=(U0IER & 0xf8)|0x01;
    
    
    U0IER=0x01;        //enable U0 receive interrupt
    VICVectCntl0=0x20|0x06;        // set IRQ slot0
    VICVectAddr0=(uint32) uart0IRQ;   //set IRQ entry
    VICIntEnable=1<<6;        //enable uart interrupt
        
}

/********************************************
**                uartSendByte()
********************************************/
void uartSendByte(uint8 data)
{
    U0THR=data;
    while((U0LSR&0x40)==0);     //wait the end of the data
}

/********************************************
**    uartGetByte()
********************************************/
uint8 uartGetByte(uint8 *data)
{
    uint32 timeDelay;
    while(!(U0LCR&0x01))
    {
        if(++timeDelay==0)
            return FALSE;
    }
    *data=U0RBR;
    return TRUE;
}

運(yùn)行過程中
向串口送數(shù)據(jù)
返回值全卻全為0
這是怎么回事兒

2樓: >>參與討論
寒夜
檢查一下中斷
從你這段程序來看,程序中斷處理程序中的
VICIntEnClr=0x06和VICIntEnable=0x06語句好象有點(diǎn)問題.
應(yīng)該是VICIntEnClr=(1<<6)和VICIntEnable=(1<<6)吧!
還有你應(yīng)該確認(rèn)一下,是否真正進(jìn)入了中斷程序.

參與討論
昵稱:
討論內(nèi)容:
 
 
相關(guān)帖子
上次聽某兄弟說有LPC2300或LPC2400帶以太網(wǎng)的
關(guān)于南京ARM培訓(xùn)班的問題
ads編譯后運(yùn)行和匯編不一致的的奇怪問題。請教。!
兩條C語句!請教!
關(guān)于串口驅(qū)動(dòng)及中間件的使用--影舞者
免費(fèi)注冊為維庫電子開發(fā)網(wǎng)會(huì)員,參與電子工程師社區(qū)討論,點(diǎn)此進(jìn)入


Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號(hào)