HI everyone,
So its been a while and this project is still ongoing.
I’m having some trouble with the charlieplex side of things in that it uses up too much program space on the pic. I think I need to use some sort of table but after loads of searching I cannot work out how to code it. Any guidance here would be much appreciated.
below is the current code for the 28 leds charliplex.
thanks
VM=voltage main
VA=voltage AUX
delay=800uS
void LED(void)
{
if (VM>=11.4){TRISB = 0b11101110,PORTB = 0b00000001,delay();}//1
if (VM>=11.6){PORTB = 0b00010000,delay();}//2
if (VM>=11.8){TRISB = 0b11011110,PORTB = 0b00000001,delay();}//3
if (VM>=12){PORTB = 0b00100000,delay();}//4
if (VM>=12.1){TRISB = 0b11111100,PORTB = 0b00000001,delay();}//5
if (VM>=12.2){PORTB = 0b00000010,delay();}//6
if (VM>=12.3){TRISB = 0b11111001,PORTB = 0b00000010,delay();}//7
if (VM>=12.4){PORTB = 0b00000100,delay();}//8
if (VM>=12.5){TRISB = 0b11111010,PORTB = 0b00000001,delay();}//9
if (VM>=12.6){PORTB = 0b00000100,delay();}//10
if (VM>=13){TRISB = 0b11001111,PORTB = 0b00010000,delay();}//11
if (VM>=13.2){PORTB = 0b00100000,delay();}//12
if (VM>=13.7){TRISB = 0b11100111,PORTB = 0b00001000,delay();}//13
if (VM>=14.2){PORTB = 0b00010000,delay();}//14
//-------------------------------------------------------------------------------------
if (VA>=11.4){TRISB = 0b11110011,PORTB = 0b00000100,delay();}//15
if (VA>=11.6){PORTB = 0b00001000,delay();}//16
if (VA>=11.8){TRISB = 0b11101011,PORTB = 0b00000100,delay();}//17
if (VA>=12){PORTB = 0b00010000,delay();}//18
if (VA>=12.1){TRISB = 0b11011011,PORTB = 0b00000100,delay();}//19
if (VA>=12.2){PORTB = 0b00100000,delay();}//20
if (VA>=12.3){TRISB = 0b11110101,PORTB = 0b00000010,delay();}//21
if (VA>=12.4){PORTB = 0b00001000,delay();}//22
if (VA>=12.5){TRISB = 0b11101101,PORTB = 0b00000010,delay();}//23
if (VA>=12.6){PORTB = 0b00010000,delay();}//24
if (VA>=13){TRISB = 0b11011101,PORTB = 0b00000010,delay();}//25
if (VA>=13.2){PORTB = 0b00100000,delay();}//26
if (VA>=13.7){TRISB = 0b11110110,PORTB = 0b00000001,delay();}//27
if (VA>=14.2){PORTB = 0b00001000,delay();}//28
TRISB = 0b11111111;
}