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.

Pulse measurement using NHET

Hi ,

I need to measure the frequecy of the square wave signal (10 to 15khz) connected to one of the NHET pins. I know that i need to use the PCNT instruction to measure this frequecy. I have few doubts in understanding of working of PCNT instruction. Can any explain clearly working of this instruction.

It would be great helpful, if someone expalins me how to calcualte the frequecy from the PCNT instruction data. Explain me in detail how to choose the hr and lr for my requirement (factors to be considered. My VCLK2 is 16mhz.

 

  • Hi

    LR - Loop time ~ It is configured depending on the number of instructions/longest path you use. ( Look at the table of instructions for more info on the cycle each instruction take).  
    HR - Smallest time increment with which a pin can be measured for input.

    In the TRM under I/O control you can find the PCNT execution example.

    I advice you to use HET IDE (Similator) before actually programming to reduce development time.

    Best Regards
    Prathap

  • Thanks prathap.

    I have read the TRM manual. After reading the Pulse Measurement Example, below are my queries ?

    1. The instrution is having 32 bit Data filed contains the number of counts LRP cycle and HRP cycles. But what are PCNT CF, HR capt reg, ? (mentioned in the figure 18-21)

    2. What is input pin siganl and input pin syced ?

    3. What is accuracy ( +/- ) the NHET module in calculation of frequecy ?

  • Hi Bindu,

     

    1. The instrution is having 32 bit Data filed contains the number of counts LRP cycle and HRP cycles. But what are PCNT CF, HR capt reg, ? (mentioned in the figure 18-21)

    Prathap --> PCNT CF is PCNT instructions Control Field which containes the Period Count. HR Capt Reg = HR Data field in the PCNT Data Field which captures the HR count data.  

    2. What is input pin siganl and input pin syced ?

    Prathap --> The input signal is synced to the internal clock before measurement at the configured granularity ( LR and HR clock).

    3. What is accuracy ( +/- ) the NHET module in calculation of frequecy ?

    Prathap --> It depends multiple factors like ( Please refer section "Edge Detection Input Timing" for more info)
                       a) Clock frequency HR frequecy which is drived from VCLK2.
                       b) Loop resolution period (LRP) which primarily depends on the total number of Instruction used per loop.
                       c) Type of Instruction used - High resolution or Low resolution Instruction

    Best Regards
    Prathap