PIC10F200 LED water light program

>

Include

__CONFIG(0x0ffb);
//Watchdog is off, reset pin is reset, no encryption
//----------------------------------
/ / delay function
Void delay()
{
Int i; / / define the loop variable
For(i=5000;i>0;i--); // null instruction, consume one instruction cycle
}

//----------------------------------
/ / initialization function
Void init()
{
TRIS=0X00; //Set all IO ports as outputs
FOSC4=0; // Turn off Fosc/4 output function of GP2 port
OPTION=0X00; //All IO ports do ordinary I/O ports
}

//----------------------------------
//Lighting function
Void LED()
{
Char i; //Set the loop variable
While(1)
{
GPIO=1; //Light up GP0
For(i=3;i>0;i--) //loop 3 times (GP0-GP2)
{
Delay();
Delay();
Delay(); //call 3 times delay function to control the flashing speed of the water light
GPIO=GPIO<<1; //lights up the next bit
}
}
}

//-----------------------------------
/ / Main function
Void main()
{
Init (); / / call the initialization function
Led (); / / call the lighting function
}

PIC10F200 LED water light program

Mitsubishi TFT-LCD

We are manufacturer of Mitsubishi TFT-LCD in China, if you want to buy Touch Screen,LCD Connector, Frame Rate please contact us.

Mitsubishi TFT-LCD, Touch screen,LCD Connector, Frame Rate, LVDS,Interface

Tonya Display Limited , https://www.tydisplay.com

This entry was posted in on