-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable PWM #19
Variable PWM #19
Conversation
Here are the build results |
decode_pwm_h_2: | ||
;IF PWM_BITS_H == 2 ; Initialize pwm dithering bit patterns | ||
cjne A, #2, decode_pwm_h_1 | ||
mov Pwm_H_Mask, #03h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here Pwm_H_Mask should be 4. Please, check line 1028
;ELSEIF PWM_BITS_H == 1 | ||
decode_pwm_h_1: | ||
cjne A, #1, decode_pwm_h_0 | ||
mov Pwm_H_Mask, #01h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here Pwm_H_Mask should be 2. Please, check line 1028
;ELSEIF PWM_BITS_H == 0 | ||
decode_pwm_h_0: | ||
cjne A, #0, decode_pwm_h_done | ||
mov Pwm_H_Mask, #00h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here Pwm_H_Mask should be 1. Please, check line 1028
cjne A, #96, ($+5) | ||
mov Temp2, #2 ; 96 kHz | ||
|
||
; TODO: Simplify? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain it is applying the formula:
PWM_BITS_H EQU (2 + MCU_48MHZ - PWM_CENTERED - PWM_FREQ)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This I can actually explain: It basically calculates the amount of H bits which then decides the PWM mode. On BB2 this will result in a value of 1-3 and BB1 0-2. Minimum PWM mode is 8 - depending on the caluclated value it will be mode 8-10 on BB1 or 9-11 on BB2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't explain me correctly. I meant to add a comment in code to explain what it does, instead of the TODO
mov Flag_Dithering, C ; Set dithering enabled | ||
|
||
mov A, Pwm_Bits_H | ||
cjne A, #3, decode_pwm_h_2 | ||
; Currently 11-bit pwm is only used on targets with built-in dead time insertion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here Pwm_H_Mask value should be initialized to a correct value, because it is used above
Hey @damosvil - this is just a broken out PR from Mathias, so there is no one to explain anything ;-) The main things I want to know is:
|
Closing this in favor of #65 |
Split the "variable PWM" changes from the more "general" branch.