这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 综合技术 » 基础知识 » VXWORKS,NUCLEUS,keil,for,arm,01a,ccd,135

共2条 1/1 1 跳转至

,VXWORKS,NUCLEUS,keil,for,arm,01a,ccd,13581980230, 请问各位大虾,很简单的一个问题,我想不明白,在51中可以?

院士
2006-09-17 18:14:16     打赏
,VXWORKS,NUCLEUS,keil,for,arm,01a,ccd,13581980230, 请问各位大虾,很简单的一个问题,我想不明白,在51中可以???



关键词: VXWORKS     NUCLEUS     135819802    

院士
2006-12-22 22:43:00     打赏
2楼
问 请问,就是下面的问题
typedef struct
{
   unsigned short  h_type;
   unsigned short  p_type;           
   unsigned char   h_len;
   unsigned char   i_len;               
   unsigned short  m_type;
   unsigned char   sr[6];              
   unsigned int    sddr;
   unsigned char   dr[6];    
   unsigned int    dddr;
} ARP_HEADER;

uchar RXT[] = {
               0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x03,0x0F,
               0xF9,0xAE,0xF9,0x08,0x06,0x00,0x01,0x08,0x00,
               0x06,0x04,0x00,0x01,0x00,0x03,0x0F,0xF9,0xAE,
               0xF9,0xC0,0xA8,0x01,0xFA,0x00,0x00,0x00,0x00,
               0x00,0x01,0xC0,0xA8,0x01,0xFA,0x66
               };


   uint volatile w;
   ARP_HEADER * ar;
      
   arp = (ARP_HEADER *)(RXT + 14);
   w = ar->daddr;    //这个总是不对
   w = ar->sddr;  //这个正确

这样的结构我读dddr的数据总是不对,为什么?  1: ALIGN 引起的.#pragma pack(push,1)
typedef struct
{
   unsigned short  h_type;
   unsigned short  p_type;           
   unsigned char   h_len;
   unsigned char   i_len;               
   unsigned short  m_type;
   unsigned char   sr[6];              
   unsigned int    sddr;
   unsigned char   dr[6];    
   unsigned int    dddr;
} ARP_HEADER;
#pragma pack(pop)

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]