Consider the following N2HET program.
PWM_PERIOD .equ 10 PWM_PIN_U .equ 0 PWM_PIN_U_BAR .equ 3 PWM_PIN_V .equ 1 PWM_PIN_V_BAR .equ 4 PWM_PIN_W .equ 2 PWM_PIN_W_BAR .equ 5 INIT_COMPARE .equ 5 INIT_HR_DELAY .equ 0 L00: CNT{next=L01, reqnum=0, request=GENREQ, reg=A, irq=OFF, max=PWM_PERIOD}; L01: ECMP{next=L03, hr_lr=HIGH, en_pin_action=ON, cond_addr=L02, pin=PWM_PIN_U, action=PULSELO, reg=A, irq=OFF, data=INIT_COMPARE, hr_data=INIT_HR_DELAY}; L02: MOV32{remote=L01,type=IMTOREG&REM,reg=NONE,data=INIT_COMPARE,hr_data=INIT_HR_DELAY}; L03: BR{next=L04, cond_addr=L04, event=Z, reqnum=1, request=GENREQ} L04: ECMP{next=L06, hr_lr=HIGH, en_pin_action=ON, cond_addr=L05, pin=PWM_PIN_V, action=PULSELO, reg=A, irq=OFF, data=INIT_COMPARE, hr_data=INIT_HR_DELAY}; L05: MOV32{remote=L04,type=IMTOREG&REM,reg=NONE,data=INIT_COMPARE,hr_data=INIT_HR_DELAY}; L06: BR{next=L07, cond_addr=L07, event=Z, reqnum=2, request=GENREQ} L07: ECMP{next=L09, hr_lr=HIGH, en_pin_action=ON, cond_addr=L08, pin=PWM_PIN_W, action=PULSELO, reg=A, irq=OFF, data=INIT_COMPARE, hr_data=INIT_HR_DELAY}; L08: MOV32{remote=L07,type=IMTOREG&REM,reg=NONE,data=INIT_COMPARE,hr_data=INIT_HR_DELAY}; L09: MOV32{remote=L02,type=REMTOREG,reg=B}; L10: ADM32{type=IM®TOREM, remote=L11, reg=B, data=10}; L11: ECMP{next=L12, hr_lr=HIGH, en_pin_action=ON, cond_addr=L12, pin=PWM_PIN_U_BAR, action=PULSEHI, reg=A, irq=OFF, data=INIT_COMPARE, hr_data=INIT_HR_DELAY}; L12: MOV32{remote=L05,type=REMTOREG,reg=B}; L13: ADM32{type=IM®TOREM, remote=L14, reg=B, data=10}; L14: ECMP{next=L15, hr_lr=HIGH, en_pin_action=ON, cond_addr=L15, pin=PWM_PIN_V_BAR, action=PULSEHI, reg=A, irq=OFF, data=INIT_COMPARE, hr_data=INIT_HR_DELAY}; L15: MOV32{remote=L08,type=REMTOREG,reg=B}; L16: ADM32{type=IM®TOREM, remote=L17, reg=B, data=10}; L17: ECMP{next=L18, hr_lr=HIGH, en_pin_action=ON, cond_addr=L18, pin=PWM_PIN_W_BAR, action=PULSEHI, reg=A, irq=OFF, data=INIT_COMPARE, hr_data=INIT_HR_DELAY}; L18: BR{next=L00, cond_addr=L00, event=NOCOND}
The rationale behind the program is to restrict the HTU channel usage to just three. the first part Generates the High side sinoside by getting the compare values from the HTU. the second part loads the compare value from the high side instructions, add a deadband time (10 cycles) and generate the Low side sinoside.
I am able to generate the sinosides perfectly, But the deadband does not work as intended. On the increasing values of the sinoside the dead band works fine, but on the decreasing values, it seems to subtract from the compare value, resulting in the pulse overlap instead of a deadband.