搜索
bottom↓
回复: 0

si4432使用时的问题,哪位大侠帮忙指点一下!!

[复制链接]

出0入0汤圆

发表于 2011-2-28 21:57:09 | 显示全部楼层 |阅读模式
主函数如下,为什么调试时经常跑到第二个 while ( NIRQ == 1);时过不去,有时也会卡到第一while,但有时却跑的很好两个while都能过去,而且通信正常,不知道各位有没有遇到过这种情况还望各位高手指点一下,这个问题已经困扰我很久了!!!
void main(void)
{
        U8 ItStatus1,ItStatus2;
        U16 delay;
        U8 length,temp8;
        U8 payload[10];

        //Initialize the MCU:
        //        - set IO ports for the Software Development board
        //        - set MCU clock source
        //        - initialize the SPI port
        //        - turn off LEDs
        MCU_Init();
                                                        /* ======================================================== *
                                                         *                                                Initialize the Si443x ISM chip                                *
                                                         * ======================================================== */
        //Turn on the radio by pulling down the PWRDN pin
        SDN = 0;
        //Wait at least 15ms befory any initialization SPI commands are sent to the radio
        // (wait for the power on reset sequence)
        for (temp8=0;temp8<15;temp8++)
        {
                for(delay=0;delay<10000;delay++);
        }         
        //read interrupt status registers to clear the interrupt flags and release NIRQ pin
        ItStatus1 = SpiReadRegister(0x03);                                                                                                        //read the Interrupt Status1 register
        ItStatus2 = SpiReadRegister(0x04);                                                                                                        //read the Interrupt Status2 register

        //SW reset   
   SpiWriteRegister(0x07, 0x80);                                                                                                                        //write 0x80 to the Operating & Function Control1 register
       
        //wait for POR interrupt from the radio (while the nIRQ pin is high)
        while ( NIRQ == 1);  
        //read interrupt status registers to clear the interrupt flags and release NIRQ pin
        ItStatus1 = SpiReadRegister(0x03);                                                                                                        //read the Interrupt Status1 register
        ItStatus2 = SpiReadRegister(0x04);                                                                                                        //read the Interrupt Status2 register

        //wait for chip ready interrupt from the radio (while the nIRQ pin is high)
        while ( NIRQ == 1);  
        //read interrupt status registers to clear the interrupt flags and release NIRQ pin
        ItStatus1 = SpiReadRegister(0x03);                                                                                                        //read the Interrupt Status1 register
        ItStatus2 = SpiReadRegister(0x04);                                                                                                        //read the Interrupt Status2 register
          。。。。。。。。。。。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-4 11:14

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表