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

Parents
  • "whenever the microcontroller receives a input"

    What microcontroller?

    How does it receive this input?

    What kind of an input is it?

    "it should generate a voltage pulse of 5v or more at the output port"

    What output port?

    Are you using a 5V microcontroller? If not, how do you propose to obtain the 5V?

    "which will be used actuate the relay"

    What relay?

    "the problem is once i give the input voltage of 5v"

    How do you "give" it? To what?

    "the led glows"

    What LED?

    "without connect the input through rs232"

    Eh??

    "kindly tell me were i am i going wrong"

    Your first mistake seems to be that you're assuming that everyone already has full details of your homework assignment and, thus, knows the full details of your hardware and what you're trying to achieve...

Reply
  • "whenever the microcontroller receives a input"

    What microcontroller?

    How does it receive this input?

    What kind of an input is it?

    "it should generate a voltage pulse of 5v or more at the output port"

    What output port?

    Are you using a 5V microcontroller? If not, how do you propose to obtain the 5V?

    "which will be used actuate the relay"

    What relay?

    "the problem is once i give the input voltage of 5v"

    How do you "give" it? To what?

    "the led glows"

    What LED?

    "without connect the input through rs232"

    Eh??

    "kindly tell me were i am i going wrong"

    Your first mistake seems to be that you're assuming that everyone already has full details of your homework assignment and, thus, knows the full details of your hardware and what you're trying to achieve...

Children
More questions in this forum