Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

program/source code tutorial

Status
Not open for further replies.

Ogu Reginald

Full Member level 6
Joined
Oct 7, 2011
Messages
369
Helped
47
Reputation
94
Reaction score
46
Trophy points
1,308
Location
Nigeria
Activity points
3,391
Can someone help me and explain the source code below, also point out where there is error and correct them for me. The program is to take input from pin0 of port 1 and on a load at pin1 of port1.
Also help me calculate how long the delay function will stay.
I am using AT89S52 microcontroller.
#include<reg52.h>
sbit LED =P1^1
sbit switch =P1^1
int i;
void delay (void)
{
for(i=0;i<100;i++)
}
Void main
{
while (1)
{
switch=1;
{
if(switch=1)
Delay();
LED=1
}
}
}

- - - Updated - - -

If there are good programming books please give me.
 


The program is to take input from pin0 of port 1 and on a load at pin1 of port1.
According to the definition of sbit switch is doesn't.

After correcting this point and additional syntax erorrs, you'll possibly want to make the switch acting on and off.
 

Sorry for the mistake, the sbitswitch should be pin0 of port1. I am more concerned on the delay function, I want to know how long the delay in that program will stay in real life situation. I possible please show me how to calculate the delay in real time.
Also help me write a delay function of 10minutes.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top