This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

voltage generation

Dear all,
i have written a code which is as follows
//whenever the microcontroller receives a input ,it should generate a voltage pulse of 5v or more at the output port which will be used actuate the relay

//the problem is once i give the input voltage of 5v the led glows, without connect the input through rs232 // kindly tell me were i am i going wrong

the program is as follows

#include <>

sbit transistor=P1^0;

void RX(void)
{ TMOD=0X20; TH1=-3; TR1=0xff; SCON=0X50; RI=0;
}

void main()
{

unsigned int i,j;

transistor=0; // transistor off u will get zero volt (0V)

RX();

while(RI==0) // checking for data from serial port {} RI=0;

transistor=1;

for(i=0;i<=1275;i++)
for(j=0;j<=1275;j++);
transistor=0;
while(1) ;

}//main

0