搜索
bottom↓
回复: 9

SI4432的发射程序中,有个判断中断语句跳不过,请教各位

[复制链接]

出0入0汤圆

发表于 2013-1-31 17:13:38 | 显示全部楼层 |阅读模式
本帖最后由 Am-PCB 于 2013-1-31 17:14 编辑

这是发射子函数
void sending()
{         
    //Wait for releasing the push button
        //while( PB == 0 );
        //disable the receiver chain (but keep the XTAL running to have shorter TX on time!)
        SpiWriteRegister(0x07, 0x01);                //write 0x01 to the Operating Function Control 1 register                       

        //turn on the LED to show the packet transmission
        //TX_LED = 1;                                                                                                                                                        
        /*SET THE CONTENT OF THE PACKET*/
        //set the length of the payload to 8bytes       
        SpiWriteRegister(0x3E, 8);                                                                                                                //write 8 to the Transmit Packet Length register               
        //fill the payload into the transmit FIFO
        SpiWriteRegister(0x7F, 0x42);                //write 0x42 ('B') to the FIFO Access register       
        SpiWriteRegister(0x7F, 0x55);                //write 0x55 ('U') to the FIFO Access register       
        SpiWriteRegister(0x7F, 0x54);                //write 0x54 ('T') to the FIFO Access register       
        SpiWriteRegister(0x7F, 0x54);                //write 0x54 ('T') to the FIFO Access register       
        SpiWriteRegister(0x7F, 0x4F);                //write 0x4F ('O') to the FIFO Access register       
        SpiWriteRegister(0x7F, 0x4E);                //write 0x4E ('N') to the FIFO Access register       
        SpiWriteRegister(0x7F, 0x31);                //write 0x31 ('1') to the FIFO Access register       
        SpiWriteRegister(0x7F, 0x0D);                //write 0x0D (CR) to the FIFO Access register       

        //Disable all other interrupts and enable the packet sent interrupt only.
        //This will be used for indicating the successfull packet transmission for the MCU
        SpiWriteRegister(0x05, 0x04);                //write 0x04 to the Interrupt Enable 1 register       
        SpiWriteRegister(0x06, 0x00);                //write 0x03 to the Interrupt Enable 2 register       
        //Read interrupt status regsiters. It clear all pending interrupts and the nIRQ pin goes back to high.
        ItStatus1 = SpiReadRegister(0x03);                //read the Interrupt Status1 register
        ItStatus2 = SpiReadRegister(0x04);                //read the Interrupt Status2 register

        /*enable transmitter*/
        //The radio forms the packet and send it automatically.
        SpiWriteRegister(0x07, 0x09);                //write 0x09 to the Operating Function Control 1 register
         
        /*wait for the packet sent interrupt*/
        //The MCU just needs to wait for the 'ipksent' interrupt.
         while(NIRQ == 1);    // 就是这个地方程序跳不过去,请求指导。
         led1();
        //read interrupt status registers to release the interrupt flags
        ItStatus1 = SpiReadRegister(0x03);                //read the Interrupt Status1 register
        ItStatus2 = SpiReadRegister(0x04);                //read the Interrupt Status2 register

        //wait a bit for showing the LED a bit longer
        for(delay = 0; delay < 10000;delay++);
        //for(delay = 0; delay < 60000;delay++);

        //Enable two interrupts:
        // a) one which shows that a valid packet received: 'ipkval'
        // b) second shows if the packet received with incorrect CRC: 'icrcerror'
        SpiWriteRegister(0x05, 0x03);                 //write 0x03 to the Interrupt Enable 1 register
        SpiWriteRegister(0x06, 0x00);                 //write 0x00 to the Interrupt Enable 2 register
        //read interrupt status registers to release all pending interrupts
        ItStatus1 = SpiReadRegister(0x03);                //read the Interrupt Status1 register
        ItStatus2 = SpiReadRegister(0x04);                //read the Interrupt Status2 register
        SpiWriteRegister(0x07, 0x05);          
       
}

阿莫论坛20周年了!感谢大家的支持与爱护!!

你熬了10碗粥,别人一桶水倒进去,淘走90碗,剩下10碗给你,你看似没亏,其实你那10碗已经没有之前的裹腹了,人家的一桶水换90碗,继续卖。说白了,通货膨胀就是,你的钱是挣来的,他的钱是印来的,掺和在一起,你的钱就贬值了。

出0入17汤圆

发表于 2013-1-31 17:58:14 | 显示全部楼层
可能是硬件问题

出0入0汤圆

 楼主| 发表于 2013-1-31 18:22:39 | 显示全部楼层
hhxb 发表于 2013-1-31 17:58
可能是硬件问题

硬件确定没问题的,10kbps的速率下测过,是可以的,收发正常,改成40kbps再测的时候就不行了,特别诡异。。。。。

出0入17汤圆

发表于 2013-1-31 18:32:11 | 显示全部楼层
Am-PCB 发表于 2013-1-31 18:22
硬件确定没问题的,10kbps的速率下测过,是可以的,收发正常,改成40kbps再测的时候就不行了,特别诡异。 ...

不信算了

出0入0汤圆

发表于 2013-1-31 19:02:37 | 显示全部楼层
看起来2楼的是有类似经验的。

出0入0汤圆

发表于 2013-2-9 18:31:18 | 显示全部楼层
程序有错,就在你跳不过去的那个位置的前面,少了语句。
自己对比一下官网的代码吧...

//enable transmitter
//The radio forms the packet and send it automatically.
  SPIWriteReg(OPERATING_FUNCTION_CONTROL_1,0x09);         //reg.07,发射

//enable the packet sent interupt only
  SPIWriteReg(0x05, 0x04);                                  //write 0x04 to the Interrupt Enable 1 register
//read interrupt status to clear the interrupt flags
  ItStatus1 = SPIReadReg(INTERRUPT_STATUS_1);             //reg.03,清标志位
  ItStatus2 = SPIReadReg(INTERRUPT_STATUS_2);             //reg.04,清标志位
  
/*wait for the packet sent interrupt*/
//The MCU just needs to wait for the 'ipksent' interrupt.  
  while (IRQ_PxIN & IRQ_PIN);
//read interrupt status registers to release the interrupt flags
  ItStatus1 = SPIReadReg(INTERRUPT_STATUS_1);             //reg.03,清标志位
  ItStatus2 = SPIReadReg(INTERRUPT_STATUS_2);             //reg.04,清标志位

出0入0汤圆

 楼主| 发表于 2013-2-27 22:43:47 | 显示全部楼层
scty 发表于 2013-2-9 18:31
程序有错,就在你跳不过去的那个位置的前面,少了语句。
自己对比一下官网的代码吧...

谢谢。。。。

出0入0汤圆

发表于 2013-8-30 14:17:25 | 显示全部楼层
少了哪一件,最终好了吗?

出0入0汤圆

 楼主| 发表于 2013-8-31 13:54:43 | 显示全部楼层
金美祖 发表于 2013-8-30 14:17
少了哪一件,最终好了吗?

完全解决这个之前就移交给其他人做了,应该是好了,但我没再接手做,不是很清楚最后怎么解决的。。。。

出0入0汤圆

发表于 2013-9-1 14:24:15 | 显示全部楼层
Am-PCB 发表于 2013-8-31 13:54
完全解决这个之前就移交给其他人做了,应该是好了,但我没再接手做,不是很清楚最后怎么解决的。。。。 ...

非常感谢你的回复.
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-3 03:21

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

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