I'm programming in C in the MikroC IDE for a pic16f887 and I want more versatility with pins such as being able to put them into an array, passing them as arguments to functions...etc.
So I was wondering what the "type" of a pin such as PORTB.F1
is?
How would I store bits into an array?
Would this work?
const char pinArr[3] = {PORTB.F1, PORTC.F1, PORTD.F1};
Thanks
I'm assuming you are trying to do this with a set of inputs pins. A digital input pin should be read as an int, specifically it will be 0 or 1. Your
char
array probably wouldn't work as a pin with an input of 0 would be read as a NULL character, which would signal the end of the string to anything expecting a normal c string. However there should be nothing stopping you using anint
array.