Loading...
Pages: [1]   Go Down
Author Topic: fastest pulse?  (Read 479 times)
0 Members and 1 Guest are viewing this topic.
Buena Vista, CO
Offline Offline
Full Member
***
Karma: 0
Posts: 157
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need to produce 2 separate pulses, simultaneously, both pulses variable in both rep rate and pulse width. max frequency is about 1000 Hertz. Pulse width should be from 5% to 100%. What is the minimum time between 2 digital writes? I know I can time with milli's, but I am not sure what the timing is on writes themselves. I can't use PWM as rep rate never changes. I also unsure how I handle keeping width a constant % as rep rate changes. Is this possible with an Uno?

Jim
Logged

8000ft above the average

Buena Vista, CO
Offline Offline
Full Member
***
Karma: 0
Posts: 157
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Would this be better done with a 556?

Jim
Logged

8000ft above the average

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 249
Posts: 16571
Available for Design & Build services
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1000 Hz has a period of 1mS, 1000uS.
Make yourself a blink without delay sketch, every 50uS check the state of your width and on/offtime, do your digitallwrites as needed.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17

Netherlands
Offline Offline
Tesla Member
***
Karma: 90
Posts: 9429
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
... do your digitallwrites as needed
Agree with CrossRoads,

Quote
I know I can time with milli's,
Use micros() instead  => a 1000 Hz signal needs 2000 switches

optionally use direct port manipulation  - http://www.arduino.cc/en/Reference/PortManipulation - to optimize accuracy.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 277
Posts: 25566
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I can't use PWM as rep rate never changes.
Yes you can change the rate of PWM.
Just google:-
arduino pwm frequency change
Logged

Pages: [1]   Go Up
Print
 
Jump to: