Working with ports


Simple example which toggle bit on port P1.3. Program written in C language.

Toolkit:SDCC 8051 Development System

Location:/bipom/devtools/SDCC/examples/bit/c/

Code Example


int main()
{
	// Set the serial port to 19200 Baud

    serinit(CBR_19200);
    
	printf ("Toggling P1.3");
	
	// Loop forever, generating a square wave on P1.3 of 8051

	for(;;)
	{
		P1_3 = 0;
		
		delay(100);
		
		P1_3 = 1;
		
		delay(100);
	}			    
}