hi, First i'd like to say i'm new to Arduino and micro controllers. I'd like to know if its possible to pulse channels sequentially with digital write? I would like full control over duty cycle and frequency. I played around with the fade sketch but the frequency is not high enough in that mode. I'm looking to pulse 3 channels sequentially, from 10-50khz and i will be using these pulses to drive mosfets, through a mosfet driver of course. Any help would great. I've tried searching around for this info but can't find the info i'm looking for. By the way the board I have right now is the Uno.
Granularity? Accuracy? How tolerant of glitches is your application?
I'm looking to create as sharp a pulse as possible. Fast on, fast off. Duty cycle as low as possible.
A tight loop toggling a single pin using direct port manipulation can get about 500kHz IIRC.
So you have 10:1 theoretical advantage but if you need to do three pins + clever control stuff as well it might be a struggle.
I'm looking to create as sharp a pulse as possible
Not exactly an engineering term, but the rise and fall times of a digital pin will I'm sure be fast enough.
You still need to answer Coding Badly's questions. For example if 1:256 is good enough granularity for the duty cycle some form of table lookup may be the way to go.
Duty cycle as low as possible.
Does this mean that the duty cycle is not variable, just a constant-width pulse?
You can get about 100kHz with digitalWrite() (or could, at one point. Core code is subject to change.) There is extensive discussion about how fast, why, and alternatives in this old thread: http://arduino.cc/forum/index.php/topic,4324.0.html
You should easily be able to get pulses under one microsecond wide using direct port manipulation.