In this tutorial we are using the 10F200 Development board and will program the device to blink a LED attached to GP0 – Every one second.
If all of what I just said sounds Greek to you – Bear with me.
The code for this will also work with other PIC10F200s Family Devices – Such as the 10F204 and 10F220.

You will learn the basics of the:
• TRIS (Output Drive Control Register) – To Setting a pin as output
• GPIO (I/O Register) – To turn a pin on or off
• We will hit on the delay macro

The 10F200 has Four I/O PINS – Labeled GP0, GP1, GP2, GP3
• Three of the I/O Pins have Individual Direction Control (Can be input or output)
• One Input Only (GP3)
• 25mA Max Output Current (Can directly drive LEDs)

The code that we will use for this project can be found below.

 

/** File:200Blink.c* Author: Jamie Starling** Created on April 14, 2019, 4:57 PM* Blinks a LED attached to GPIO 0**/#include <xc.h>//DEVICE CONFIGURATION BITS#pragma config WDTE = OFF// Watchdog Timer Enable->WDT disabled#pragma config MCLRE = OFF// MCLR Pin Function Select bit->MCLR pin function is digital input, MCLR internally tied to VDD#pragma config CP = OFF// Code Protection bit->Program memory code protection is disabled//Used to calculate the delay time#define _XTAL_FREQ 4000000//4 MHz//Function Prototypesvoid deviceSetup(void);void main(void) {deviceSetup();//Loop Here Foreverwhile(1){//Turn on GP0GPIObits.GP0 = 0x01;//Wait 1 second__delay_ms(1000);//Turn off GP0GPIObits.GP0 = 0x00;//Wait 1 second__delay_ms(1000);}}//Device Configurationvoid deviceSetup(){//Set All Pins As OutputTRIS = 0b00000000;//Clears GPIOGPIO = 0x00;return;}