Therefore i set MCLR up as reset, but i will never use it as reset.
MPLAB XC8 COMPILER BURN FILE TO CHIP CODE
Quote /* * File: zapper.c * Author: * * Created on 03 June 2017, 23:55 */ //This uses PIC12F509 //MPLAB X IDE //XC8 C compiler (free) #include #include #include #include #include #pragma config OSC = IntRC // Oscillator Selection bits (internal RC oscillator) #pragma config WDT = OFF // Watchdog Timer Enable bit (WDT disabled) #pragma config CP = OFF // Code Protection bit (Code protection off) #pragma config MCLRE = OFF // GP3/MCLR Pin Function Select bit (GP3/MCLR pin function is MCLR) #define _XTAL_FREQ 4000000 //I have not set the MCLR pin as an input because it will be noise susceptible.
Define output #define FETS LATBbits.RB2 //Define input #define zero_x PORTBbits.RB4 //Define actions #define ON LATBbits.RB2 = 1 /*Turn ON FETs*/ //Declare functions which set up the microcontroller void disable_interrupts(void) //How do this? void disable_pullups(void) //How do this? void setup_ports(void) void setup_ports(void) Therefore i set MCLR up as reset, but i will never use it as reset.but will //simply tie the pin top Vdd on the PCB. This uses PIC12F509 //MPLAB X IDE //XC8 C compiler (free) #define _XTAL_FREQ 4000000 #include #include #pragma config OSC = ExtRC // Oscillator Selection bits (external RC oscillator) #pragma config WDT = OFF // Watchdog Timer Enable bit (WDT disabled) #pragma config CP = OFF // Code Protection bit (Code protection off) #pragma config MCLRE = ON // GP3/MCLR Pin Function Select bit (GP3/MCLR pin function is MCLR) //I have not set the MCLR pin as an input because it will be noise susceptible.
Code: /* * File: zapper.c * Author: * * Created on 03 June 2017, 23:55 */ //This code turns the product ON at the mains peak voltage //It does this by using the zero crossing detector input. the MPLAB XC8 C Compiler, particularly those who are unfamiliar with embedded programming or Microchip devices.