From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.



在LabVIEW FPGA 8.5.x中的整數(Integer Based)IP使用定點(Fixed-Point)資料型態



主要軟體:
主要軟體版本: 2.4
主要軟體修正版本:
次要軟體: N/A

問題: 我該如何在LabVIEW FPGA中只支援Math and Analysis的函數使用定點數資料?

解答:

在LabVIEW 8.5.x中,LabVIEW FPGA的Math and Analysis函數只支援整數資料型態。假如直接將定點數傳入該函數,小數部份會被截去使得該值轉變為整數。

為了在整數IP中使用定點數,您必須透過將定點數的長度增加到該整數的大小以達成符號延長(sign extend)。接下來的步驟詳細介紹了將定點數資料以整數型態傳入DC and RMS Measurements Express VI(使用I16資料型態)。注意,為了確保Number to Boolean Array使用固定維度的陣列,您必須設定VI Properties,選擇Execution並勾選陣列與字串的Autopreallocate。

定點數轉換整數

  1. To Fixed-Point函數會將定點數資料符號延長至整數的寬度。
  2. 使用Number to Boolean Array VI,將定點數轉換為布林陣列,以移除定點數的基數(radix)。
  3. 使用Boolean Array to Number VI,將這個布林陣列轉換為整數。

整數轉換定點數

  1. 使用Number to Boolean Array VI,將整數值轉換為布林陣列。
  2. 在Boolean Array to Number VI上按右鍵並選擇Properties。將representation改變為定點數,並且根據FPGA的定點數資料型態填入Fixed-Point Configuration。

下方附件為使用PID, DC/RMS,以及sinwave產生的範例程式。



相關連結:

附加檔案:
FXP to Legacy IP_85.zip




報告日期: 03/17/2008
最後更新: 04/07/2009
文件偏號: 4JGA2HLX