回复帖子:(湖北孝感(0.0.*.*))函数调用死机问题

用户名:   *您没有注册?
密码:   *忘记论坛密码?    标题采用“回复:XXX....”
验证码 点击获取验证码
主题标题:  *不得超过 200 个汉字
当前心情
上一页 发帖表情 下一页
内容
  

主题最新回顾(发布时间:2005-10-17 9:36:00)
--  作者:zhl(0.0.*.*)
--  
仅从这段代码中看不出什么问题,你发的程序已经收到了。我们看了后再和你联系。

主题最新回顾(发布时间:2005-10-16 11:34:00)
--  作者:湖北孝感(0.0.*.*)
--  函数调用死机问题
我用的是ETR186T,在实现TCP/IP远程数据传输过程中,如果我把传送代码用子函数实现,在函数退出时死机(INT6@2E35:387D),但我用相同的代码直接在主程序中(不用函数调用),则不死机,不知为什么?
我的函数是:
int GPRSReg()
{

     unsigned char   GPRSTxdBuf[1024];
     unsigned char   buf[4];
     int i;
     unsigned char sum=0;

     i=GetOWNIP( GPRSTxdBuf );
     sprintf( buf,"IP=%d.%d.%d.%d", GPRSTxdBuf[0],GPRSTxdBuf[1], GPRSTxdBuf[2],
                                GPRSTxdBuf[3] );

     GPRSTxdBuf[0]=0x68;
     GPRSTxdBuf[3]=0x68;
     GPRSTxdBuf[1]=0x15;
     GPRSTxdBuf[2]=0xea;  //协议头

     GPRSTxdBuf[4]=0x00;
     sum= sum+  GPRSTxdBuf[4];
     GPRSTxdBuf[5]=0x00;
     sum= sum+  GPRSTxdBuf[5];
     GPRSTxdBuf[6]=0x00;
     sum= sum+  GPRSTxdBuf[6];
     GPRSTxdBuf[7]=0x01;
     sum= sum+  GPRSTxdBuf[7];

     GPRSTxdBuf[8]=0xC1;
     sum= sum+  GPRSTxdBuf[8];
     
     GPRSTxdBuf[9] =0x13;
     sum= sum+  GPRSTxdBuf[9]+0x33;
     GPRSTxdBuf[10]=0x47;
      sum= sum+  GPRSTxdBuf[10]+0x33;
     GPRSTxdBuf[11]=0x65;
      sum= sum+  GPRSTxdBuf[11]+0x33;
     GPRSTxdBuf[12]=0x48;
      sum= sum+  GPRSTxdBuf[12]+0x33;
     GPRSTxdBuf[13]=0x83;
      sum= sum+  GPRSTxdBuf[13]+0x33;
     GPRSTxdBuf[14]=0x3F;
      sum= sum+  GPRSTxdBuf[14]+0x33;
     
     GPRSTxdBuf[15]=buf[0];
      sum= sum+  GPRSTxdBuf[15]+0x33;
     GPRSTxdBuf[16]=buf[1];
      sum= sum+  GPRSTxdBuf[16]+0x33;
     GPRSTxdBuf[17]=buf[2];
      sum= sum+  GPRSTxdBuf[17]+0x33;
     GPRSTxdBuf[18]=buf[3];
      sum= sum+  GPRSTxdBuf[18]+0x33;
     
     GPRSTxdBuf[19]=0x17;
      sum= sum+  GPRSTxdBuf[19]+0x33;
     GPRSTxdBuf[20]=0x77;
      sum= sum+  GPRSTxdBuf[20]+0x33;
      sum=sum+0x33;
     GPRSTxdBuf[21]=sum;
     GPRSTxdBuf[22]=0x16;
     GPRSTxdBuf[23]=<|>\0<|>;
 /*    strcpy(GPRSTxdBuf,"123");
     i = strlen( GPRSTxdBuf ) 
     GPRSTxdBuf[24] =<|>\0<|>;
     GPRSTxdBuf[25] =<|>\0<|>;    */
     i=TCPCManager->WriteData( GPRSTxdBuf, 23 );
     return i;
}