2

I want to make a three phase inverter (DC to AC) bridge type using Arduino. For that I want to generate three square wave each is 120° phase shifted and other three waves of main three wave forms inverted for opposite switch.

Can anyone please help me out? I am new to programing in Arduino.

Code:

void setup() {
  pinMode( 9 , OUTPUT );    
  pinMode( 10 , OUTPUT );   

  TCCR1A = _BV( COM1A0 ) |_BV( COM1B0 );
  TCCR1B = _BV( WGM13) | _BV( WGM12);
  OCR1A = 0;    
}
#define PRESCALER 1
#define PRESCALER_BITS 0x01
#define CLK 16000000UL    

int setWaveforms( unsigned long freq , int shift ) {
  unsigned long clocks_per_toggle = (CLK / freq) / 2;    
  ICR1 = clocks_per_toggle;
  unsigned long offset_clocks = (clocks_per_toggle * shift) / 180UL; 
  OCR1B= offset_clocks;
  TCCR1B |= _BV( CS10 ); 
}

void loop() {
  setWaveforms( 50000 , 120 );
  delay(1000); 
  setWaveforms( 50000 , 120 );
  delay(1000); 
  setWaveforms( 50000 , 120 );
  delay(1000); 
}

I had get 2 waves only but I want to get 6. I am new to Stack Exchange.

2
  • This question doesn't cut it here, and I doubt it will on Arduino.SE. You need to put in your own research effort and show what you've tried, before we can (and will) help you. Otherwise we're just a free developer for hire.
    – Asmyldof
    May 14, 2016 at 11:53
  • ATTiny861. As you've shown no effort, that's all the effort I'll show. May 14, 2016 at 12:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.