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
//Final Project for EENG 3040 | |
//Patient Position | |
//Mike Johnson & Lindsey Erps | |
//December 2015 | |
#include <xc.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
// CONFIG1 |
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
// PIC16F887 Configuration Bit Settings | |
#include <xc.h> | |
// CONFIG1 | |
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator: High-speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN) | |
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register) | |
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) | |
#pragma config MCLRE = ON // RE3/MCLR pin function select bit (RE3/MCLR pin function is MCLR) |
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
// PIC16F887 Configuration Bit Settings | |
// 'C' source line config statements | |
#define _XTAL_FREQ 4000000 | |
#include <xc.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
// #pragma config statements should precede project file includes. | |
// Use project enums instead of #define for ON and OFF. |
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
;This code checks to see which button is pressed on the 4x4 keypad and displays it on an LCD | |
;It formats the numbers like a phone number and dials after 10 entries | |
;hardware request:SW S4 ON ,S6 ON,S5 5-6 bits ON,the others OFF | |
;****************************************************** | |
;PIC Configuration for PIC16F887 | |
#include "p16F887.inc" | |
; CONFIG1 |
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
;****************************************************** | |
;PIC Configuration for PIC16F887 | |
#include "p16F887.inc" | |
; CONFIG1 | |
; __config 0x2032 | |
__CONFIG _CONFIG1, _FOSC_HS & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_ON & _CPD_ON & _BOREN_OFF & _IESO_OFF & _FCMEN_OFF & _LVP_OFF | |
; CONFIG2 | |
; __config 0x3FFF | |
__CONFIG _CONFIG2, _BOR4V_BOR40V & _WRT_OFF |
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
ORG 000H | |
GOTO INIT | |
ORG 004H | |
GOTO TMR0ISR | |
INIT | |
WCOPY EQU 70H ;Since the upper 16 bytes of all GPR banks are common in the PIC16F882/883/884/886/887, | |
STATCOPY EQU 71H ;temporary holding registers, W_TEMP and STATUS_TEMP, should be placed in here. | |
;These 16 locations do not require banking and therefore, make it easier to context save and restore. |
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
ORG 000H | |
GOTO INITIALIZE | |
ORG 004H | |
GOTO INCREMENTER | |
INITIALIZE | |
BCF STATUS,RP0 | |
BCF STATUS,RP1 |
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
;Delay subroutine that lasts approximately 0.01 seconds | |
CALL WAIT ;2 | |
WAIT | |
MOVLW 0DH | |
MOVWF OCOUNT | |
MOVLW 0FFH | |
MOVWF ICOUNT ;4 | |
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
;****************************************************** | |
;PIC Configuration for PIC16F887 | |
#include "p16F887.inc" | |
; CONFIG1 | |
; __config 0x2032 | |
__CONFIG _CONFIG1, _FOSC_HS & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_ON & _CPD_ON & _BOREN_OFF & _IESO_OFF & _FCMEN_OFF & _LVP_OFF | |
; CONFIG2 | |
; __config 0x3FFF | |
__CONFIG _CONFIG2, _BOR4V_BOR40V & _WRT_OFF |