This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于28069的CLA程序问题

Uint32 ulValue;

long  lValue;

// 执行下面的语句之后 ulValude = 0x0FFF 0FFF, 而不是0x0FFF

ulValue = AdcResult.ADCRESULT8;  // AdcResult.ADCRESULT8的值为0x0FFF;

// 执行下面的语句之后lValue = 0

lValue = AdcResult.ADCRESULT8;  // AdcResult.ADCRESULT8的值为0x0FFF;

难道28069的CLA不支持数据类型转换吗?或者需要做什么配置?

  • Uint32 ulValue;

    long  lValue;

    // 执行下面的语句之后 ulValude = 0x0FFF 0FFF, 而不是0x0FFF

    ulValue = AdcResult.ADCRESULT8;  // AdcResult.ADCRESULT8的值为0x0FFF;

    // 执行下面的语句之后lValue = 0

    lValue = AdcResult.ADCRESULT8;  // AdcResult.ADCRESULT8的值为0x0FFF;

    难道28069的CLA不支持数据类型转换吗?或者需要做什么配置?

    Eric:

    CLA architecture is designed for 32-bit data types
    16-bit computations incur overhead for sign-extension
    Primarily used for reading and writing to 16-bit
    peripheral registers

    TYPE            CPU            CLA
    char, short    16 bit          16 bit
    int                 16 bit           32 bit
    long              32 bit           32 bit
    long long       64 bit           32 bit
    float, double  32 bit           32 bit
    long double   64 bit           32 bit
    pointers         32 bit           16 bit

    加强制类型转换:

    xDelay[0] = (float32)AdcResult.ADCRESULT0;