CRTC Electronics

Click here to edit subtitle

Copy/Paste this into MP Lab X for a quick starting point.

#include <stdio.h>

#include <stdlib.h>

#include <xc.h>

#include <pic.h>


#define _XTAL_FREQ 4000000


#pragma config MCLRE = ON, CP = OFF, WDTE = OFF


/*           Pic10F200

 *           _______

 *  nothing |       | GPO 4

 *  2-5.5V  |       | ground

 *  GPO 2   |       | nothing

 *  GPO 1   |_______| GPO 0

 */

int main(int argc, char** argv)

{

 TRISGPIO = 0;

    GPIO = 0;

    while ( 1)

    {

        // a simple sample program that will flash GPO 0

        // Although it says that there are errors, it will work fine

        // That is a bug in mplab X

        GPIObits.GP0 = 1;

        __delay_ms(500);

        GPIObits.GP0 = 0;

        __delay_ms(500);

    }

}