Pages: [1]   Go Down
Author Topic: Mega 2560 pulse timing sequence  (Read 118 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I'm trying to generate 2 pulses which are to be controlled by a counter.  I would like the first pulse (low for 25ms, high for 25ms, and low for the rest of the cycle) and second pulse (low for 50ms, high for 25ms, and low for rest of cycle) to be activated by the counter which will have a cycle of every 8 seconds, or every 16 seconds.  Each pulse will have its own I/O(I'm using each pulse to trigger different circuits).  I also need one of the pulses  output to be 10V. 

I have the following questions:

To generate each pulse, would building an array for each square pulse be the best method?
To output 10V, what kind of additional circuitry is suggested?
How can I configure a counter to activate every 8 seconds?

Thanks in advance.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46204
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I also need one of the pulses  output to be 10V. 
The Arduino can't do that. At best it can turn a transistor on or off, where that transistor controls a 10V source.

Quote
to be activated by the counter which will have a cycle of every 8 seconds
This makes no sense to me. Something might be generating an interrupt every 8 seconds, and you might be counting those interrupts, but nothing magically counts something every 8 seconds.

Quote
To generate each pulse, would building an array for each square pulse be the best method?
No. Turning two pins on and off at defined intervals after an event requires nothing more complicated than a state machine (waiting to start, waiting to turn first pin on, waiting to turn 1st pin off and second pin on, etc.) and the use of millis() to determine when it is time to change to the next state. When it is, perform some actions and set the time the last state change happened. On each pass through loop(), see if it's time to transition to the next state.

Quote
How can I configure a counter to activate every 8 seconds?
Counters count. They don't "activate". You need some kind of timer-based interrupt. Hit google.
Logged

Pages: [1]   Go Up
Jump to: