/************************************************************************
* *
* Processor: 12F683 *
* *
* Pin assignments: *
* GP0 - ISCPDATA *
* GP1 - buton *
* GP2 - PWM *
* GP3 - MCLR *
* GP4 - Test Led *
* GP5 - Touch with GP1 as load * *
************************************************************************/
#include <htc.h>
/***** CONFIGURATION *****/
__CONFIG(
FCMEN_OFF & // Fail Clock Monitor Enable
IESO_OFF & // Internal External Switch Over
BOREN_OFF & // Brown-out detect modes
CP_OFF & // Protection of data block
CPD_OFF & // Protection of program code
MCLRE_OFF & // Master clear reset
PWRTE_OFF & // Power up timer enable
WDTE_OFF & // Watchdog timer enable
FOSC_INTOSCIO // Oscillator configurations: internal
);
// Define oscillator frequency
#define _XTAL_FREQ 8000000
void main(void)
{
OSCCON = 0b01110001; // 8Mhz INT OSC
// Set up the PIC12F683 IO pins
TRISIO = 0b00000000; // Set all IO pins to output
ANSEL = 0b00000000; // Disable analogue inputs
//ADCON0=
GPIO = 0b00000000; // Set all pins to zero
OPTION_REG = 0b00000000; // Set the option register (page 12 of DS)
WPU = 0b00000000; // Set weak pull-up off on all pins
CMCON0 = 7; // Disable Comparator on 12F683
while(1)
{
GP4=1; __delay_ms(1000); GP4=0;__delay_ms(1000);
}
}