Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

on off switch

Status
Not open for further replies.

atif123

Member
i need a c code on keil . 89 c 51
 

Attachments

  • untitled.GIF
    untitled.GIF
    116.6 KB · Views: 345
At its crudest, you could start with



#include <8051.h>
void main()
{
while (1) // do forever
{
P2_0 = P1_0;// copy switch input to output
}
}

This will just copy the current switch state to the output and takes no account of switch bouncing.

You'll have to imagine the indenting!
 
Last edited:
At its crudest, you could start with



#include <8051.h>
void main()
{
while (1) // do forever
{
P2_0 = P1_0;// copy switch input to output
}
}

This will just copy the current switch state to the output and takes no account of switch bouncing.

You'll have to imagine the indenting!

I hope this will work.....
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top