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
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
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.