Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* How to get the pic16f88 to operate on Port A */
- /* MD Harrington */
- /* Done for the purposes of illustration to those new to both C and embedded devices */
- /* using updated pic micro 8 bit micros in response to Utube tutorial @ */
- /* https://www.youtube.com/watch?v=dPsuCt8JXjU&t=475s */
- /* Just about everything they dont tell you about in the above mentioned tutorial
- You welcome to read my comments on this as well */
- // Header file functions.h
- /* MD Harrington */
- #pragma config FOSC = INTOSCIO // Oscillator Selection bits (INTRC oscillator; port I/O function on both RA6/OSC2/CLKO pin and RA7/OSC1/CLKI pin)
- #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
- #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
- #pragma config MCLRE = OFF // RA5/MCLR/VPP Pin Function Select bit (RA5/MCLR/VPP pin function is digital I/O, MCLR internally tied to VDD)
- #pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR disabled)
- #pragma config LVP = OFF // Low-Voltage Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
- #pragma config CPD = OFF // Data EE Memory Code Protection bit (Code protection off)
- #pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off)
- #pragma config CCPMX = RB0 // CCP1 Pin Selection bit (CCP1 function on RB0)
- #pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
- // CONFIG2
- #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
- #pragma config IESO = OFF // Internal External Switchover bit (Internal External Switchover mode disabled)
- // #pragma config statements should precede project file includes.
- // Use project enums instead of #define for ON and OFF.
- #include <xc.h>
- /* Define clock frequency required for delay functions */
- #define _XTAL_FREQ 8000000
- /*The main file */
- /*
- * File: main.c
- * Author: mark
- *
- * Created on 17 May 2021, 17:17
- */
- #include "functions.h"
- int main(int argc, char** argv) {
- TRISAbits.TRISA0 = 0; / THE PORT DIRECTION BIT
- ANSELbits.ANS0 = 0; // digital out only WE HAVE TO SET ANSEL REGISTER TO NOT ANALOGUE
- OSCCON=0b01110100; //osccon set to 8 mHZ
- PORTA=0x00 ;
- while (1){
- PORTAbits.RA0 = 0 ;
- __delay_ms(500); // 1 Second Delay
- PORTAbits.RA0 = 1 ;
- __delay_ms(500);
- }
- }
- /* The compiled hex file
- :020000040000FA
- :040000008A11FD2F35
- :100FA2008316031305101B1074308F008312031372
- :100FB20085018312031305100630F6001330F50085
- :100FC200AD30F400F40BE32FF50BE32FF60BE32F18
- :100FD200EA2F8312031305140630F6001330F500CE
- :100FE200AD30F400F40BF32FF50BF32FF60BF32FC8
- :0E0FF200FA2FDA2F8A11002883018A11D12FDD
- :04400E00183FFC3F1C
- :00000001FF
- */
- /* LINKS TO DATA SHEET ON THIS DEVICE */
- /* https://static6.arrow.com/aropdfconversion/aef9dedd97cabb718583c4b2d2ebdad89a2ea9ca/6030487d.pdf */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement