341Views7Replies

Author Options:

how to generate signals arduino? Answered

  uhi i want to generate 3 equal variable pulse high with constant pulse low signal that vary with potentiometer and asume it repeat it self every  10us and pulse min is constant 2u and pulse high vary betwwen 5-8u and i want it to carried at specific frequency? i attach the signal i want to generatel 

Tags:signals

Discussions

0
None
steveastrouk

Best Answer 4 years ago

The arduino PWM clock can be varied.
Download the l;ibrary "timer3.zip" from here
http://playground.arduino.cc/code/timer1
In the timer3 code you will find a new option

pwm(pin, duty, period)
Generates a PWM waveform on the specified pin. Output pins for Timer1 are PORTB pins 1 and 2, so you have to choose between these two, anything else is ignored. On Arduino, these are digital pins 9 and 10, so those aliases also work. Output pins for Timer3 are from PORTE and correspond to 2,3 & 5 on the Arduino Mega. The duty cycle is specified as a 10 bit value, so anything between 0 and 1023. Note that you can optionally set the period with this function if you include a value in microseconds as the last parameter when you call it.

This should give you the control you need.

0
None
britich

4 years ago

thanks

0
None
framistan

4 years ago

I had some experience making an arduino put out a 512 hertz signal. We discovered that the ACTUAL frequency coming out could be PLUS or MINUS about ten hertz from chip to chip. So, I don't think you can depend on extreme accuracy unless you are making a "ONE-OFF" and can fine-tune it. Also, we discovered just SOLDERING the pins could alter the output frequency if you got the pin too hot for too long.

0
None
steveastroukframistan

Answer 4 years ago

All depends on the clock source. If you use the on-chip RC oscillator, you will get the behaviour you observe.

Use a resonator and it will be better, use a crystal and you'll be in the 20PPM level.

0
None
britich

4 years ago

variable frequency and variable dutycycle(high time increase )

0
None
britichbritich

Answer 4 years ago

this is output on throttle stick directly

0
None
steveastrouk

4 years ago

Variable frequency, fixed duty cycle, fixed amplitude ?