This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ZigBee 无符号长整型除法

Other Parts Discussed in Thread: CC2530

我用长整型变量 a=32279638,我除以32,ZigBee会输出2736(具体是多少,没看清,但是蛋疼的它竞然只有4位数啊,这就不科学的);然而我用C++写代码运算,他毫无问题,得到1008738


unsigned long mhz19Read(void)
{
  unsigned long count1,count2,value,th,tl;
  //float th,tl;
  //unsigned int n1=0,n2=0,tl,th,value,v1,v2,flag=0;
  while(MHZ19IO)
  {
  }
  while(!MHZ19IO)//以上两步,寻找起始点
  {
  }
  while(MHZ19IO)
  {
    count1+=1;
  }
  while(!MHZ19IO)
  {
    count2+=1;
  }


  th=count1/32;
  tl=count2/32/1000;
  value=2000*(th-2)/(th+tl-4);
 //return count1;

//return th;
}