Now that we got a device configuration file – time to test it.   

The code below will blink a LED attached to RA.0

/*
 * File:   test_main.c
 * Author: Jamie
 *
 * Created on July 22, 2021, 4:44 PM
 */


#include <xc.h>
#include <stdint.h>
#include "device_config.h"

void gpio_init(void);



void main(void) {
    
    gpio_init();
    
    while(1){
        LATAbits.LATA0 = 1;
        __delay_ms(1000);
        LATAbits.LATA0 = 0;
        __delay_ms(1000);
    }
    
    
}


void gpio_init(void){
    TRISAbits.TRISA0 = 0;
    LATAbits.LATA0 = 0;
}

Something You Might Be Intrested In


 

10F32X Rapid Prototype Board

Make The PIC10F322 and other PIC10F Processors Breadboard Friendly for Quick and Easy Prototyping.

{Click to learn more}

PIC16F15325 XC8 Blinking A LED