hi. i´m using picaxe since 2009 and this is my first time asking for help here in forum.
i´m doing a pwm generator project using a 20m2, two potenciometer a 4x16 oled a mosfet driver and a a mosfet,
the project consists in a adjustable period and duty generator.
the project already works and adjust the period and duty by using a switch witch select period/duty and
a potenciometer witch adjust the adc value to period and duty.
my problem is that i what to convert raw period value to frequency and the raw duty value to % so i can send to
the lcd and adjust Hz and % in real time instead of period and duty values.
the frequency must be between 1000Hz and 150000Hz
and the duty must be between 0 and 100%
a quick example of what i have...
hope you can understand my question, and help me solving this issue.
Thanks in advance
André Bodas[/code]
i´m doing a pwm generator project using a 20m2, two potenciometer a 4x16 oled a mosfet driver and a a mosfet,
the project consists in a adjustable period and duty generator.
the project already works and adjust the period and duty by using a switch witch select period/duty and
a potenciometer witch adjust the adc value to period and duty.
my problem is that i what to convert raw period value to frequency and the raw duty value to % so i can send to
the lcd and adjust Hz and % in real time instead of period and duty values.
the frequency must be between 1000Hz and 150000Hz
and the duty must be between 0 and 100%
a quick example of what i have...
Code:
readadc pot_period, w0
readadc pot_duty, w1
serout LCD, n2400_16 , (#w0, "period", #w1 "duty")
pwmout X, w0, w1
and this is what i want...
readadc pot_period, w0
readadc pot_duty, w1
W2=W0 ?????? This is the equation that i need
W3=W1 ??????
serout LCD, n2400_16 , (#w2, "Hz", #w3 "%")
pwmout X, w0, w1
Thanks in advance
André Bodas[/code]
Last edited: