How to get double sinusoidal PWM

I tired the code form the site:

#include "avr/pgmspace.h"

// table of 256 sine values / one sine period / stored in flash memory
PROGMEM  prog_uchar sine256[]  = {

#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

int ledPin = 13;                 // LED pin 7
int testPin = 7;
int t2Pin = 6;
byte bb;

double dfreq;
// const double refclk=31372.549;  // =16MHz / 510
const double refclk=31376.6;      // measured

// variables used inside interrupt service declared as voilatile
volatile byte icnt;              // var inside interrupt
volatile byte icnt1;             // var inside interrupt
volatile byte c4ms;              // counter incremented all 4ms
volatile unsigned long phaccu;   // pahse accumulator
volatile unsigned long tword_m;  // dds tuning word m

void setup()
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
  Serial.begin(115200);        // connect to the serial port
  Serial.println("DDS Test");

  pinMode(6, OUTPUT);      // sets the digital pin as output
  pinMode(7, OUTPUT);      // sets the digital pin as output
  pinMode(11, OUTPUT);     // pin11= PWM  output / frequency output


  // disable interrupts to avoid timing distortion
  cbi (TIMSK0,TOIE0);              // disable Timer0 !!! delay() is now not available
  sbi (TIMSK2,TOIE2);              // enable Timer2 Interrupt

  dfreq=60;                    // initial output frequency = 60 Hz
  tword_m=pow(2,32)*dfreq/refclk;  // calulate DDS new tuning word 

void loop()
  while(1) {
     if (c4ms > 250) {                 // timer / wait fou a full second

      cbi (TIMSK2,TOIE2);              // disble Timer2 Interrupt
      tword_m=pow(2,32)*dfreq/refclk;  // calulate DDS new tuning word
      sbi (TIMSK2,TOIE2);              // enable Timer2 Interrupt 

      Serial.print("  ");

   sbi(PORTD,6); // Test / set PORTD,7 high to observe timing with a scope
   cbi(PORTD,6); // Test /reset PORTD,7 high to observe timing with a scope
// timer2 setup
// set prscaler to 1, PWM mode to phase correct PWM,  16000000/510 = 31372.55 Hz clock
void Setup_timer2() {

// Timer2 Clock Prescaler to : 1
  sbi (TCCR2B, CS20);
  cbi (TCCR2B, CS21);
  cbi (TCCR2B, CS22);

  // Timer2 PWM Mode set to Phase Correct PWM
  cbi (TCCR2A, COM2A0);  // clear Compare Match
  sbi (TCCR2A, COM2A1);

  sbi (TCCR2A, WGM20);  // Mode 1  / Phase Correct PWM
  cbi (TCCR2A, WGM21);
  cbi (TCCR2B, WGM22);


ISR(TIMER2_OVF_vect) {

  sbi(PORTD,7);          // Test / set PORTD,7 high to observe timing with a oscope

  phaccu=phaccu+tword_m; // soft DDS, phase accu with 32 bits
  icnt=phaccu >> 24;     // use upper 8 bits for phase accu as frequency information
                         // read value fron ROM sine table and send to PWM DAC
  OCR2A=pgm_read_byte_near(sine256 + icnt);    

  if(icnt1++ == 125) {  // increment variable c4ms all 4 milliseconds

 cbi(PORTD,7);            // reset PORTD,7

My question is how do I get this PWM signal (which yields a very fine sine wave after filtering) into two parts - the negative and the positive portions?

I tried things such as

 if(icnt < 128){  
  OCR2A=pgm_read_byte_near(sine256 + icnt);
  pinMode(11, OUTPUT);
  OCR2A=pgm_read_byte_near(sine256 + icnt);
  pinMode(3, OUTPUT);

Basically in the above code, once the sine lookup table gets to the 128th/255 possible values (aka the zero crossing) I want another pin to drive the negative portion of the PWM signal while the other pin is OFF

any ideas?

You need to read the value of the array element for the current index, and test whether it's above or below the 'zero' point of your sin wave. For example, assuming the 'zero' point corresponded to a value of 128 in your array:

if(pgm_read_byte_near(sine256 + icnt) >= 128)
    // positive part of the cycle
    // negative part of the cycle

my problem is that i want ONE OCR register on at a time.

Both OCR2A, OCR2B are outputting power when only one should be on for the positive half and the other only on for the negative half. Not sure how to make them act independently if they both are using the same clock

strajke: my problem is that i want ONE OCR register on at a time.

I assume you know how to turn a given output on and off, whether you're using the Arduino API or hitting the registers directly. The logic I outlined is how you would work out which output to enable at any given time.

Thanks, I took your approach but I modified it a bit by shifting the sine256 with the icnt by 180 degrees.

Seems to be working now as I have pin 3 and 11 with alternating outputs (while 11 on, 3 is off and vice versa).

Need to test it with a couple transistors now and see how it reacts.