我编写了下面住的那结构体,就是在一个结构体中嵌套一个结构体数组;程序如下:
typedef struct
{
struct data TXBUF[CAN_TXBUF_LENGTH];
volatile uint32_t head; /*!< ReceiveData Tx ring buffer head index */
volatile uint32_t tail; /*!< ReceiveData Tx ring buffer tail index */
volatile uint32_t number;
}CAN_TXBUF;
typedef struct
{
uint32_t Frame;
uint32_t MsgID;
uint32_t DataA;
uint32_t DataB;
};
struct data TXBUF[CAN_TXBUF_LENGTH];
哪位高手能指出哪里错了??谢谢
此帖出自
小平头技术问答
- #define CAN_TXBUF_LENGTH 10
- typedef struct
- {
- uint32_t Frame;
- uint32_t MsgID;
- uint32_t DataA;
- uint32_t DataB;
- } TXBUF;
- typedef struct
- {
- TXBUF txBuf[CAN_TXBUF_LENGTH];
- volatile uint32_t head; /*!< ReceiveData Tx ring buffer head index */
- volatile uint32_t tail; /*!< ReceiveData Tx ring buffer tail index */
- volatile uint32_t number;
- } CAN_TXBUF;
复制代码这样是可以的:
[ 本帖最后由 zhaojun_xf 于 2012-7-26 11:46 编辑 ]
一周热门 更多>