// <rue_house> 0 means the phase is completely off
// 0: 10
// <rue_house> 1 means the phase goes high
// 1: 11
// <rue_house> -1 means the phase goes pwm low
// -1: 00
// now RB7 = phaseLow0
// RB6 = phaseHi0 w
// RB5 = phaseLow1
// RB4 = phaseHi1
// RB3 = phaseLow2
// RB2 = phaseHi2
// RB1 = unused
// RB0 = unused
static const short seq[] =
{
0b10110000, // 0 1 -1
0b11100000, // 1 0 -1
0b11001000, // 1 -1 0
0b10001100, // 0 -1 1
0b00101100, // -1 0 1
0b00111000 // -1 1 0 what about comma here ?
};
void main()
{
short b;
//Delay_ms(1000);
PORTB ^= 0xFF;
TRISA = 0b11111111; // RA0-RA7 - inputs
PORTB = 0b00000000; // Set all outputs to 0
//TRISB = 0xc0; // Make all RB0-RB5 into outputs, RB6-RB7 to inputs
TRISB = 0b11000000; // Make all RB0-RB5 into outputs, RB6-RB7 to inputs
Delay_ms(100); // Give chip time to cool off
while(1)
{
for (b=0; b<6; b++) {
PORTB = seq[b];
Delay_ms(9); //
}
}
}