const unsigned char DutyCycleValues[50]= {0, 8, 16, 24, 31, 39, 47, 55, 62, 70, 77, 85, 92, 99, 106, 113, 120, 127, 134, 141, 147, 153, 159, 165, 171, 177, 182, 188, 193, 198, 202, 207, 211, 215, 219, 223, 226, 229, 232, 235, 238, 240, 242, 244, 246, 247, 248, 249, 250, 250};
unsigned short cnt,inc,dec,cnt1;
void interrupt()
{
if (dec==0)
{cnt++;
PWM1_Set_Duty(DutyCycleValues[cnt]);
}
else if (dec==1)
{cnt--;
PWM1_Set_Duty(DutyCycleValues [cnt]);
}
TMR1IF_bit = 0; // clear TMR0IF
TMR1H = 0xFF; // Initialize Timer1 register
TMR1L = 0x76;
}
void main()
{
TRISB = 0; // designate PORTB pins as output
PORTC = 0; // set PORTC to 0 PORTB = 0; //
set PORTC to 0 TRISC = 0; // designate PORTC pins as output
TRISA = 0; // designate PORTB pins as output
PORTA = 0; // set PORTC to 0
T1CON= 0b00000001; // Timer1 settings
TMR1IF_bit = 0; // clear TMR1IF
TMR1H = 0xFF; // Initialize Timer1 register
TMR1L = 0x76; TMR1IE_bit = 1; // enable Timer1 interrupT
cnt = 0; // initialize cnt cnt1=0;
inc=0; dec=0; PWM1_Init(20000); // Initialize PWM1 module at 20KHz \
PWM1_Set_Duty(0); PWM1_Start(); // start PWM1
PWM2_Init(20000); // Initialize PWM2 module at 20KHz \
PWM2_Set_Duty(0);
PWM2_Start(); // start PWM2
INTCON = 0xC0; // Set GIE, PEIE PORTA.b0=1;
while (1) { // endless loop
if (cnt==49 && dec==0)
{ dec=1;
}
else if (cnt==0 &&dec==1) {
PORTB.B1 = 0; PORTB.B2 = 1;
PORTB.B1 =~PORTB.B1;
PORTB.B2 =~PORTB.B2;
dec=0;
}
}
}[CODE]
In the attached PDF file, it talks about building an inverter that inverts 12VDC from solar panels to the 240/50Hz AC needed to power household items. What bits of the attached code would have to be changed to make it 110V/60Hz that we use here in the US?