




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、Lesson 5Timing an FPGA VITiming Express VIsImplementing Loop Execution RatesCreating Delays Between EventsMeasuring Time Between EventsBenchmarking Loop PeriodsA. Timing Express VIsLoop Timer Express VIImplementing Loop RatesWait Express VICreating Delays Between EventsTick Count Express VIBenchmark
2、ingB. Implementing Loop Execution RatesUse the Loop Timer Express VIWaits the value you specify in Count between loop iterationsControls the period of a loopPlace the Loop Timer Express VI inside a loopPerform I/O operations at a specific frequencyControl loop execution rateConfigure Loop TimerCount
3、er UnitsTicks clock cyclesSec microsecondsmSec millisecondsSize of Internal Counter32 Bit16 Bit8 BitSize of Internal Counter determines the maximum time a timer can track.To save space on the FPGA, use the smallest Size of Internal Counter possible.Loop Timer Express VI FunctionalityFirst iterationR
4、ecords current time as initial timeImmediately executes the code in the next frame without any delaySecond iterationAdds Count to initial time and waits until Count has elapsed from the initial recorded timeExecutes the code in the next frame after Count has elapsedSubsequent iterationsLoop Timer co
5、ntinues to increment the time record it initiated upon the first callDoes not reset each timeLoop Timer Express VI CaveatIf an execution instance is missed, such as when the logic in the loop takes longer to execute than the specified Count:Loop Timer returns immediately and establishes a new refere
6、nce time stamp for subsequent callsNo delayImplementing Loop Execution RatesWatch out for rolloverSize of Internal Counter determines the maximum time the timer can trackSize of Internal CounterTickssms32-bit1 to 4,294,967,296 ticks1 s to 71 minutes1 ms to 49 days16-bit1 to 65,536 ticks1 s to 65 ms1
7、 ms to 65 seconds8-bit1 to 256 ticks1 s to 256 us1 ms to 256 msTick PeriodTick period is based on the frequency of the FPGA clockIf using a 40MHz FPGA clock, the tick period is 25nsMust use ticks for nanosecond timingSize of Internal CounterTickssms32-bit1 to 4,294,967,296 ticks1 s to 71 minutes1 ms
8、 to 49 days16-bit1 to 65,536 ticks1 s to 65 ms1 ms to 65 seconds8-bit1 to 256 ticks1 s to 256 us1 ms to 256 mscRIO Module Loop Execution RatesSome cRIO modules have configurable timingDo not need to use Loop Timer Express VI to time loop rateExampleNI 9233You can configure the data rate at which the
9、 NI 9233 module acquires and returns dataStatic/Programmatic ConfigurationC-Series Module Properties dialog boxFPGA I/O Property NodeStatic Configuration of NI 9233 Data RateProgrammatic Configuration of NI 9233 Data RatecRIO Module Loop Execution RatesLoop Timer Express VI is not neededWhile Loop r
10、ate is determined by NI 9233 data rateIf other code in the loop executes at a slower rate, the loop rate will be limited by the other codeLoop Conditional TerminalFalse constant is acceptableFPGA logic is often meant to run indefinitely on the FPGAControls and application logic is still acceptableWh
11、ile Loop Iteration Terminal MaximumThe iteration terminal count will keep outputting 2,147,483,647 once it reaches this valueIf you need a counter to rollover when it reaches its maximum value, you should implement your own counterExercise 5-1: While Loop TimingUse the Loop Timer Express VI to time
12、a While Loop running on an FPGA VI.Exercise 5-1: While Loop Timing If the code in the second frame of the Sequence structure takes longer to execute than the value of AI Sample Time control, how long would each iteration of the While loop take?C. Creating Delays Between EventsUse Wait Express VI to
13、create a delay between eventsExamplesCreate delay between a trigger and subsequent outputCreate a series of delaysWait Express VI ConfigurationCounter UnitsSize of Internal CounterDetermines maximum possible wait timeComparing Loop Timer and Wait VIsCode structure is the sameLoop Timer does not wait
14、 the first time it is calledWait Express VI waits every iteration of the While LoopD. Measuring Time Between EventsTick Count Express VIReturns the value of a free-running FPGA counter in the units specifiedUse Tick Count Express VI to measure time between eventsExamplesMeasure the time between edge
15、s on a digital signalDetermine the execution time of a section of codeMeasuring Time Between EventsCalculate the difference between the results of two Tick Count Express VIs to determine the execution timeSubtract one from the result of the calculation to compensate for the execution time of the Tic
16、k Count Express VIE. Benchmarking Loop PeriodsUse Tick Count Express VI to measure loop periodsCalculate the time differenceRemove the benchmarking code laterBenchmarking code executes in parallelDoes not add additional time to the loop periodTick Count RolloverWatch out for rolloverIf the code you
17、are benchmarking takes more than the maximum value Tick Count can handle, the elapsed time will be much lower than expected due to rolloverSize of Internal CounterTickssms32-bit1 to 4,294,967,296 ticks1 s to 71 minutes1 ms to 49 days16-bit1 to 65,536 ticks1 s to 65 ms1 ms to 65 seconds8-bit1 to 256
18、ticks1 s to 256 us1 ms to 256 msExercise 5-2: While Loop BenchmarkingBenchmark the loop period of a While Loop containing code.Exercise 5-2: While Loop Benchmarking If you configured the Tick Count Express VI to use Counter Units of s or ms instead of Ticks, would the benchmarking results in this ex
19、ercise still be reasonable? If the code you want to benchmark executes within nanoseconds, what Counter Unit should you use?SummaryMatching QuizLoop Timer Express VIWait Express VITick Count Express VIUse to create delays between eventsUse to benchmark execution speedsUse to control loop execution r
20、ateSummaryMatching Quiz AnswersLoop Timer Express VIWait Express VITick Count Express VIUse to create delays between eventsUse to benchmark execution speedsUse to control loop execution rateSummaryQuizWhat is a potential drawback of using an 8-bit counter instead of a 32-bit counter?Decreased FPGA resources used32-bit clocks are slowerMaximum time the timer can track is not large enough for the applicationSummaryQuiz AnswerWhat is a potential drawback of using an 8-bit counter instead of a 32-bit counter?Decrea
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 上海市裝修設(shè)計合同范本
- 單片機(jī)原理與應(yīng)用試題含參考答案
- 買賣樓合同范本
- 三年級第二學(xué)期語文教學(xué)計劃
- 發(fā)票購銷合同范本
- 工業(yè)鍋爐司爐考試模擬題(附答案)
- 專利質(zhì)押服務(wù)合同范本
- 農(nóng)莊解除合同范本
- 印刷定采購合同范本
- 衛(wèi)浴銷售協(xié)議合同范例
- 2024并網(wǎng)光伏逆變器技術(shù)規(guī)范
- 文言文多文本閱讀:叔向見韓宣子(附答案解析與譯文)
- 工程招投標(biāo)模擬實訓(xùn)報告范文2024年
- 系統(tǒng)脫敏治療的長期療效跟蹤評估
- DB13(J)T 8406-2021 裝配式混凝土結(jié)構(gòu)工程施工與質(zhì)量驗收規(guī)程(京津冀)
- 浙江省臺州市2024年中考語文模擬試題及答案6
- 離婚被告辯護(hù)詞格式范文
- 2024數(shù)字化風(fēng)電場智慧運(yùn)營
- 機(jī)電一體化綜合應(yīng)用教程 課件 項目二 加蓋擰蓋單元的安裝與調(diào)試
- 大學(xué)生創(chuàng)新創(chuàng)業(yè)基礎(chǔ)教程(高校創(chuàng)新創(chuàng)業(yè)教育課程)全套教學(xué)課件
- 2024年江蘇農(nóng)林職業(yè)技術(shù)學(xué)院單招職業(yè)適應(yīng)性測試題庫完美版
評論
0/150
提交評論