--- tags: TI instaspin --- # TI IQmath LIB介紹 By using the IQmath and Qmath libraries, it is possible to achieve execution speeds considerably faster and energy consumption considerably lower than equivalent code written using floating-point math. ![](https://t42073237.p.clickup-attachments.com/t42073237/ecad7b4a-953e-4e4a-8525-75d6e2543004/image.png) ![](https://t42073237.p.clickup-attachments.com/t42073237/3490c31c-ec64-48bf-ab72-1c8a6b643962/image.png) >[TI IQ lib](https://www.ti.com/tool/MSP-IQMATHLIB#description) 長條圖➝CYCLES 折線圖➝Accuracy 在使用IQLIB\_32bits(藍綠色)的情況下,精確度較float高且運算效能也強,但會限制小數可表示的範圍。 ![](https://t42073237.p.clickup-attachments.com/t42073237/72973945-5416-4748-b801-f12691313cfe/image.png) >from [MSP430-IQmathLib-UsersGuide.pdf](https://t42073237.p.clickup-attachments.com/t42073237/e6e1b850-6049-4bb3-ac61-b05d286f3750/MSP430-IQmathLib-UsersGuide.pdf) 使用方式如下 方法一 可使各個模組依據情況選擇不同的IQ value 方法二 整個專案都使用相同的IQ value ![](https://t42073237.p.clickup-attachments.com/t42073237/d3a9e43a-5bf5-4968-945a-d306c4c4c6ed/image.png) >from [MSP430-IQmathLib-UsersGuide.pdf](https://t42073237.p.clickup-attachments.com/t42073237/e6e1b850-6049-4bb3-ac61-b05d286f3750/MSP430-IQmathLib-UsersGuide.pdf) 當各個運算模組選用不同的IQ value就會遇到需要相互轉換的情況,轉換方法如下。 ![](https://t42073237.p.clickup-attachments.com/t42073237/05c41a24-5cd5-4264-962c-14d5271bd862/image.png)![](https://t42073237.p.clickup-attachments.com/t42073237/f0332d6d-c046-42af-9ca3-d763e1c9b831/image.png) >from [MSP430-IQmathLib-UsersGuide.pdf](https://t42073237.p.clickup-attachments.com/t42073237/e6e1b850-6049-4bb3-ac61-b05d286f3750/MSP430-IQmathLib-UsersGuide.pdf) 結論 當我們可以確定每個方塊輸入與輸出的數值範圍後,透過TI所提供的IQLIB,我們可以挑選合適的IQ值,對程式碼進行精確度和速度的優化,甚至在整個專案中使用多種不同的IQ值,更進一步優化程式。 ## CCS SCOPE操作 在想要觀測的資料點選右鍵Graph ![](https://i.imgur.com/98ObHb0.png) 設定scope ![](https://i.imgur.com/9xcltuK.png) 根據該資料所設定之格式輸入相對應的Q_value 依照資料特性設定所想要的Sampling Rate ![](https://i.imgur.com/ptrxTED.png) Enable Continuous Refresh ![](https://i.imgur.com/vl5mNny.png)