打印

想要将g_tAD7606Value.sNowAdc[0]=g_tAD7606.sNowAdc[0]。赋值出现错误

[复制链接]
346|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
哈金|  楼主 | 2019-11-28 09:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
AD7606_VAR_T g_tAD7606;                /* 定义1个全局变量,保存一些参数 */extern AD7606_VAR_T g_tAD7606,g_tAD7606Value[8];


AD7606_VAR_T是一个结构体
typedef struct
{
        uint8_t ucOS;                        /* 过采样倍率,0 - 6. 0表示无过采样 */
        uint8_t ucRange;                /* 输入量程,0表示正负5V, 1表示正负10V */
        int16_t sNowAdc[8];                /* 当前ADC值, 有符号数 */
}AD7606_VAR_T;

*********************************************************************************************************
*        函 数 名: AD7606_ReadNowAdc
*        功能说明: 读取8路采样结果。结果存储在全局变量 g_tAD7606
*        形    参: 无
*        返 回 值: 无
*********************************************************************************************************
*/
void AD7606_ReadNowAdc(void)
{
        g_tAD7606.sNowAdc[0] = AD7606_RESULT();        /* 读第1路样本 */
        g_tAD7606.sNowAdc[1] = AD7606_RESULT();        /* 读第2路样本 */
        g_tAD7606.sNowAdc[2] = AD7606_RESULT();        /* 读第3路样本 */
        g_tAD7606.sNowAdc[3] = AD7606_RESULT();        /* 读第4路样本 */
        g_tAD7606.sNowAdc[4] = AD7606_RESULT();        /* 读第5路样本 */
        g_tAD7606.sNowAdc[5] = AD7606_RESULT();        /* 读第6路样本 */
        g_tAD7606.sNowAdc[6] = AD7606_RESULT();        /* 读第7路样本 */
        g_tAD7606.sNowAdc[7] = AD7606_RESULT();        /* 读第8路样本 */
}

想要让
g_tAD7606Value.sNowAdc[0]=g_tAD7606.sNowAdc[0] ,该怎么做?
错误信息如下:..\..\App\app.c(110): error:  #154: expression must have struct or union type

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

432

主题

433

帖子

1

粉丝