Is it possible to vary the third parameter of HWPWM to produce a varying DC
output? I have tried HWPWM(1, 50, u) where u is my input variable but this does
not work.I know I could make 51 subroutines for the 51 values but there must be
a faster way.
varying HWPWM parameters
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: varying HWPWM parameters
Any of those parameters can be variables, HWPWM is just another BASIC
subroutine, source is in /program files/coridium/basiclib/HWPWM.bas
50 is a pretty small number (50 microseconds) for your cycle time, how are you
measuring the pulse? (if its a meter it won't see it).
subroutine, source is in /program files/coridium/basiclib/HWPWM.bas
50 is a pretty small number (50 microseconds) for your cycle time, how are you
measuring the pulse? (if its a meter it won't see it).
-
YahooArchive
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: varying HWPWM parameters
Thanks for your help. I connected IO(0) to AD(5) via a 10K resistor with 0.02uF
across the AD(5) input and then do 30 stepped outputs incrementing the pw
parameter by 2 waiting 1mS and then reading the analog input voltage. I went to
60uS cycle time and it works pretty well. My problem was I was reading the
voltage without waiting and I was getting zeros for analog voltage. Works fine
now and takes about 1mS per reading.
across the AD(5) input and then do 30 stepped outputs incrementing the pw
parameter by 2 waiting 1mS and then reading the analog input voltage. I went to
60uS cycle time and it works pretty well. My problem was I was reading the
voltage without waiting and I was getting zeros for analog voltage. Works fine
now and takes about 1mS per reading.