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.

Variable PWM with NHET



Hi 

So i want a PWM on NHET[0] and have created the required code using the tutorials and HET IDE but this is a very static way.

L00 CNT {reg=A, max=566665, data=0}
L01 ECMP {next=L00,hr_lr=HIGH,en_pin_action=ON,pin=0,action=PULSEHI,reg=A,data=0,hr_data=0}

What i want though is to have the main cpu application occasionally change the duty cycle. I gather i have to use the HTU to load in the required values which is fine, But what i cant figure out is how i use the transferred value in the list HET code. 

Im sure this is a common task so im sure this can be easily answered. 

Thanks

James

 

  • James,

    The linked forum result might help you.  http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/132571.aspx

    A couple of general comments about your question...

    1.)  You'll probably want to toggle the pin with a magnitude compare (MCMP) rather than ECMP. The reason is that ECMP only toggles on an equality while MCMP can trigger of a equal or {larger, smaller} condition. This adds robustness to your code and prevents a totally wrong cycle.

    2.) The MOV32 instruction can update the data field of a remote instruction. This instruction will allow you to update the EMCP/MCMP value.  Notice that the MCMP has a conditional address parameter so that after the MCMP is true, the instruction flow can flow in a different path (so that you execute the MOV istruction and update the field at this time).

     

    Best Regards,

    Forum Support