Hi, Any one know how to direct I/O for printf function? please help me...
Do you need to have multiple destinations for your serial I/O? I faced this same problem and ended up writing my own version of printf - this also allowed me to solve a number of other problems at the same time. If I can help you in this way, please reply and I will post further details.
All you need to do is "steer" the output in putchar: if(serial) SBUF=c; // over-simplified else P1=c; // put character on pins