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.
Hi Matteo,
Check the following instructions. The first one is a normal instruction(also this will be the smallest duty possible using a normal instruction).The second instruction is an HR instruction with higher resolution(around half).
L01 MCMP { next=L02,hr_lr=LOW,en_pin_action=ON,pin=1,order=REG_GE_DATA,action=PULSEHI,reg=A,data=1};
L01 MCMP { next=L02,hr_lr=HIGH,en_pin_action=ON,pin=1,order=REG_GE_DATA,action=PULSEHI,reg=A,data=0,hr_data=0x40};
Just replace the L01 instruction in your program with the HR instruction above and see if your requirement is met. Please check the TRM for more info on HR instruction.
Thanks and Regards,
Vineeth
Hi Matteo,
Any update on this? Were you able to try the suggestions?
Thanks and Regards,
Vineeth
PS: Please expect delays in forum responses due to the holiday season.
Hi,
thank you both for the suggestions.I've seen the post just now because of the split.
I'm going to test it today and send you a reply asap.
Matteo
BTW: I need to replace only the L01 intruction or all the 4 MCMP lines?
Just try it for L01 to see if it works. Then you can replace the others.
Thanks and Regards,
Vineeth
Hi Matteo,
If I understand correctly the hr_lr=HIGH the hr_data can be set to add a "fractional" delay added to the loop resolution.
Yes. Your understanding is right. It adds a controlled delay to the output which is a fraction of the LRP.
Which is the range of hr_data?
The HR_data length depends on the LRP value(the range is 0-7 bits). The higher the LRP value the higher the HR resolution possible. You can refer to the TRM to understand this better(N2HET Module > Time Base > The 7-Bit HR Data Field). Here is a table from this section of the TRM.
Note that the HR data field ignores the LSB as the length decreases. For example, when you assign hr_data=2, 1 will be written to D[1] and 0 to D[0]. But these bits will be ignored if ‘lr’ is less than 64. This means HR data field will be read as zero if ‘lr’ is less than 64. If ‘lr’ is equal to 64, it will be read as 1. If ‘lr’ is 128, then it will be correctly read as 2. Take this into consideration when you assign hr_data.
Thanks and Regards,
Vineeth
which instruction can I use to modify the hr_data?
You can use the same instruction as below.
hetRAM2->Instruction[pwm + 1U].Data = ((data<<7) | hr_data);
Thanks and Regards,
Vineeth