ankithamirwasia
Newbie level 4

I am making a simple project using AT89C51 in which i make an LED glow when the ir sensor is taken over a black coloured surface and the LED switches off when taken over a white coloured surface. I need help with the C program for the micro controller . I am taking an input from port 1 bit 0 and giving an output on port 0 bit 7. My circuit is complete with a comparator which gives 0V for a black surface and +4.5V for a white surface and this is fed into port 1 bit 0. Can someone please give me the C code to implement the required task??