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
are you running your c51 code on an emulator running on the arm?
"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...
yes sir
And how is that 8051 emulator mapping I/O pins to that unspecified ARM chip?
1.What microcontroller?
the input to the microcontroller is through usart port which is a serial data from computer 2.What output port? the output port(port p3.0) 3."which will be used actuate the relay" The voltage generated at the output port will be used to trigger a relay 4.How do you "give" it? To what? vcc 5.What LED? the led is used at the output i.e. the voltage generated at the output should glow the led 6."without connect the input through rs232" without connecting the input only the led glows
i was definitely not expecting an answer like that!
Can our magic ARM chip that is currently emulating an 8051 chip actually supply enough current to drive a relay? It is much more common to have the output pin sink to ground when driving bigger loads.
And next thing is that relays needs free-wheel diodes to not destroy the driving transistor.