Shortest ON time for an I/O pin?
Hagen
Posts: 5
I'm having a hard time finding out the shortest "ON" time for an I/O·pin on the propeller chip.
I want to be able to do PWM, with a very short "ON" time and a much longer "OFF" time.
Any help would be appreciated.
Thank you,
I want to be able to do PWM, with a very short "ON" time and a much longer "OFF" time.
Any help would be appreciated.
Thank you,
Comments
PWM means that the digital value of the PWM - let's say it's 16 bit - is proportional to the voltage that you see on the output. So, value 0 for example means 0V, value 65535 means 3,3V, 32767 means 1,65V. When you say you want to have a very short ON versus a much longer OFF time, this means that your resolution will be much smaller. Instead you could directly decrease the voltage and keep the resolution of 16 bit.
Again, how about providing more details about what you're trying to accomplish.
Have you looked at the PWM object in the Propeller Object Exchange?
I am trying to determine which Parallax chip will work best for me. The BS2px chip has a min on time of 0.81 micro seconds. I need to be in the range of 0.5 or less micro seconds, with a long programmable OFF time. I need to pulse multiple output pins and have accurate programmable phase relationship between the pins. I will be driving multiple inductors using MOSFETS. Sounds simple enough [noparse]:)[/noparse] I will look for the PWM object in the Propeller Object Exchange.
Thanks for your help!
Here is some code you can run from my soon to come out "book for beginners"
This is so fast that if you make phsa much less than 100 you cant see it. Can be 1
The wavelength can be as long as you want so it pretty flexible as a short PWM signal
I'm running at 10 MHz by you can go to 80.
Look at pin 2 with a scope, the signal is pretty weak.
Play with it.
CON
_CLKMODE=XTAL1+ PLL2X 'The system clock spec
_XINFREQ = 5_000_000 'crystal frequency
VAR
byte pin
PUB Demo|WaveLength,period 'subroutine to toggle the output line 2
pin:=2
dira~~ 'gain access to line
ctra[noparse][[/noparse]30..26]:=%00100 'Set this cog's "A Counter" to run PWM
ctra[noparse][[/noparse]5..0]:=pin 'Set the "A pin" of this cog to Pin=2
frqa:=1 'Set this counter's frqa value to 1
WaveLength:=clkfreq/100 'Set the time for the wave Length to 10 ms
period:=cnt 'Store the current value of the counter
repeat 'power PWM routine.
phsa:=-100 'Send a high pulse for 100 counts
period:=period+WaveLength 'Calculate wave length
waitcnt(period) 'Wait for end of wavelength
Regards
Harprit
Forget about the inductors for the moment, it's driving the MOSFETs that has me worried, you have a license do you? You have driven one of these things before at high speed?
Driving a MOSFET as a switch at high frequency requires drivers capable of rapidly charging and discharging the large gate capacitance. Failure to do so will mean the MOSFET will not turn on/off properly or spend too much time in it's linear region which also incurs the penalty of increased power dissipation. The figure of 0.5us is ambitious enough for a newbie but saying "or less" means you need to research this a little more.
What is your application, does it need such a high frequency? The 12.5ns pulses from the Prop's counters will be too short as would the 50ns bit-banged version. Have you tried a SPICE simulation yet?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
I'm not familiar with the spice simulation, I'll look that up.
My target "ON" time is 0.5 microseconds, anything more than that is gravy.
I understand that I will need to use a driver chip for the power MOSFET.
Thanks Mike Green, I think I found a few programs that will help me very much in the Propeller Object Exchange.
Tim
Also remember that you can do the same sort of thing in Spin at assembly speeds by using the cog counters.
Its hard to understand assembly code if you are not proficient so SPIN is a better format for examples
HSS