Am-PCB 发表于 2013-1-31 17:13:38

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

本帖最后由 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);    // {:sad:} 就是这个地方程序跳不过去,请求指导。
       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);          
       
}

hhxb 发表于 2013-1-31 17:58:14

可能是硬件问题

Am-PCB 发表于 2013-1-31 18:22:39

hhxb 发表于 2013-1-31 17:58 static/image/common/back.gif
可能是硬件问题

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

hhxb 发表于 2013-1-31 18:32:11

Am-PCB 发表于 2013-1-31 18:22 static/image/common/back.gif
硬件确定没问题的,10kbps的速率下测过,是可以的,收发正常,改成40kbps再测的时候就不行了,特别诡异。 ...

不信算了

i_kkyu 发表于 2013-1-31 19:02:37

看起来2楼的是有类似经验的。

scty 发表于 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,清标志位

Am-PCB 发表于 2013-2-27 22:43:47

scty 发表于 2013-2-9 18:31 static/image/common/back.gif
程序有错,就在你跳不过去的那个位置的前面,少了语句。
自己对比一下官网的代码吧...



谢谢。。。。{:smile:}

金美祖 发表于 2013-8-30 14:17:25

少了哪一件,最终好了吗?

Am-PCB 发表于 2013-8-31 13:54:43

金美祖 发表于 2013-8-30 14:17 static/image/common/back.gif
少了哪一件,最终好了吗?

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

金美祖 发表于 2013-9-1 14:24:15

Am-PCB 发表于 2013-8-31 13:54 static/image/common/back.gif
完全解决这个之前就移交给其他人做了,应该是好了,但我没再接手做,不是很清楚最后怎么解决的。。。。 ...

非常感谢你的回复.
页: [1]
查看完整版本: SI4432的发射程序中,有个判断中断语句跳不过,请教各位