I want to define pins and ports in an array for example something like this.
char a[3]={PINA.0,PINB.2,PORTC.4};
/***********************************/
if(a[0]==1) // equal to (PINA.0==1)
//do something
a[2]=1; // equal to PORTC.4=1;
I know this codes are not correct and want your help to write the correct one.
My compiler is CodeVision.
I wrote my PIN codes in pin() function:
int pin(int c){
bit a;
switch(c){
case 0:
a=PINA.0;
break;
case 1:
a=PINA.1;
break;
case 2:
a=PINA.2;
break;
case 3:
a=PINA.3;
break;
case 4:
a=PINA.4;
break;
case 5:
a=PINA.5;
break;
case 6:
a=PINA.6;
break;
case 7:
a=PINA.7;
break;
}
return a;
}
i=pin(0) equals to i=PINA.0