This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Calling function in the same file

When I paste my Buzzer code in the main(), it works. But when I made a buzzer() to have this function execute in the main(), it didn't work.
However,I want to use the buzzer function to execute in the main().
How? please help me!!

#pragma DEBUG OBJECTEXTEND CODE
#pragma PL  (60)
#pragma PW  (120)

#define FOREVER 1
#include <89c51rd2.h>
#include <stdio.h>

void Delay(void);
void Buzzer(void);

sbit Buzer = P0^3;

void Buzzer()
{

	int i=0;
	P2=0x00;
	Buzer=0;
 	while(i<6000)
 	{
		TMOD=0x01;
		TH0=0x0D8;		//if it is not flashing change it to 00 for TH0 and Tl0
		TL0=0x0F0;
		TR0=1;
		while(TF0==0){}
		TR0=0;
		TF0=0;
		Buzer=~Buzer;
		i++;
	}


}
void main()
{
  while (FOREVER)
  {
  	Buzzer();

	}
}

0