Can anyone help me with a program code for 8051 microprocessor (Embedded C language)?

Question by : Can anyone help me with a program code for 8051 microprocessor (Embedded C language)?
I’m making an Automatic Street-Light Controller, wherein, the microprocessor is used to switch on/off the light. It’s constructed using an LDR, which detects presence or absence of light. Now, the Microprocessor is supposed to sense if the LDR is in saturation or cut-off and accordingly manipulate the light. If the transistor(at its input) is in cut-off, there is no light, so the output of the microprocessor should be such that the LED at its output, begins to glow. Similarly, for the transistor in saturation, the LED should be put off. The transistor is at the input of the microprocessor, and the LEDs are at the output. Kindly help me with this simple code in Embedded C language.

Best answer:

Answer by Jonathan
All you need to do is read the input pin that senses the LDR condition and drive the output pin, accordingly. You don’t mention which c compiler you are using. But it is usually either SDCC or else Keil (ARM) when talking about the 8051 microcontroller. But I’d need to know the input pin and the output pin and probably some more detail about the LDR circuit as well as how the LED itself is wired up to be much more help than this. In short, though, it sounds like a very short bit of code that sits in a for(;;) loop reading the input pin and either driving the output pin to the same value it reads or else the inverted value it reads. Which amounts to only a couple of lines in the body of the for(;;) loop.

Know better? Leave your own answer in the comments!
Question by New Beginnings? ♥: Trojan Horse embedded in my Recycle bin?
I did a viru scan today and it showed me that there is two trojan horses embedded in my recycle bin (from torrents that i had downloaded and then deleted). Everytime i go to empty my recycle bin it says windows explorer has to restart. So i cant even get in my recycle bin to delete them… HELP!! what do i do? What program can i use to get rid of them..

Best answer:

Answer by Sean L
best bet is to wipe the hard drive and reinstall windows.

you could try emptying the recycle bin, by going

start > control panel > performance and maintenance > Free-up space on the hard disk

run that and it will ask you from there to clear stuff from the recycle bin, just tick the check box next to recycle bin, and click clean hard disk

What do you think? Answer below!

Leave a Reply

Your email address will not be published. Required fields are marked *


*