instant help

//Timer1 Mode 10 PWM to ICR1
//Dual pin 200KHz PWM generator
//47.5% duty cycle 125ns dead band between pulses

void setup() {
pinMode(9, OUTPUT); //output A
pinMode(10, OUTPUT); //output B

TCCR1A = 0; //clear timer registers
TCCR1B = 0;
TCNT1 = 0;

//ICR1 and Prescaler sets frequency
//no prescaler .0625 us per count @ 16Mh
//80 counts x .0625 = 5 us = 200Khz

TCCR1B |= _BV(CS11); //no prescaler
ICR1 = 20000;//PWM mode counts up and back down for 80 counts

OCR1A = 10000; //Pin 9 match
//output A set rising/clear falling
//Rise at TCNT 21 upslope, High 38 counts, Fall at TCNT 21 downslope
//47,5% Duty Cycle Pulse centered on TCNT 40. High 38 Low 42
TCCR1A |= _BV(COM1A1) | _BV(COM1A0); //output A set rising/clear falling

OCR1B = 8000; //Pin 10 match
//output B clear rising/set falling
//Fall at TCNT 19 upslope, Low 42, Rise at TCNT 19 downslope
//47.5% Duty Cycle Pulse centered on TCNT 0. High 38 Low 42
TCCR1A |= _BV(COM1B1); //output B clear rising/set falling

TCCR1B |= _BV(WGM13); //PWM mode with ICR1 Mode 10
TCCR1A |= _BV(WGM11); //WGM13:WGM10 set 1010

}

void loop() {}

i am using this program to achieve two pwm signals can i get both signals at 25% duty cycles and 25hz frequency with desired phase shift between them. your response will be helpful please

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile:

I read your post. I didn't get any instant help. I am disappointed.

[code]
 //Timer1 Mode 10 PWM to ICR1
//Dual pin 200KHz PWM generator
//47.5% duty cycle 125ns dead band between pulses

void setup() {
  pinMode(9, OUTPUT); //output A
  pinMode(10, OUTPUT); //output B

  TCCR1A = 0; //clear timer registers
  TCCR1B = 0;
  TCNT1 = 0;

  //ICR1 and Prescaler sets frequency
  //no prescaler .0625 us per count @ 16Mh
  //80 counts x .0625 = 5 us = 200Khz

  TCCR1B |= _BV(CS11); //no prescaler
  ICR1 = 20000;//PWM mode counts up and back down for 80 counts

  OCR1A = 10000; //Pin 9 match
  //output A set rising/clear falling
  //Rise at TCNT 21 upslope, High 38 counts, Fall at TCNT 21 downslope
  //47,5% Duty Cycle Pulse centered on TCNT 40. High 38 Low 42
  TCCR1A |= _BV(COM1A1) | _BV(COM1A0); //output A set rising/clear falling
  
  OCR1B = 8000; //Pin 10 match
  //output B clear rising/set falling
  //Fall at TCNT 19 upslope, Low 42, Rise at TCNT 19 downslope
  //47.5% Duty Cycle Pulse centered on TCNT 0. High 38 Low 42
  TCCR1A |= _BV(COM1B1); //output B clear rising/set falling

  TCCR1B |= _BV(WGM13); //PWM mode with ICR1 Mode 10
  TCCR1A |= _BV(WGM11); //WGM13:WGM10 set 1010

}

void loop() {
  


}

[/code]

i am using this program to achieve two pwm signals
Can i get both signals at 25% duty cycles and 25hz frequency with desired phase shift between them? your response will be helpful please

any help will be appreciated

CLASHINGHARSH:
any help will be appreciated

Help with what? You haven’t asked a question.

i am using this program to achieve two pwm signals can i get both signals at 25% duty cycles and 25hz frequency with desired phase shift between them. your response will be helpful please

CLASHINGHARSH:
i am using this program to achieve two pwm signals can i get both signals at 25% duty cycles and 25hz frequency with desired phase shift between them. your response will be helpful please

Good for you. Seems like everything is working as you want. I'm out.

CLASHINGHARSH:
i am using this program to achieve two pwm signals can i get both signals at 25% duty cycles and 25hz frequency with desired phase shift between them. your response will be helpful please

Response to what? What is your question?

Montmorency:
Response to what? What is your question?

i want 25hz with 25% dutycycle

25Hz?
You could do that in software.