bbgil
Full Member level 2
hi. I can't figure out why this code has an undeclared variable when it is defined already in the array. just trying out C for pic16f877a using tables. Is there a problem on how to use pointer or the variable are not matching? any help is appreciated
unsigned short i;
const char Table[11] = {0x12, 0xf3, 0x0f, 0x12, 0xf3, 0x25, 0x10, 0x0f, 0x0c,
0x25, 0x0f};
void main() {
TRISB= 0; // PORTB is output
porta=0;
trisa=0;
PORTb = 0xFF; // Initialize PORTB
while (1)
{
for (i = 0; i<=10u; i++) {
porta = 2;
PORTB = Table(i);
Delay_ms (1000);
porta=0;
Delay_ms (1000);
}
}
}
unsigned short i;
const char Table[11] = {0x12, 0xf3, 0x0f, 0x12, 0xf3, 0x25, 0x10, 0x0f, 0x0c,
0x25, 0x0f};
void main() {
TRISB= 0; // PORTB is output
porta=0;
trisa=0;
PORTb = 0xFF; // Initialize PORTB
while (1)
{
for (i = 0; i<=10u; i++) {
porta = 2;
PORTB = Table(i);
Delay_ms (1000);
porta=0;
Delay_ms (1000);
}
}
}