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.

关于Q格式数据的问题



我在Solar explorer kit 文档中看到一个关于SGEN产生50Hz正弦波的代码示例

/* Signal Generator module initialisation           */  

sgen.offset=0;

sgen.gain=0x7fff;       /* gain=1 in Q15      */

sgen.freq=0x14F8CF92;   /* freq = (Required Freq/Max Freq)*2^31 */

/* = (50/305.17)*2^31 = 0x14f8cf92 */

sgen.step_max=0x3E7FB26;/* Max Freq= (step_max * sampling freq)/2^32 */

/* =(0x3E7FB26*20k)/2^32 = 305.17 */

sgen.phase=0x80000000;  /* Phase=(required Phase)/180 in Q31 format  */    

/*      =  (+90/180) in Q31 = 8000h

最后一句解释说在Q31格式下 (+90/180) in Q31 = 8000h

且不说是8000h还是80000000h,如果定标Q31的话,我觉得+90/180=+0.5,应该是40000000h才对啊,为什么是8000h呢