Created
October 22, 2019 20:56
-
-
Save d-boz-wtwh/5398f37999ca8549e4a33c441f70db93 to your computer and use it in GitHub Desktop.
Microcontroller Projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: code.c | |
* Author: Usman Ali Butt | |
* Property off: www.microcontroller-project.com | |
* Created on 19 March, 2017, 3:38 PM | |
*/ | |
// PIC16F877 Configuration Bit Settings | |
// 'C' source line config statements | |
#include <xc.h> | |
// #pragma config statements should precede project file includes. | |
// Use project enums instead of #define for ON and OFF. | |
// CONFIG | |
#pragma config FOSC = EXTRC // Oscillator Selection bits (RC oscillator) | |
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled) | |
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) | |
#pragma config CP = OFF // FLASH Program Memory Code Protection bits (Code protection off) | |
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled) | |
#pragma config LVP = ON // Low Voltage In-Circuit Serial Programming Enable bit | |
//(RB3/PGM pin has PGM function; low-voltage programming enabled) | |
#pragma config CPD = OFF // Data EE Memory Code Protection (Code Protection off) | |
// FLASH Program Memory Write Enable (Unprotected program memory may be written to by EECON control) | |
#pragma config WRT = ON | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pic16f877.h> | |
int ramloc1 @ 0x70; //Reserve ram address for variable ramloc1 | |
int ramloc2 @ 0x71; //Reserve ram address for variable ramloc2 | |
int ramloc3 @ 0x72; //Reserve ram address for variable ramloc3 | |
int main(int argc, char** argv) {//Program memory Address specified | |
ramloc1=0x45; //Store hex value all ram address 0x70 | |
ramloc2=0x22; //Store hex value all ram address 0x71 | |
ramloc3=0x34; //Store hex value all ram address 0x72 | |
for(int i=0;i<1000;i++){ | |
for(int j=0;j<10000;j++); | |
} | |
return (EXIT_SUCCESS); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment