I want to create a double pulse with initial delay of 50us. First pulse should be of 1.2 micro seconds and then off for 0.7 microseconds and then the second pulse for 0.6 microseconds then forever off.
Please tell how to generate it with these decimal microseconds time periods.
I ask because you can use direct port manipulation to get close to the times you specify, but if you are using an Arduino with a 16MHz clock frequency then all delays will be a multiple of 1/16µs or 62.5ns.
For your 1.2µs delay you could have 1.1875µs (19 clock cycles) or 1.250µs (20 clock cycles).
For your 0.7µs you would get 0.6875µs (11 clock cycles) and for your 0.6µs you would get 0.625µs (10 clock cycles).
Are these times close enough for you?
Also what is used to start the initial delay?, and are the two pulses both on the same pin, or two different pins?
For your 1.2µs delay you could have 1.1875µs (19 clock cycles) or 1.250µs (20 clock cycles).
For your 0.7µs you would get 0.6875µs (11 clock cycles) and for your 0.6µs you would get 0.625µs (10 clock cycles). -- This much accuracy is fine for me. Thanks! What would be rise and fall times of the pulses?
Two pulses on the same pin like a PWM. Initial delay is the Power-up Delay Time for the Gate Driver IC. This double pulse will go to the Gate Driver IC.
// Raspberry Pi pico pulse generator
// First pulse should be of 1.2 micro seconds and then off for 0.7 microseconds and then the second pulse for 0.6 microseconds
void setup() {
gpio_init(5);
gpio_set_dir(5, GPIO_OUT);
while (1) {
nSdelay(20);
pulse(18);
nSdelay(6);
pulse(7);
}
}
inline void pulse(byte delay) {
gpio_put(5, 1);
volatile byte i = delay;
while (i--) ;
gpio_put(5, 0);
}
inline void nSdelay(byte delay) {
volatile byte i = delay;
while (i--) ;
}
void loop() {}
For that specific question, I'll refer you to the datasheet for the processor. I can't point you at one, because you didn't tell us which Arduino you're using, so look it up yourself.
After all, they're simply digital pins - set one as output, and see the specs for the details! Unless you capacitively load the signal too much, what you'll see is amply described in the datasheet.
Can we have a calculation before hand from our load and the datasheet of the Arduino Uno R3? If yes, how? I did not find anything relevant from the datasheet about pulse rise and fall times. @camsysca@JohnLincoln
There is very little of relevance to your question in Datasheet
I agree. However, not quite nothing.
If you search the doc for "rise"(13 hits), you'll find two items of note, the risetimes for I2C(irrelevant) and a risetime for SPI when master. Now I would infer that that is a specification for both clock, and MOSI signals. As far as I know, when used for SPI, there's nothing special about these pins, so I would infer that their characteristics might be applicable in the more general case. But there's no direct mention of the loading of that signal relative to that rise time.
There might be more of a hint in the "fall" search, specifically table 28.7, but I'm not sure what that capacitance calculation really suggests. Perhaps someone who knows more in this subject area is listening, though it seems unlikely.
After a really thorough dig through their website for other possibly applicable specifications, if I were really desperate to know more about this topic, approaching Microchip directly with the question would be reasonable. However, they will presumably want to know why you're asking.
Good luck!
Adding those Serial.println() statements plays havoc with the timings.
The 50µs delay has increased to 167µs.
The 1.2µs pulse width has increased to 35µs.
The 0.7µs delay has increased to 35µs.
The 0.6µs pulse width has increased to 42µs.