*size_out = sizeof(STU_PACK_HEAD)+pHead->body_len+2; uint16_t crc = crc16_modbus(out,*size_out-2); printf("size_out=%d \n",*size_out); uint16_t *pcrc = (uint16_t*)(out+sizeof(STU_PACK_HEAD)+pHead->body_len); printf("pcrc addr=0x%08lx 0x%08lx \n",(UINT32)pcrc,(UINT32)(out+sizeof(STU_PACK_HEAD)+pHead->body_len)); //*pcrc = crc; /// 使用这一句就死机了,换成下面两句正常 //*(uint16_t*)(out+sizeof(STU_PACK_HEAD)+pHead->body_len) = crc;//crc16_modbus(out,*size_out-2); *(out+sizeof(STU_PACK_HEAD)+pHead->body_len) = (crc&0x00FF); *(out+sizeof(STU_PACK_HEAD)+pHead->body_len+1) = (crc&0xFF00)>>8;
我想知道为什么用 *pcrc = crc ; 这样就死掉了
热门产品 :
CH32X035: 32位USB+USB PD单片机