
Site Search
Microchip PIC16F628A, LED Blinking Code Using ' C ' Language, Time Delay 600 Milliseconds to 1 Second



Microchip PIC16F628A, LED Blinking Code Using ' C ' Language, Time Delay 600 Milliseconds:
100 Millisecond Code Delay:
* Created: Mon Jun 8 2015
* Processor: PIC16F628A
* Compiler: HI-TECH C for PIC10/12/16
* Author: Azhar Ahmed
*/
#include <htc.h>
//Configuration Word
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & MCLRE_ON & BOREN_ON & LVP_OFF & CPD_OFF & CP_OFF);
//Define Pins
#define LED RB5
//Define CPU Frequency
//This must be defined, if __delay_ms() or __delay_us() functions are used in the code
#define _XTAL_FREQ 20000000
//Main Function Start from here
void main(void)
{
// Write your code here
TRISB5 = 0; //Make LED pin an output
LED = 0; //Turn LED off
while (1)
{
LED = !LED; //Toggle LED pin state
__delay_ms(600); //600 milli second delay
}
}
Microchip PIC16F628A, LED Blinking Code Using ' C ' Language, Time Delay 800 Milliseconds:
800 Millisecond Code Delay:
* Created: Mon Jun 8 2015
* Processor: PIC16F628A
* Compiler: HI-TECH C for PIC10/12/16
* Author: Azhar Ahmed
*/
#include <htc.h>
//Configuration Word
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & MCLRE_ON & BOREN_ON & LVP_OFF & CPD_OFF & CP_OFF);
//Define Pins
#define LED RB5
//Define CPU Frequency
//This must be defined, if __delay_ms() or __delay_us() functions are used in the code
#define _XTAL_FREQ 20000000
//Main Function Start from here
void main(void)
{
// Write your code here
TRISB5 = 0; //Make LED pin an output
LED = 0; //Turn LED off
while (1)
{
LED = !LED; //Toggle LED pin state
__delay_ms(800); //800 milli second delay
}
}
Microchip PIC16F628A, LED Blinking Code Using ' C ' Language, Time Delay 1 Seconds:
1 Second Code Delay:
* Created: Mon Jun 8 2015
* Processor: PIC16F628A
* Compiler: HI-TECH C for PIC10/12/16
* Author: Azhar Ahmed
*/
#include <htc.h>
//Configuration Word
__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & MCLRE_ON & BOREN_ON & LVP_OFF & CPD_OFF & CP_OFF);
//Define Pins
#define LED RB5
//Define CPU Frequency
//This must be defined, if __delay_ms() or __delay_us() functions are used in the code
#define _XTAL_FREQ 20000000
//Main Function Start from here
void main(void)
{
// Write your code here
TRISB5 = 0; //Make LED pin an output
LED = 0; //Turn LED off
while (1)
{
LED = !LED; //Toggle LED pin state
__delay_ms(1000); //1000 milli second delay
}
}
PIC16F628A, 18-pin Flash-Based, 8-Bit CMOS Microcontrollers with nanoWatt Technology:
High-Performance RISC CPU: |
---|
|
Special Microcontroller Features: |
---|
|
Low-Power Features: |
---|
|
Peripheral Features: |
---|
|