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.

TMDSRM48HDK: N2HET: Dynamically change period of generated PWM signal

Hi Sunil,

Thanks for all the help. I have one more question. I want to dynamically change the period of the generated PWM signal. I know that MOV64 is the instruction to be used for the same. But I am not able to understand how it works and I tried the algorithm available on the HET IDE but I am not able to figure out how it works. Can you guide me on the same?

Regards,

Smruthi Ramesh

  • Hi Smruthi,

    There are many different ways to do this, including the use of a MOV64 instruction. Consider the following HET program as an example. I am using the RADM64 (Register Add and Move) instruction:

    PA  .equ  0   
    
    L00  CNT    { next=L01, reg=A, irq=OFF, max= 1ffffffh }
    
    L01  ECMP   { next=L00, cond_addr=L02, hr_lr=low, en_pin_action=ON, pin= PA, 
                  action= SET, reg=A, irq=Off, data = 4, hr_data = 00h }
    
    L02  RADM64 { next =L00, remote =L01, en_pin_action =ON, cond_addr = L03, 
                  pin = PA, comp_mode=ECMP, action= CLEAR, reg = A, irq = OFF, 
                  data = 2, hr_data = 00h }
    
    L03  RADM64 { next =L00, remote =L01, en_pin_action =ON, cond_addr = L02, 
                  pin = PA, comp_mode=ECMP, action= SET,   reg = A, irq = OFF, 
                  data = 2, hr_data = 00h }
    

    RADM64 works to overwrite the control and data fields of the specified "remote" instruction. The two RADM64 instructions in this program are used to alternately define the SET and CLEAR compare values for the counter. This can be used to modulate the PWM frequency as you desire by updating the data field of the RADM64 instructions.

    You can simulate this program in the HET IDE to see the operation.

    Regards,

    Sunil

  • Okay Thank you very much!