Hi, is it possible to change the pin settings in runtime. Meaning that i declare (define) pins when my program is running and then be able to change them according to init values?
then somewhere in the code if i want to connect swap their ports, cant i do that.
I know its a stupid question and there are several ways around it but i have made a RS-485 communication library same for Master and Slave and i want to separate their pin connections to hardware while using the command library.
If i define the port in library then i have to use the same port for master and slave (which i do not want).
The easy way (and what I sugget) is to put the #define in you main program and include the source code for the lib.
If you only have two sets of definitions, one for master and one for slave you could do the switch programmaticly. Use a static var in the lib to hold the chosen setting and set it using
unsigned char OwReset(){
bit temp;
*Tris&=~Mask; //pull line low
delay_10us(75);
*Tris|=Mask; //release line and make input
delay_us(68);
temp=((*Port&Mask)==0); //line pulled low if device present
delay_10us(48);
return temp; //return 0 if present
}