Created
December 29, 2017 08:01
-
-
Save halferty/e7c6c0d7d36d9d873971255afba87595 to your computer and use it in GitHub Desktop.
PIC12F675 XC8 blinky 22kHz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: newmain.c | |
* Author: Ed | |
* | |
* Created on December 28, 2017, 11:44 PM | |
*/ | |
//#include <xc.h> | |
// | |
//void main(void) { | |
//// TRISIO = 0xFF ^ 0x04; | |
// ANSEL = 0x00; | |
// ADCON0 = 0x00; | |
// CMCON = 0x07; | |
// VRCON = 0x00; | |
// TRISIO = 0x00; | |
//// GPIO = 0x04; | |
// GPIO = 0xFF; | |
// return; | |
//} | |
#define _XTAL_FREQ 4000000 | |
#pragma config FOSC = INTRCIO | |
#pragma config WDTE = OFF | |
#pragma config PWRTE = ON | |
#pragma config MCLRE = OFF | |
#pragma config BOREN = ON | |
#pragma config CP = OFF | |
#pragma config CPD = OFF | |
#define LED GPIObits.GP2 | |
#include <xc.h> | |
int main() | |
{ | |
TRISIO = 0b000000; | |
ANSEL = 0b000000; | |
GPIO = 0b000000; | |
while(1) | |
{ | |
GPIO = 0b000100; | |
//LED = 1; | |
// __delay_ms(500); // 500ms | |
// 23 usec == 22kKz *smile* | |
__delay_us(23); // 500ms | |
GPIO = 0; | |
//LED = 0; | |
// __delay_ms(500); // 500ms | |
__delay_us(23); // 500ms | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment