PIC16F785 LED Water Light Program

#include __CONFIG(0x33f4); // Disable Watchdog, MCLR reset, Internal RC oscillator, RA4/RA5 as I/O //------------------------------------ // Delay function void delay() { int i; // Define loop variable for(i=5000; i>0; i--) // Control the number of cycles { NOP(); // Consume one instruction cycle NOP(); } } //------------------------------------ // Initialization function void init() { TRISA = 0x00; // Set PORTA as output TRISC = 0x00; // Set PORTC as output TRISB = 0x00; // Set PORTB as output } //------------------------------------ // LED lighting function void LED() { char i; // Define loop variable while(1) { PORTA = 0x01; // Light RA0 for(i=3; i>0; i--) // Cycle 3 times (RA0 to RA2) { delay(); delay(); delay(); PORTA = PORTA << 1; // Light next LED } PORTA = 0x10; // Light RA4 for(i=2; i>0; i--) // 2 cycles (RA4 to RA5) { delay(); delay(); delay(); PORTA = PORTA << 1; } PORTA = 0x00; // Clear all PORTA LEDs PORTB = 0x10; // Light RB0 for(i=4; i>0; i--) // 6 cycles (RB0 to RB5) { delay(); delay(); delay(); PORTB = PORTB << 1; } PORTB = 0x00; // Clear all PORTB LEDs PORTC = 0x01; // Light RC0 for(i=8; i>0; i--) // 8 cycles (RC0 to RC7) { delay(); delay(); delay(); PORTC = PORTC << 1; } PORTC = 0x00; // Clear all PORTC LEDs } } //-------------------------------------- // Main function void main() { init(); // Call initialization function LED(); // Call LED lighting function } // PIC16F785 LED Waterfall Display Program

12W Universal Charger

Power 12W ,output voltage 3-12V, output current Max 1A, 6 dc tips. We can meet your specific requirement of the products, like label design. The material of this product is PC+ABS. All condition of our product is 100% brand new.

Our products built with input/output overvoltage protection, input/output overcurrent protection, over temperature protection, over power protection and short circuit protection. You can send more details of this product, so that we can offer best service to you!


12W Wall Adapter, 12W Wall Power Supply,12W Power Cord In Wall, 12W Wall Power Adapter

Shenzhen Waweis Technology Co., Ltd. , https://www.waweis.com

This entry was posted in on