From 12bc599496aa1512c83adaf4f24415ffb29df4ff Mon Sep 17 00:00:00 2001 From: EDI Systems <644580703@qq.com> Date: Tue, 26 Jun 2018 23:14:06 -0400 Subject: [PATCH] :fire:Clean up 16-bit PIC port --- .../bsp/exp16/dspic33ep512mu810_pim/adc.c | 197 --------- .../bsp/exp16/dspic33ep512mu810_pim/adc.h | 119 ------ .../bsp/exp16/dspic33ep512mu810_pim/buttons.c | 132 ------ .../bsp/exp16/dspic33ep512mu810_pim/buttons.h | 75 ---- .../bsp/exp16/dspic33ep512mu810_pim/lcd.c | 399 ------------------ .../bsp/exp16/dspic33ep512mu810_pim/lcd.h | 102 ----- .../bsp/exp16/dspic33ep512mu810_pim/leds.c | 323 -------------- .../bsp/exp16/dspic33ep512mu810_pim/leds.h | 133 ------ .../bsp/exp16/dspic33ep512mu810_pim/power.h | 49 --- .../exp16/dspic33ep512mu810_pim/print_lcd.h | 114 ----- .../bsp/exp16/dspic33ep512mu810_pim/rtcc.c | 115 ----- .../bsp/exp16/dspic33ep512mu810_pim/rtcc.h | 26 -- .../exp16/dspic33ep512mu810_pim/timer_1ms.c | 216 ---------- .../exp16/dspic33ep512mu810_pim/timer_1ms.h | 86 ---- .../Makefile-dspic33ep512mu810_pim.mk | 28 +- .../nbproject/Makefile-genesis.properties | 4 +- .../RMP.X/nbproject/configurations.xml | 2 + .../exp16/dspic33ep512mu810_pim/system.c | 397 ----------------- 18 files changed, 18 insertions(+), 2499 deletions(-) delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/adc.c delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/adc.h delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/buttons.c delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/buttons.h delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/lcd.c delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/lcd.h delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/leds.c delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/leds.h delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/power.h delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/print_lcd.h delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/rtcc.c delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/rtcc.h delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/timer_1ms.c delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/timer_1ms.h delete mode 100644 Project/MPLAB-DSPIC33EP512MU810/RMP.X/system_config/exp16/dspic33ep512mu810_pim/system.c diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/adc.c b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/adc.c deleted file mode 100644 index 9e8c780b..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/adc.c +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ -#include -#include -#include -#include - -/********************************************************************* - * Function: ADC_ReadPercentage(ADC_CHANNEL channel); - * - * Overview: Reads the requested ADC channel and returns the percentage - * of that conversions result (0-100%). - * - * PreCondition: channel is configured via the ADCConfigure() function - * - * Input: ADC_CHANNEL channel - enumeration of the ADC channels - * available in this demo. They should be meaningful names and - * not the names of the ADC pins on the device (as the demo code - * may be ported to other boards). - * i.e. ADC_ReadPercentage(ADC_CHANNEL_POTENTIOMETER); - * - * Output: uint8_t indicating the percentage of the result 0-100% or - * 0xFF for an error - * - ********************************************************************/ -uint8_t ADC_ReadPercentage -( ADC_CHANNEL channel ) -{ - uint8_t percent ; - - switch (channel) - { - case ADC_CHANNEL_5: - break ; - - case ADC_CHANNEL_4: - break ; - - default: - return 0xFF ; - } - - //A very crude percentage calculation - percent = ( ADC_Read10bit ( channel ) / 10 ) ; - - if (percent > 100) - { - percent = 100 ; - } - return percent ; -} -/********************************************************************* - * Function: ADC_Read10bit(ADC_CHANNEL channel); - * - * Overview: Reads the requested ADC channel and returns the 10-bit - * representation of this data. - * - * PreCondition: channel is configured via the ADCConfigure() function - * - * Input: ADC_CHANNEL channel - enumeration of the ADC channels - * available in this demo. They should be meaningful names and - * not the names of the ADC pins on the device (as the demo code - * may be ported to other boards). - * i.e. - ADCReadPercentage(ADC_CHANNEL_POTENTIOMETER); - * - * Output: uint16_t the right adjusted 10-bit representation of the ADC - * channel conversion or 0xFFFF for an error. - * - ********************************************************************/ -uint16_t ADC_Read10bit ( ADC_CHANNEL channel ) -{ - uint16_t i ; - - switch (channel) - { - case ADC_CHANNEL_5: - break ; - - case ADC_CHANNEL_4: - break ; - - default: - return 0xFFFF ; - } - - AD1CHS0 = channel ; - - // Get an ADC sample - AD1CON1bits.SAMP = 1 ; //Start sampling - for (i = 0 ; i < 1000 ; i++) ; //Sample delay, conversion start automatically - - AD1CON1bits.SAMP = 0 ; //Start sampling - for (i = 0 ; i < 1000 ; i++) ; //Sample delay, conversion start automatically - - while (!AD1CON1bits.DONE) ; //Wait for conversion to complete - - return ADC1BUF0 ; -} -/********************************************************************* - * Function: bool ADC_ChannelEnable(ADC_CHANNEL channel, ADC_CONFIGURATION configuration); - * - * Overview: Configures the ADC module to specified setting - * - * PreCondition: none - * - * Input: ADC_CHANNEL channel - the channel to enable - * ADC_CONFIGURATION configuration - the mode in which to run the ADC - * - * Output: bool - true if successfully configured. false otherwise. - * - ********************************************************************/ -bool ADC_ChannelEnable ( ADC_CHANNEL channel ) -{ - switch (channel) - { - case ADC_CHANNEL_5: - ANSELBbits.ANSB5 = 1 ; - return true ; - - case ADC_CHANNEL_4: - ANSELBbits.ANSB4 = 1 ; - return true ; - - default: - return false ; - } -} -/********************************************************************* - * Function: bool ADC_SetConfiguration(ADC_CONFIGURATION configuration) - * - * Overview: Configures the ADC module to specified setting - * - * PreCondition: none - * - * Input: ADC_CONFIGURATION configuration - the mode in which to run the ADC - * - * Output: bool - true if successfully configured. false otherwise. - * - ********************************************************************/ -bool ADC_SetConfiguration ( ADC_CONFIGURATION configuration ) -{ - if (configuration == ADC_CONFIGURATION_DEFAULT) - { - AD1CON2bits.VCFG = 0x0 ; - AD1CON3bits.ADCS = 0xFF ; - AD1CON1bits.SSRC = 0x0 ; - AD1CON1bits.AD12B = 0x0 ; - AD1CON3bits.SAMC = 0b10000 ; - AD1CON1bits.FORM = 0b00 ; - AD1CON2bits.SMPI = 0x0 ; - AD1CON1bits.ADON = 1 ; - - return true ; - } - - else if (configuration == ADC_CONFIGURATION_AUTO_SAMPLE_CONVERT) - { - AD1CON1bits.SSRC = 0b111 ; - AD1CON1bits.AD12B = 0x0 ; - AD1CON1bits.ASAM = 0x01 ; - AD1CON2bits.VCFG = 0x0 ; - AD1CON2bits.SMPI = 0x0 ; - AD1CON2bits.CSCNA = 0x0 ; - AD1CON2bits.ALTS = 0x0 ; - AD1CON3bits.ADCS = 0x2F ; - AD1CON3bits.SAMC = 0b00011 ; - AD1CON4bits.ADDMAEN = 0 ; - IEC0bits.AD1IE = 1 ; - AD1CON1bits.ADON = 1 ; - AD1CHS0 = ADC_CHANNEL_5 ; - IFS0bits.AD1IF = 0 ; - AD1CSSL = 0x0000 ; - - return true ; - } - - return false ; -} diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/adc.h b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/adc.h deleted file mode 100644 index de4ec9c1..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/adc.h +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ - -#ifndef ADC_H -#define ADC_H - -#include -#include - -/*** ADC Channel Definitions *****************************************/ - -/* NOTE - For the A/D to work on the Explorer 16 for this PIM, jumper J1 must be - * shorted between pins 1 and 2. This is marked non-USB, but will only affect - * USB OTG applications. USB device and host operations can short the jumper - * to this position and still operate as expected. */ -#define ADC_CHANNEL_POTENTIOMETER ADC_CHANNEL_5 -#define ADC_CHANNEL_TEMPERATURE_SENSOR ADC_CHANNEL_4 - -typedef enum -{ - ADC_CHANNEL_5 = 5, - ADC_CHANNEL_4 = 4 -} ADC_CHANNEL; - -typedef enum -{ - ADC_CONFIGURATION_DEFAULT, - ADC_CONFIGURATION_AUTO_SAMPLE_CONVERT -} ADC_CONFIGURATION; - -/********************************************************************* -* Function: ADC_ReadPercentage(ADC_CHANNEL channel); -* -* Overview: Reads the requested ADC channel and returns the percentage -* of that conversions result (0-100%). -* -* PreCondition: channel is enabled via ADC_ChannelEnable() -* -* Input: ADC_CHANNEL channel - enumeration of the ADC channels -* available in this demo. They should be meaningful names and -* not the names of the ADC pins on the device (as the demo code -* may be ported to other boards). -* i.e. ADC_ReadPercentage(ADC_CHANNEL_POTENTIOMETER); -* -* Output: uint8_t indicating the percentage of the result 0-100% or -* 0xFF for an error -* -********************************************************************/ -uint8_t ADC_ReadPercentage(ADC_CHANNEL channel); - - -/********************************************************************* -* Function: ADC_Read10bit(ADC_CHANNEL channel); -* -* Overview: Reads the requested ADC channel and returns the 10-bit -* representation of this data. -* -* PreCondition: channel is enabled via ADC_ChannelEnable() -* -* Input: ADC_CHANNEL channel - enumeration of the ADC channels -* available in this demo. They should be meaningful names and -* not the names of the ADC pins on the device (as the demo code -* may be ported to other boards). -* i.e. - ADCReadPercentage(ADC_CHANNEL_POTENTIOMETER); -* -* Output: uint16_t the right adjusted 10-bit representation of the ADC -* channel conversion or 0xFFFF for an error. -* -********************************************************************/ -uint16_t ADC_Read10bit(ADC_CHANNEL channel); - -/********************************************************************* -* Function: bool ADC_ChannelEnable(ADC_CHANNEL channel, ADC_CONFIGURATION configuration); -* -* Overview: Enables specified channel -* -* PreCondition: none -* -* Input: ADC_CHANNEL channel - the channel to enable -* -* Output: bool - true if successfully configured. false otherwise. -* -********************************************************************/ -bool ADC_ChannelEnable(ADC_CHANNEL channel); - -/********************************************************************* -* Function: bool ADC_SetConfiguration(ADC_CONFIGURATION configuration) -* -* Overview: Configures the ADC module to specified setting -* -* PreCondition: none -* -* Input: ADC_CONFIGURATION configuration - the mode in which to run the ADC -* -* Output: bool - true if successfully configured. false otherwise. -* -********************************************************************/ -bool ADC_SetConfiguration(ADC_CONFIGURATION configuration); - -#endif //ADC_H diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/buttons.c b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/buttons.c deleted file mode 100644 index df865746..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/buttons.c +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ - -#include -#include -#include - -/*** Button Definitions *********************************************/ -// S1 is MCLR button -#define S3_PORT PORTDbits.RD6 -#define S6_PORT PORTDbits.RD7 -#define S5_PORT PORTAbits.RA7 //Overlaps with D10 -#define S4_PORT PORTDbits.RD13 - -#define S3_TRIS TRISDbits.TRISD6 -#define S6_TRIS TRISDbits.TRISD7 -#define S5_TRIS TRISAbits.TRISA7 -#define S4_TRIS TRISDbits.TRISD13 - -#define S3_ANSEL ANSELDbits.ANSD6 -#define S6_ANSEL ANSELDbits.ANSD7 -#define S5_ANSEL ANSELAbits.ANSA7 - -#define BUTTON_PRESSED 0 -#define BUTTON_NOT_PRESSED 1 - -#define PIN_INPUT 1 -#define PIN_OUTPUT 0 - -#define PIN_DIGITAL 0 -#define PIN_ANALOG 1 - -/********************************************************************* - * Function: bool BUTTON_IsPressed(BUTTON button); - * - * Overview: Returns the current state of the requested button - * - * PreCondition: button configured via BUTTON_SetConfiguration() - * - * Input: BUTTON button - enumeration of the buttons available in - * this demo. They should be meaningful names and not the names - * of the buttons on the silkscreen on the board (as the demo - * code may be ported to other boards). - * i.e. - ButtonIsPressed(BUTTON_SEND_MESSAGE); - * - * Output: TRUE if pressed; FALSE if not pressed. - * - ********************************************************************/ -bool BUTTON_IsPressed ( BUTTON button ) -{ - switch (button) - { - case BUTTON_S3: - return ( ( S3_PORT == BUTTON_PRESSED ) ? true : false ) ; - - case BUTTON_S6: - return ( ( S6_PORT == BUTTON_PRESSED ) ? true : false ) ; - - case BUTTON_S5: - return ( ( S5_PORT == BUTTON_PRESSED ) ? true : false ) ; - - case BUTTON_S4: - return ( ( S4_PORT == BUTTON_PRESSED ) ? true : false ) ; - - case BUTTON_NONE: - return false ; - } - - return false ; -} -/********************************************************************* - * Function: void BUTTON_Enable(BUTTON button); - * - * Overview: Returns the current state of the requested button - * - * PreCondition: button configured via BUTTON_SetConfiguration() - * - * Input: BUTTON button - enumeration of the buttons available in - * this demo. They should be meaningful names and not the names - * of the buttons on the silkscreen on the board (as the demo - * code may be ported to other boards). - * i.e. - ButtonIsPressed(BUTTON_SEND_MESSAGE); - * - * Output: None - * - ********************************************************************/ -void BUTTON_Enable ( BUTTON button ) -{ - switch (button) - { - case BUTTON_S3: - S3_TRIS = PIN_INPUT ; - S3_ANSEL = PIN_DIGITAL ; - break ; - - case BUTTON_S6: - S6_TRIS = PIN_INPUT ; - S6_ANSEL = PIN_DIGITAL ; - break ; - - case BUTTON_S5: - S5_TRIS = PIN_INPUT ; - S5_ANSEL = PIN_DIGITAL ; - break ; - - case BUTTON_S4: - S4_TRIS = PIN_INPUT ; - break ; - - case BUTTON_NONE: - break ; - } -} diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/buttons.h b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/buttons.h deleted file mode 100644 index 75e34912..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/buttons.h +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ - -#include - -#ifndef BUTTONS_H -#define BUTTONS_H - -/*** Button Definitions *********************************************/ -typedef enum -{ - BUTTON_NONE, - BUTTON_S3, - BUTTON_S6, - BUTTON_S5, - BUTTON_S4 - //S1 is MCLR -} BUTTON; - -/********************************************************************* -* Function: bool BUTTON_IsPressed(BUTTON button); -* -* Overview: Returns the current state of the requested button -* -* PreCondition: button configured via BUTTON_SetConfiguration() -* -* Input: BUTTON button - enumeration of the buttons available in -* this demo. They should be meaningful names and not the names -* of the buttons on the silkscreen on the board (as the demo -* code may be ported to other boards). -* i.e. - ButtonIsPressed(BUTTON_SEND_MESSAGE); -* -* Output: TRUE if pressed; FALSE if not pressed. -* -********************************************************************/ -bool BUTTON_IsPressed(BUTTON button); - -/********************************************************************* -* Function: void BUTTON_Enable(BUTTON button); -* -* Overview: Returns the current state of the requested button -* -* PreCondition: button configured via BUTTON_SetConfiguration() -* -* Input: BUTTON button - enumeration of the buttons available in -* this demo. They should be meaningful names and not the names -* of the buttons on the silkscreen on the board (as the demo -* code may be ported to other boards). -* i.e. - ButtonIsPressed(BUTTON_SEND_MESSAGE); -* -* Output: None -* -********************************************************************/ -void BUTTON_Enable(BUTTON button); - -#endif //BUTTONS_H diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/lcd.c b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/lcd.c deleted file mode 100644 index bef1515c..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/lcd.c +++ /dev/null @@ -1,399 +0,0 @@ -/****************************************************************************** -Software License Agreement - -The software supplied herewith by Microchip Technology Incorporated -(the "Company") for its PIC(R) Microcontroller is intended and -supplied to you, the Company's customer, for use solely and -exclusively on Microchip PICmicro Microcontroller products. The -software is owned by the Company and/or its supplier, and is -protected under applicable copyright laws. All rights are reserved. -Any use in violation of the foregoing restrictions may subject the -user to criminal sanctions under applicable laws, as well as to -civil liability for the breach of the terms and conditions of this -license. - -THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, -WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED -TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, -IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************************/ - -#include -#include -#include - -/* Private Definitions ***********************************************/ -// Define a fast instruction execution time in terms of loop time -// typically > 43us -#define LCD_F_INSTR 2000 - -// Define a slow instruction execution time in terms of loop time -// typically > 1.35ms -#define LCD_S_INSTR 6000 - -// Define the startup time for the LCD in terms of loop time -// typically > 30ms -#define LCD_STARTUP 50000 - -#define LCD_MAX_COLUMN 16 - -#define LCD_SendData(data) { PMADDR = 0x0001; PMDIN1 = data; LCD_Wait(LCD_F_INSTR); } -#define LCD_SendCommand(command, delay) { PMADDR = 0x0000; PMDIN1 = command; LCD_Wait(delay); } -#define LCD_COMMAND_CLEAR_SCREEN 0x01 -#define LCD_COMMAND_RETURN_HOME 0x02 -#define LCD_COMMAND_ENTER_DATA_MODE 0x06 -#define LCD_COMMAND_CURSOR_OFF 0x0C -#define LCD_COMMAND_CURSOR_ON 0x0F -#define LCD_COMMAND_MOVE_CURSOR_LEFT 0x10 -#define LCD_COMMAND_MOVE_CURSOR_RIGHT 0x14 -#define LCD_COMMAND_SET_MODE_8_BIT 0x38 -#define LCD_COMMAND_ROW_0_HOME 0x80 -#define LCD_COMMAND_ROW_1_HOME 0xC0 - -/* Private Functions *************************************************/ -static void LCD_CarriageReturn ( void ) ; -static void LCD_ShiftCursorLeft ( void ) ; -static void LCD_ShiftCursorRight ( void ) ; -static void LCD_ShiftCursorUp ( void ) ; -static void LCD_ShiftCursorDown ( void ) ; -static void LCD_Wait ( unsigned long ) ; - -/* Private variables ************************************************/ -static uint8_t row ; -static uint8_t column ; -/********************************************************************* - * Function: bool LCD_Initialize(void); - * - * Overview: Initializes the LCD screen. Can take several hundred - * milliseconds. - * - * PreCondition: none - * - * Input: None - * - * Output: true if initialized, false otherwise - * - ********************************************************************/ -bool LCD_Initialize ( void ) -{ - PMMODE = 0x03ff ; - // Enable PMP Module, No Address & Data Muxing, - // Enable RdWr Port, Enable Enb Port, No Chip Select, - // Select RdWr and Enb signals Active High - PMCON = 0x8383 ; - // Enable A0 - PMAEN = 0x0001 ; - - LCD_Wait ( LCD_STARTUP ) ; - - LCD_SendCommand ( LCD_COMMAND_SET_MODE_8_BIT , LCD_F_INSTR + LCD_STARTUP ) ; - LCD_SendCommand ( LCD_COMMAND_CURSOR_OFF , LCD_F_INSTR ) ; - LCD_SendCommand ( LCD_COMMAND_ENTER_DATA_MODE , LCD_S_INSTR ) ; - - LCD_ClearScreen ( ) ; - - return true ; -} -/********************************************************************* - * Function: void LCD_PutString(char* inputString, uint16_t length); - * - * Overview: Puts a string on the LCD screen. Unsupported characters will be - * discarded. May block or throw away characters is LCD is not ready - * or buffer space is not available. Will terminate when either a - * null terminator character (0x00) is reached or the length number - * of characters is printed, which ever comes first. - * - * PreCondition: already initialized via LCD_Initialize() - * - * Input: char* - string to print - * uint16_t - length of string to print - * - * Output: None - * - ********************************************************************/ -void LCD_PutString ( char* inputString , uint16_t length ) -{ - while (length--) - { - switch (*inputString) - { - case 0x00: - return ; - - default: - LCD_PutChar ( *inputString++ ) ; - break ; - } - } -} -/********************************************************************* - * Function: void LCD_PutChar(char); - * - * Overview: Puts a character on the LCD screen. Unsupported characters will be - * discarded. May block or throw away characters is LCD is not ready - * or buffer space is not available. - * - * PreCondition: already initialized via LCD_Initialize() - * - * Input: char - character to print - * - * Output: None - * - ********************************************************************/ -void LCD_PutChar ( char inputCharacter ) -{ - switch (inputCharacter) - { - case '\r': - LCD_CarriageReturn ( ) ; - break ; - - case '\n': - if (row == 0) - { - LCD_ShiftCursorDown ( ) ; - } - else - { - LCD_ShiftCursorUp ( ) ; - } - break ; - - case '\b': - LCD_ShiftCursorLeft ( ) ; - LCD_PutChar ( ' ' ) ; - LCD_ShiftCursorLeft ( ) ; - break ; - - default: - LCD_SendData ( inputCharacter ) ; - column++ ; - - if (column == LCD_MAX_COLUMN) - { - column = 0 ; - if (row == 0) - { - LCD_SendCommand ( LCD_COMMAND_ROW_1_HOME , LCD_S_INSTR ) ; - row = 1 ; - } - else - { - LCD_SendCommand ( LCD_COMMAND_ROW_0_HOME , LCD_S_INSTR ) ; - row = 0 ; - } - } - break ; - } -} -/********************************************************************* - * Function: void LCD_ClearScreen(void); - * - * Overview: Clears the screen, if possible. - * - * PreCondition: already initialized via LCD_Initialize() - * - * Input: None - * - * Output: None - * - ********************************************************************/ -void LCD_ClearScreen ( void ) -{ - LCD_SendCommand ( LCD_COMMAND_CLEAR_SCREEN , LCD_S_INSTR ) ; - LCD_SendCommand ( LCD_COMMAND_RETURN_HOME , LCD_S_INSTR ) ; - - row = 0 ; - column = 0 ; -} - - -/*******************************************************************/ -/*******************************************************************/ -/* Private Functions ***********************************************/ -/*******************************************************************/ -/*******************************************************************/ -/********************************************************************* - * Function: static void LCD_CarriageReturn(void) - * - * Overview: Handles a carriage return - * - * PreCondition: already initialized via LCD_Initialize() - * - * Input: None - * - * Output: None - * - ********************************************************************/ -static void LCD_CarriageReturn ( void ) -{ - if (row == 0) - { - LCD_SendCommand ( LCD_COMMAND_ROW_0_HOME , LCD_S_INSTR ) ; - } - else - { - LCD_SendCommand ( LCD_COMMAND_ROW_1_HOME , LCD_S_INSTR ) ; - } - column = 0 ; -} -/********************************************************************* - * Function: static void LCD_ShiftCursorLeft(void) - * - * Overview: Shifts cursor left one spot (wrapping if required) - * - * PreCondition: already initialized via LCD_Initialize() - * - * Input: None - * - * Output: None - * - ********************************************************************/ -static void LCD_ShiftCursorLeft ( void ) -{ - uint8_t i ; - - if (column == 0) - { - if (row == 0) - { - LCD_SendCommand ( LCD_COMMAND_ROW_1_HOME , LCD_S_INSTR ) ; - row = 1 ; - } - else - { - LCD_SendCommand ( LCD_COMMAND_ROW_0_HOME , LCD_S_INSTR ) ; - row = 0 ; - } - - //Now shift to the end of the row - for (i = 0 ; i < ( LCD_MAX_COLUMN - 1 ) ; i++) - { - LCD_ShiftCursorRight ( ) ; - } - } - else - { - column-- ; - LCD_SendCommand ( LCD_COMMAND_MOVE_CURSOR_LEFT , LCD_F_INSTR ) ; - } -} -/********************************************************************* - * Function: static void LCD_ShiftCursorRight(void) - * - * Overview: Shifts cursor right one spot (wrapping if required) - * - * PreCondition: already initialized via LCD_Initialize() - * - * Input: None - * - * Output: None - * - ********************************************************************/ -static void LCD_ShiftCursorRight ( void ) -{ - LCD_SendCommand ( LCD_COMMAND_MOVE_CURSOR_RIGHT , LCD_F_INSTR ) ; - column++ ; - - if (column == LCD_MAX_COLUMN) - { - column = 0 ; - if (row == 0) - { - LCD_SendCommand ( LCD_COMMAND_ROW_1_HOME , LCD_S_INSTR ) ; - row = 1 ; - } - else - { - LCD_SendCommand ( LCD_COMMAND_ROW_0_HOME , LCD_S_INSTR ) ; - row = 0 ; - } - } -} -/********************************************************************* - * Function: static void LCD_ShiftCursorUp(void) - * - * Overview: Shifts cursor up one spot (wrapping if required) - * - * PreCondition: already initialized via LCD_Initialize() - * - * Input: None - * - * Output: None - * - ********************************************************************/ -static void LCD_ShiftCursorUp ( void ) -{ - uint8_t i ; - - for (i = 0 ; i < LCD_MAX_COLUMN ; i++) - { - LCD_ShiftCursorLeft ( ) ; - } -} -/********************************************************************* - * Function: static void LCD_ShiftCursorDown(void) - * - * Overview: Shifts cursor down one spot (wrapping if required) - * - * PreCondition: already initialized via LCD_Initialize() - * - * Input: None - * - * Output: None - * - ********************************************************************/ -static void LCD_ShiftCursorDown ( void ) -{ - uint8_t i ; - - for (i = 0 ; i < LCD_MAX_COLUMN ; i++) - { - LCD_ShiftCursorRight ( ) ; - } -} -/********************************************************************* - * Function: static void LCD_Wait(unsigned int B) - * - * Overview: A crude wait function that just cycle burns - * - * PreCondition: None - * - * Input: unsigned int - artibrary delay time based on loop counts. - * - * Output: None - * - ********************************************************************/ -static void LCD_Wait ( unsigned long delay ) -{ - while (delay) - { - Nop(); - delay-- ; - } -} -/********************************************************************* - * Function: void LCD_CursorEnable(bool enable) - * - * Overview: Enables/disables the cursor - * - * PreCondition: None - * - * Input: bool - specifies if the cursor should be on or off - * - * Output: None - * - ********************************************************************/ -void LCD_CursorEnable ( bool enable ) -{ - if (enable == true) - { - LCD_SendCommand ( LCD_COMMAND_CURSOR_ON , LCD_S_INSTR ) ; - } - else - { - LCD_SendCommand ( LCD_COMMAND_CURSOR_OFF , LCD_S_INSTR ) ; - } -} diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/lcd.h b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/lcd.h deleted file mode 100644 index 0d1c47c7..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/lcd.h +++ /dev/null @@ -1,102 +0,0 @@ -/****************************************************************************** -Software License Agreement - -The software supplied herewith by Microchip Technology Incorporated -(the "Company") for its PIC(R) Microcontroller is intended and -supplied to you, the Company's customer, for use solely and -exclusively on Microchip PICmicro Microcontroller products. The -software is owned by the Company and/or its supplier, and is -protected under applicable copyright laws. All rights are reserved. -Any use in violation of the foregoing restrictions may subject the -user to criminal sanctions under applicable laws, as well as to -civil liability for the breach of the terms and conditions of this -license. - -THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, -WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED -TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, -IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. -*******************************************************************************/ - -#include -#include - -/********************************************************************* -* Function: bool LCD_Initialize(void); -* -* Overview: Initializes the LCD screen. Can take several hundred -* milliseconds. -* -* PreCondition: none -* -* Input: None -* -* Output: true if successful, false otherwise -* -********************************************************************/ -bool LCD_Initialize(void); - -/********************************************************************* -* Function: void LCD_PutString(char* inputString, uint16_t length); -* -* Overview: Puts a string on the LCD screen. Unsupported characters will be -* discarded. May block or throw away characters is LCD is not ready -* or buffer space is not available. Will terminate when either a -* null terminator character (0x00) is reached or the length number -* of characters is printed, which ever comes first. -* -* PreCondition: already initialized via LCD_Initialize() -* -* Input: char* - string to print -* uint16_t - length of string to print -* -* Output: None -* -********************************************************************/ -void LCD_PutString(char* inputString, uint16_t length); - -/********************************************************************* -* Function: void LCD_PutChar(char); -* -* Overview: Puts a character on the LCD screen. Unsupported characters will be -* discarded. May block or throw away characters is LCD is not ready -* or buffer space is not available. -* -* PreCondition: already initialized via LCD_Initialize() -* -* Input: char - character to print -* -* Output: None -* -********************************************************************/ -void LCD_PutChar(char); - -/********************************************************************* -* Function: void LCD_ClearScreen(void); -* -* Overview: Clears the screen, if possible. -* -* PreCondition: already initialized via LCD_Initialize() -* -* Input: None -* -* Output: None -* -********************************************************************/ -void LCD_ClearScreen(void); - -/********************************************************************* -* Function: void LCD_CursorEnable(bool enable) -* -* Overview: Enables/disables the cursor -* -* PreCondition: None -* -* Input: bool - specifies if the cursor should be on or off -* -* Output: None -* -********************************************************************/ -void LCD_CursorEnable(bool enable); diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/leds.c b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/leds.c deleted file mode 100644 index c528a771..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/leds.c +++ /dev/null @@ -1,323 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ - -#include -#include -#include - -#define LED_D3_LAT LATAbits.LATA0 -#define LED_D4_LAT LATAbits.LATA1 -#define LED_D5_LAT LATAbits.LATA2 -#define LED_D6_LAT LATAbits.LATA3 -#define LED_D7_LAT LATAbits.LATA4 -#define LED_D8_LAT LATAbits.LATA5 -#define LED_D9_LAT LATAbits.LATA6 -#define LED_D10_LAT LATAbits.LATA7 //Overlaps with S5 - -#define LED_D3_TRIS TRISAbits.TRISA0 -#define LED_D4_TRIS TRISAbits.TRISA1 -#define LED_D5_TRIS TRISAbits.TRISA2 -#define LED_D6_TRIS TRISAbits.TRISA3 -#define LED_D7_TRIS TRISAbits.TRISA4 -#define LED_D8_TRIS TRISAbits.TRISA5 -#define LED_D9_TRIS TRISAbits.TRISA6 -#define LED_D10_TRIS TRISAbits.TRISA7 //Overlaps with S5 - -#define LED_ON 1 -#define LED_OFF 0 - -#define INPUT 1 -#define OUTPUT 0 -/********************************************************************* - * Function: void LED_On(LED led); - * - * Overview: Turns requested LED on - * - * PreCondition: LED configured via LED_Configure() - * - * Input: LED led - enumeration of the LEDs available in this - * demo. They should be meaningful names and not the names of - * the LEDs on the silkscreen on the board (as the demo code may - * be ported to other boards). - * i.e. - LED_On(LED_CONNECTION_DETECTED); - * - * Output: none - * - ********************************************************************/ -void LED_On ( LED led ) -{ - switch (led) - { - case LED_D3: - LED_D3_LAT = LED_ON ; - break ; - - case LED_D4: - LED_D4_LAT = LED_ON ; - break ; - - case LED_D5: - LED_D5_LAT = LED_ON ; - break ; - - case LED_D6: - LED_D6_LAT = LED_ON ; - break ; - - case LED_D7: - LED_D7_LAT = LED_ON ; - break ; - - case LED_D8: - LED_D8_LAT = LED_ON ; - break ; - - case LED_D9: - LED_D9_LAT = LED_ON ; - break ; - - case LED_D10: - LED_D10_LAT = LED_ON ; - break ; - - case LED_NONE: - break ; - } -} -/********************************************************************* - * Function: void LED_Off(LED led); - * - * Overview: Turns requested LED off - * - * PreCondition: LED configured via LEDConfigure() - * - * Input: LED led - enumeration of the LEDs available in this - * demo. They should be meaningful names and not the names of - * the LEDs on the silkscreen on the board (as the demo code may - * be ported to other boards). - * i.e. - LED_Off(LED_CONNECTION_DETECTED); - * - * Output: none - * - ********************************************************************/ -void LED_Off ( LED led ) -{ - switch (led) - { - case LED_D3: - LED_D3_LAT = LED_OFF ; - break ; - - case LED_D4: - LED_D4_LAT = LED_OFF ; - break ; - - case LED_D5: - LED_D5_LAT = LED_OFF ; - break ; - - case LED_D6: - LED_D6_LAT = LED_OFF ; - break ; - - case LED_D7: - LED_D7_LAT = LED_OFF ; - break ; - - case LED_D8: - LED_D8_LAT = LED_OFF ; - break ; - - case LED_D9: - LED_D9_LAT = LED_OFF ; - break ; - - case LED_D10: - LED_D10_LAT = LED_OFF ; - break ; - - case LED_NONE: - break ; - } -} -/********************************************************************* - * Function: void LED_Toggle(LED led); - * - * Overview: Toggles the state of the requested LED - * - * PreCondition: LED configured via LEDConfigure() - * - * Input: LED led - enumeration of the LEDs available in this - * demo. They should be meaningful names and not the names of - * the LEDs on the silkscreen on the board (as the demo code may - * be ported to other boards). - * i.e. - LED_Toggle(LED_CONNECTION_DETECTED); - * - * Output: none - * - ********************************************************************/ -void LED_Toggle ( LED led ) -{ - switch (led) - { - case LED_D3: - LED_D3_LAT ^= 1 ; - break ; - - case LED_D4: - LED_D4_LAT ^= 1 ; - break ; - - case LED_D5: - LED_D5_LAT ^= 1 ; - break ; - - case LED_D6: - LED_D6_LAT ^= 1 ; - break ; - - case LED_D7: - LED_D7_LAT ^= 1 ; - break ; - - case LED_D8: - LED_D8_LAT ^= 1 ; - break ; - - case LED_D9: - LED_D9_LAT ^= 1 ; - break ; - - case LED_D10: - LED_D10_LAT ^= 1 ; - break ; - - case LED_NONE: - break ; - } -} -/********************************************************************* - * Function: bool LED_Get(LED led); - * - * Overview: Returns the current state of the requested LED - * - * PreCondition: LED configured via LEDConfigure() - * - * Input: LED led - enumeration of the LEDs available in this - * demo. They should be meaningful names and not the names of - * the LEDs on the silkscreen on the board (as the demo code may - * be ported to other boards). - * i.e. - LED_Get(LED_CONNECTION_DETECTED); - * - * Output: true if on, false if off - * - ********************************************************************/ -bool LED_Get ( LED led ) -{ - switch (led) - { - case LED_D3: - return ( ( LED_D3_LAT == LED_ON ) ? true : false ) ; - - case LED_D4: - return ( ( LED_D4_LAT == LED_ON ) ? true : false ) ; - - case LED_D5: - return ( ( LED_D5_LAT == LED_ON ) ? true : false ) ; - - case LED_D6: - return ( ( LED_D6_LAT == LED_ON ) ? true : false ) ; - - case LED_D7: - return ( ( LED_D7_LAT == LED_ON ) ? true : false ) ; - - case LED_D8: - return ( ( LED_D8_LAT == LED_ON ) ? true : false ) ; - - case LED_D9: - return ( ( LED_D9_LAT == LED_ON ) ? true : false ) ; - - case LED_D10: - return ( ( LED_D10_LAT == LED_ON ) ? true : false ) ; - - case LED_NONE: - return false ; - - } - return false ; -} -/********************************************************************* - * Function: void LED_Enable(LED led); - * - * Overview: Configures the LED for use by the other LED API - * - * PreCondition: none - * - * Input: LED led - enumeration of the LEDs available in this - * demo. They should be meaningful names and not the names of - * the LEDs on the silkscreen on the board (as the demo code may - * be ported to other boards). - * - * Output: none - * - ********************************************************************/ -void LED_Enable ( LED led ) -{ - switch (led) - { - case LED_D3: - LED_D3_TRIS = OUTPUT ; - break ; - - case LED_D4: - LED_D4_TRIS = OUTPUT ; - break ; - - case LED_D5: - LED_D5_TRIS = OUTPUT ; - break ; - - case LED_D6: - LED_D6_TRIS = OUTPUT ; - break ; - - case LED_D7: - LED_D7_TRIS = OUTPUT ; - break ; - - case LED_D8: - LED_D8_TRIS = OUTPUT ; - break ; - - case LED_D9: - LED_D9_TRIS = OUTPUT ; - break ; - - case LED_D10: - LED_D10_TRIS = OUTPUT ; - break ; - - case LED_NONE: - break ; - } -} - diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/leds.h b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/leds.h deleted file mode 100644 index 3621928a..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/leds.h +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ - -#ifndef LEDS_H -#define LEDS_H - -#include - -/** Type defintions *********************************/ -typedef enum -{ - LED_NONE, - LED_D3, - LED_D4, - LED_D5, - LED_D6, - LED_D7, - LED_D8, - LED_D9, - LED_D10 -} LED; - -#define LED_COUNT 8 - -/********************************************************************* -* Function: void LED_On(LED led); -* -* Overview: Turns requested LED on -* -* PreCondition: LED configured via LED_Configure() -* -* Input: LED led - enumeration of the LEDs available in this -* demo. They should be meaningful names and not the names of -* the LEDs on the silkscreen on the board (as the demo code may -* be ported to other boards). -* i.e. - LED_On(LED_CONNECTION_DETECTED); -* -* Output: none -* -********************************************************************/ -void LED_On(LED led); - -/********************************************************************* -* Function: void LED_Off(LED led); -* -* Overview: Turns requested LED off -* -* PreCondition: LED configured via LEDConfigure() -* -* Input: LED led - enumeration of the LEDs available in this -* demo. They should be meaningful names and not the names of -* the LEDs on the silkscreen on the board (as the demo code may -* be ported to other boards). -* i.e. - LED_Off(LED_CONNECTION_DETECTED); -* -* Output: none -* -********************************************************************/ -void LED_Off(LED led); - -/********************************************************************* -* Function: void LED_Toggle(LED led); -* -* Overview: Toggles the state of the requested LED -* -* PreCondition: LED configured via LEDConfigure() -* -* Input: LED led - enumeration of the LEDs available in this -* demo. They should be meaningful names and not the names of -* the LEDs on the silkscreen on the board (as the demo code may -* be ported to other boards). -* i.e. - LED_Toggle(LED_CONNECTION_DETECTED); -* -* Output: none -* -********************************************************************/ -void LED_Toggle(LED led); - -/********************************************************************* -* Function: bool LED_Get(LED led); -* -* Overview: Returns the current state of the requested LED -* -* PreCondition: LED configured via LEDConfigure() -* -* Input: LED led - enumeration of the LEDs available in this -* demo. They should be meaningful names and not the names of -* the LEDs on the silkscreen on the board (as the demo code may -* be ported to other boards). -* i.e. - LED_Get(LED_CONNECTION_DETECTED); -* -* Output: true if on, false if off -* -********************************************************************/ -bool LED_Get(LED led); - -/********************************************************************* -* Function: bool LED_Enable(LED led); -* -* Overview: Configures the LED for use by the other LED API -* -* PreCondition: none -* -* Input: LED led - enumeration of the LEDs available in this -* demo. They should be meaningful names and not the names of -* the LEDs on the silkscreen on the board (as the demo code may -* be ported to other boards). -* -* Output: none -* -********************************************************************/ -void LED_Enable(LED led); - -#endif //LEDS_H diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/power.h b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/power.h deleted file mode 100644 index 75f710c3..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/power.h +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ - -#ifndef BSP_POWER_H -#define BSP_POWER_H - -/** Type defintions *********************************/ -typedef enum -{ - POWER_SOURCE_USB, - POWER_SOURCE_MAINS -} POWER_SOURCE; - - -/********************************************************************* -* Function: POWER_SOURCE POWER_SourceGet(void) -* -* Overview: Gets the current source of power for the board -* -* PreCondition: None -* -* Input: None -* -* Output: POWER_SOURCE - the current source of power for the board -* -********************************************************************/ -POWER_SOURCE POWER_SourceGet(void); -#define POWER_SourceGet() POWER_SOURCE_MAINS - -#endif //BSP_POWER_H diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/print_lcd.h b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/print_lcd.h deleted file mode 100644 index 4058e61f..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/print_lcd.h +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ - -#ifndef PRINT_LCD_H -#define PRINT_LCD_H - -#include -#include - -/* Type Definitions *************************************************/ -typedef enum -{ - PRINT_CONFIGURATION_LCD -} PRINT_CONFIGURATION; - -/********************************************************************* -* Function: bool PRINT_SetConfiguration(PRINT_CONFIGURATION led); -* -* Overview: Configures the print configuration -* -* PreCondition: none -* -* Input: configuration - the print configuration to use. Some boards -* may have more than one print configuration enabled -* -* Output: TRUE if successful, FALSE if LED not configured or doesn?t -* exist for this board. -* -********************************************************************/ -bool PRINT_SetConfiguration(PRINT_CONFIGURATION configuration); -#define PRINT_SetConfiguration(configuration) LCD_Initialize() - -/********************************************************************* -* Function: void PRINT_String(char* string, uint16_t length) -* -* Overview: Prints a string until a null terminator is reached or the -* specified string length is printed. -* -* PreCondition: none -* -* Input: char* string - the string to print. -* uint16_t length - the length of the string. -* -* Output: None -* -********************************************************************/ -void PRINT_String(char* string, uint16_t length); -#define PRINT_String(string, length) LCD_PutString(string, length) - -/********************************************************************* -* Function: void PRINT_Char(char charToPrint) -* -* Overview: Prints a character -* -* PreCondition: none -* -* Input: char charToPrint - the character to print -* -* Output: None -* -********************************************************************/ -void PRINT_Char(char charToPrint); -#define PRINT_Char(charToPrint) LCD_PutChar(charToPrint) - -/********************************************************************* -* Function: void PRINT_ClearStreen() -* -* Overview: Clears the screen, if possible -* -* PreCondition: none -* -* Input: None -* -* Output: None -* -********************************************************************/ -void PRINT_ClearScreen(void); -#define PRINT_ClearScreen() LCD_ClearScreen() - -/********************************************************************* -* Function: void PRINT_CursorEnable(bool enable) -* -* Overview: Enables/disables the cursor -* -* PreCondition: None -* -* Input: bool - specifies if the cursor should be on or off -* -* Output: None -* -********************************************************************/ -void PRINT_CursorEnable(bool); -#define PRINT_CursorEnable(enabled) LCD_CursorEnable(enabled) - -#endif //PRINT_LCD_H diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/rtcc.c b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/rtcc.c deleted file mode 100644 index 4c1f7582..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/rtcc.c +++ /dev/null @@ -1,115 +0,0 @@ - -#include -#include "rtcc.h" -#include -#include -#include - -uint8_t BSP_RTCC_DecToBCD (uint8_t value); -uint8_t BSP_RTCC_BCDToDec (uint8_t value); - -void BSP_RTCC_Initialize (BSP_RTCC_DATETIME * value) -{ - // Turn on the secondary oscillator - __builtin_write_OSCCONL(0x02); - - // Set the RTCWREN bit - __builtin_write_RTCWEN(); - - RCFGCALbits.RTCPTR0 = 1; - RCFGCALbits.RTCPTR1 = 1; - - // Set it to the correct time - if (value->bcdFormat) - { - RTCVAL = 0x0000 | value->year; - RTCVAL = ((uint16_t)(value->month) << 8) | value->day; - RTCVAL = ((uint16_t)(value->weekday) << 8) | value->hour; - RTCVAL = ((uint16_t)(value->minute) << 8) | value->second; - } - else - { - // Set (Reserved : year) - RTCVAL = BSP_RTCC_DecToBCD (value->year); - // Set (month : day) - RTCVAL = (BSP_RTCC_DecToBCD (value->month) << 8) | BSP_RTCC_DecToBCD(value->day); - // Set (weekday : hour) - RTCVAL = (BSP_RTCC_DecToBCD (value->weekday) << 8) | BSP_RTCC_DecToBCD(value->hour); - // Set (minute : second) - RTCVAL = (BSP_RTCC_DecToBCD (value->minute) << 8) | BSP_RTCC_DecToBCD(value->second); - } - - // Enable RTCC, clear RTCWREN - RCFGCAL = 0x8000; -} - -void BSP_RTCC_TimeGet (BSP_RTCC_DATETIME * value) -{ - uint16_t registerValue; - bool checkValue; - - RCFGCALbits.RTCPTR0 = 1; - RCFGCALbits.RTCPTR1 = 1; - - checkValue = RCFGCALbits.RTCSYNC; - - registerValue = RTCVAL; - value->year = registerValue & 0xFF; - registerValue = RTCVAL; - value->month = registerValue >> 8; - value->day = registerValue & 0xFF; - registerValue = RTCVAL; - value->weekday = registerValue >> 8; - value->hour = registerValue & 0xFF; - registerValue = RTCVAL; - value->minute = registerValue >> 8; - value->second = registerValue & 0xFF; - - if (checkValue) - { - BSP_RTCC_DATETIME tempValue; - - do - { - memcpy (&tempValue, value, sizeof (BSP_RTCC_DATETIME)); - - RCFGCALbits.RTCPTR0 = 1; - RCFGCALbits.RTCPTR1 = 1; - - value->year = RTCVAL; - registerValue = RTCVAL; - value->month = registerValue >> 8; - value->day = registerValue & 0xFF; - registerValue = RTCVAL; - value->weekday = registerValue >> 8; - value->hour = registerValue & 0xFF; - registerValue = RTCVAL; - value->minute = registerValue >> 8; - value->second = registerValue & 0xFF; - - } while (memcmp (value, &tempValue, sizeof (BSP_RTCC_DATETIME))); - } - - if (!value->bcdFormat) - { - value->year = BSP_RTCC_BCDToDec (value->year); - value->month = BSP_RTCC_BCDToDec (value->month); - value->day = BSP_RTCC_BCDToDec (value->day); - value->weekday = BSP_RTCC_BCDToDec (value->weekday); - value->hour = BSP_RTCC_BCDToDec (value->hour); - value->minute = BSP_RTCC_BCDToDec (value->minute); - value->second = BSP_RTCC_BCDToDec (value->second); - } -} - -// Note : value must be < 100 -uint8_t BSP_RTCC_DecToBCD (uint8_t value) -{ - return (((value / 10)) << 4) | (value % 10); -} - -uint8_t BSP_RTCC_BCDToDec (uint8_t value) -{ - return ((value >> 4) * 10) + (value & 0x0F); -} - diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/rtcc.h b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/rtcc.h deleted file mode 100644 index edec168c..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/rtcc.h +++ /dev/null @@ -1,26 +0,0 @@ - -#include -#include - -typedef struct -{ - bool bcdFormat; - uint8_t year; - uint8_t month; - uint8_t day; - uint8_t weekday; - uint8_t hour; - uint8_t minute; - uint8_t second; -} BSP_RTCC_DATETIME; - -void BSP_RTCC_Initialize (BSP_RTCC_DATETIME * value); -void BSP_RTCC_TimeGet (BSP_RTCC_DATETIME * value); - - - - - - - - diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/timer_1ms.c b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/timer_1ms.c deleted file mode 100644 index 1221c77c..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/timer_1ms.c +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ -#include -#include -#include -#include -#include -#include - -/* Compiler checks and configuration *******************************/ -#ifndef TIMER_MAX_1MS_CLIENTS - #define TIMER_MAX_1MS_CLIENTS 1 -#endif - -/* Definitions *****************************************************/ -#define STOP_TIMER_IN_IDLE_MODE 0x2000 -#define TIMER_SOURCE_INTERNAL 0x0000 -#define TIMER_SOURCE_EXTERNAL 0x0002 -#define TIMER_ON 0x8000 -#define GATED_TIME_DISABLED 0x0000 -#define TIMER_16BIT_MODE 0x0000 - -#define TIMER_PRESCALER_1 0x0000 -#define TIMER_PRESCALER_8 0x0010 -#define TIMER_PRESCALER_64 0x0020 -#define TIMER_PRESCALER_256 0x0030 -#define TIMER_INTERRUPT_PRIORITY 0x0001 -#define TIMER_INTERRUPT_PRIORITY_4 0x0004 - -/* Type Definitions ************************************************/ -typedef struct -{ - - TICK_HANDLER handle ; - uint32_t rate ; - uint32_t count ; -} TICK_REQUEST ; - -/* Variables *******************************************************/ -TICK_REQUEST requests[TIMER_MAX_1MS_CLIENTS] ; -/********************************************************************* - * Function: void TIMER_CancelTick(TICK_HANDLER handle) - * - * Overview: Cancels a tick request. - * - * PreCondition: None - * - * Input: handle - the function that was handling the tick request - * - * Output: None - * - ********************************************************************/ -void TIMER_CancelTick ( TICK_HANDLER handle ) -{ - uint8_t i ; - - for (i = 0 ; i < TIMER_MAX_1MS_CLIENTS ; i++) - { - if (requests[i].handle == handle) - { - requests[i].handle = NULL ; - } - } -} -/********************************************************************* - * Function: bool TIMER_RequestTick(TICK_HANDLER handle, uint32_t rate) - * - * Overview: Requests to receive a periodic event. - * - * PreCondition: None - * - * Input: handle - the function that will be called when the time event occurs - * rate - the number of ticks per event. - * - * Output: bool - true if successful, false if unsuccessful - * - ********************************************************************/ -bool TIMER_RequestTick ( TICK_HANDLER handle , uint32_t rate ) -{ - uint8_t i ; - - for (i = 0 ; i < TIMER_MAX_1MS_CLIENTS ; i++) - { - if (requests[i].handle == NULL) - { - requests[i].handle = handle ; - requests[i].rate = rate ; - requests[i].count = 0 ; - - return true ; - } - } - - return false ; -} -/********************************************************************* - * Function: bool TIMER_SetConfiguration(TIMER_CONFIGURATIONS configuration) - * - * Overview: Initializes the timer. - * - * PreCondition: None - * - * Input: None - * - * Output: bool - true if successful, false if unsuccessful - * - ********************************************************************/ -bool TIMER_SetConfiguration ( TIMER_CONFIGURATIONS configuration ) -{ - switch (configuration) - { - case TIMER_CONFIGURATION_1MS: - memset ( requests , 0 , sizeof (requests ) ) ; - - IPC2bits.T3IP = TIMER_INTERRUPT_PRIORITY ; - IFS0bits.T3IF = 0 ; - - TMR3 = 0 ; - - PR3 = 2000 ; - T3CON = TIMER_ON | - STOP_TIMER_IN_IDLE_MODE | - TIMER_SOURCE_INTERNAL | - GATED_TIME_DISABLED | - TIMER_16BIT_MODE | - TIMER_PRESCALER_8 ; - - IEC0bits.T3IE = 1 ; - - return true ; - - case TIMER_CONFIGURATION_RTCC: - memset ( requests , 0 , sizeof (requests ) ) ; - - IPC0bits.T1IP = TIMER_INTERRUPT_PRIORITY_4 ; - IFS0bits.T1IF = 0 ; - - TMR1 = 0 ; - - PR1 = 0x8000 ; - T1CON = TIMER_ON | - TIMER_SOURCE_EXTERNAL | - GATED_TIME_DISABLED | - TIMER_16BIT_MODE | - TIMER_PRESCALER_1 ; - - IEC0bits.T1IE = 1 ; - - return true ; - - - case TIMER_CONFIGURATION_OFF: - IEC0bits.T3IE = 0 ; - return true ; - } - - return false ; -} -/**************************************************************************** - Function: - void __attribute__((__interrupt__, auto_psv)) _T3Interrupt(void) - - Description: - Timer ISR, used to update application state. If no transfers are pending - new input request is scheduled. - Precondition: - None - - Parameters: - None - - Return Values: - None - - Remarks: - None - ***************************************************************************/ -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _T3Interrupt ( void ) -{ - uint8_t i ; - - for (i = 0 ; i < TIMER_MAX_1MS_CLIENTS ; i++) - { - if (requests[i].handle != NULL) - { - requests[i].count++ ; - - if (requests[i].count == requests[i].rate) - { - requests[i].handle ( ) ; - requests[i].count = 0 ; - } - } - } - - IFS0bits.T3IF = 0 ; -} diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/timer_1ms.h b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/timer_1ms.h deleted file mode 100644 index 8555a560..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/bsp/exp16/dspic33ep512mu810_pim/timer_1ms.h +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************** - Software License Agreement: - - The software supplied herewith by Microchip Technology Incorporated - (the "Company") for its PIC(R) Microcontroller is intended and - supplied to you, the Company's customer, for use solely and - exclusively on Microchip PIC Microcontroller products. The - software is owned by the Company and/or its supplier, and is - protected under applicable copyright laws. All rights are reserved. - Any use in violation of the foregoing restrictions may subject the - user to criminal sanctions under applicable laws, as well as to - civil liability for the breach of the terms and conditions of this - license. - - THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, - WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED - TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, - IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR - CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - *******************************************************************/ - -#include -#include -#include -#include - -#ifndef TIMER_1MS -#define TIMER_1MS - -#define TIMER_TICK_INTERVAL_MICRO_SECONDS 1000 - -/* Type Definitions ***********************************************/ -typedef void (*TICK_HANDLER)(void); - -typedef enum -{ - TIMER_CONFIGURATION_1MS, - TIMER_CONFIGURATION_RTCC, - TIMER_CONFIGURATION_OFF -} TIMER_CONFIGURATIONS; - -/********************************************************************* -* Function: void TIMER_CancelTick(TICK_HANDLER handle) -* -* Overview: Cancels a tick request. -* -* PreCondition: None -* -* Input: handle - the function that was handling the tick request -* -* Output: None -* -********************************************************************/ -void TIMER_CancelTick(TICK_HANDLER handle); - -/********************************************************************* -* Function: bool TIMER_RequestTick(TICK_HANDLER handle, uint32_t rate) -* -* Overview: Requests to receive a periodic event. -* -* PreCondition: None -* -* Input: handle - the function that will be called when the time event occurs -* rate - the number of ticks per event. -* -* Output: bool - true if successful, false if unsuccessful -* -********************************************************************/ -bool TIMER_RequestTick(TICK_HANDLER handle, uint32_t rate); - -/********************************************************************* -* Function: bool TIMER_SetConfiguration(TIMER_CONFIGURATIONS configuration) -* -* Overview: Initializes the timer. -* -* PreCondition: TIMER_CONFIGURATIONS - configuration to run -* -* Input: None -* -* Output: bool - true if successful, false if unsuccessful -* -********************************************************************/ -bool TIMER_SetConfiguration(TIMER_CONFIGURATIONS configuration); - -#endif //TIMER_1MS diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/Makefile-dspic33ep512mu810_pim.mk b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/Makefile-dspic33ep512mu810_pim.mk index 41d95a0b..741fa1cf 100644 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/Makefile-dspic33ep512mu810_pim.mk +++ b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/Makefile-dspic33ep512mu810_pim.mk @@ -57,17 +57,17 @@ OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced -SOURCEFILES_QUOTED_IF_SPACED=../../../MProkaron/Benchmark/test.c ../../../MProkaron/Kernel/kernel.c ../../../MProkaron/Platform/DSPIC/platform_dspic.c ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s ../../../MProkaron/Benchmark/Platform/test_DSPIC33EP512MU810_extra.s +SOURCEFILES_QUOTED_IF_SPACED=../../../MProkaron/Benchmark/test.c ../../../MProkaron/Benchmark/Platform/test_DSPIC33EP512MU810_extra.s ../../../MProkaron/Kernel/kernel.c ../../../MProkaron/Platform/DSPIC/platform_dspic.c ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s # Object Files Quoted if spaced -OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/1372619718/test.o ${OBJECTDIR}/_ext/878830112/kernel.o ${OBJECTDIR}/_ext/320537406/platform_dspic.o ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o -POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/1372619718/test.o.d ${OBJECTDIR}/_ext/878830112/kernel.o.d ${OBJECTDIR}/_ext/320537406/platform_dspic.o.d ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o.d +OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/1372619718/test.o ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o ${OBJECTDIR}/_ext/878830112/kernel.o ${OBJECTDIR}/_ext/320537406/platform_dspic.o ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o +POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/1372619718/test.o.d ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o.d ${OBJECTDIR}/_ext/878830112/kernel.o.d ${OBJECTDIR}/_ext/320537406/platform_dspic.o.d ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d # Object Files -OBJECTFILES=${OBJECTDIR}/_ext/1372619718/test.o ${OBJECTDIR}/_ext/878830112/kernel.o ${OBJECTDIR}/_ext/320537406/platform_dspic.o ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o +OBJECTFILES=${OBJECTDIR}/_ext/1372619718/test.o ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o ${OBJECTDIR}/_ext/878830112/kernel.o ${OBJECTDIR}/_ext/320537406/platform_dspic.o ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o # Source Files -SOURCEFILES=../../../MProkaron/Benchmark/test.c ../../../MProkaron/Kernel/kernel.c ../../../MProkaron/Platform/DSPIC/platform_dspic.c ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s ../../../MProkaron/Benchmark/Platform/test_DSPIC33EP512MU810_extra.s +SOURCEFILES=../../../MProkaron/Benchmark/test.c ../../../MProkaron/Benchmark/Platform/test_DSPIC33EP512MU810_extra.s ../../../MProkaron/Kernel/kernel.c ../../../MProkaron/Platform/DSPIC/platform_dspic.c ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s CFLAGS= @@ -155,13 +155,6 @@ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) -${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o: ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s nbproject/Makefile-${CND_CONF}.mk - @${MKDIR} "${OBJECTDIR}/_ext/320537406" - @${RM} ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d - @${RM} ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o - ${MP_CC} $(MP_EXTRA_AS_PRE) ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s -o ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o -c -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_dspic33ep512mu810_pim=$(CND_CONF) -no-legacy-libc -specs=specs.txt -I"../../../MProkaron/Include" -Wa,-MD,"${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d",--defsym=__MPLAB_BUILD=1,--defsym=__ICD2RAM=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_PK3=1,-g,--no-relax$(MP_EXTRA_AS_POST) - @${FIXDEPS} "${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ - ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o: ../../../MProkaron/Benchmark/Platform/test_DSPIC33EP512MU810_extra.s nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1850200776" @${RM} ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o.d @@ -169,14 +162,14 @@ ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o: ../../../MProkaron/ ${MP_CC} $(MP_EXTRA_AS_PRE) ../../../MProkaron/Benchmark/Platform/test_DSPIC33EP512MU810_extra.s -o ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o -c -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_dspic33ep512mu810_pim=$(CND_CONF) -no-legacy-libc -specs=specs.txt -I"../../../MProkaron/Include" -Wa,-MD,"${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o.d",--defsym=__MPLAB_BUILD=1,--defsym=__ICD2RAM=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_PK3=1,-g,--no-relax$(MP_EXTRA_AS_POST) @${FIXDEPS} "${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ -else ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o: ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/320537406" @${RM} ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d @${RM} ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o - ${MP_CC} $(MP_EXTRA_AS_PRE) ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s -o ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o -c -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_dspic33ep512mu810_pim=$(CND_CONF) -no-legacy-libc -specs=specs.txt -I"../../../MProkaron/Include" -Wa,-MD,"${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d",--defsym=__MPLAB_BUILD=1,-g,--no-relax$(MP_EXTRA_AS_POST) + ${MP_CC} $(MP_EXTRA_AS_PRE) ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s -o ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o -c -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_dspic33ep512mu810_pim=$(CND_CONF) -no-legacy-libc -specs=specs.txt -I"../../../MProkaron/Include" -Wa,-MD,"${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d",--defsym=__MPLAB_BUILD=1,--defsym=__ICD2RAM=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_PK3=1,-g,--no-relax$(MP_EXTRA_AS_POST) @${FIXDEPS} "${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ +else ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o: ../../../MProkaron/Benchmark/Platform/test_DSPIC33EP512MU810_extra.s nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1850200776" @${RM} ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o.d @@ -184,6 +177,13 @@ ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o: ../../../MProkaron/ ${MP_CC} $(MP_EXTRA_AS_PRE) ../../../MProkaron/Benchmark/Platform/test_DSPIC33EP512MU810_extra.s -o ${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o -c -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_dspic33ep512mu810_pim=$(CND_CONF) -no-legacy-libc -specs=specs.txt -I"../../../MProkaron/Include" -Wa,-MD,"${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o.d",--defsym=__MPLAB_BUILD=1,-g,--no-relax$(MP_EXTRA_AS_POST) @${FIXDEPS} "${OBJECTDIR}/_ext/1850200776/test_DSPIC33EP512MU810_extra.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ +${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o: ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/_ext/320537406" + @${RM} ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d + @${RM} ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o + ${MP_CC} $(MP_EXTRA_AS_PRE) ../../../MProkaron/Platform/DSPIC/platform_dspic_asm.s -o ${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o -c -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_dspic33ep512mu810_pim=$(CND_CONF) -no-legacy-libc -specs=specs.txt -I"../../../MProkaron/Include" -Wa,-MD,"${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d",--defsym=__MPLAB_BUILD=1,-g,--no-relax$(MP_EXTRA_AS_POST) + @${FIXDEPS} "${OBJECTDIR}/_ext/320537406/platform_dspic_asm.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ + endif # ------------------------------------------------------------------------------------ diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/Makefile-genesis.properties b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/Makefile-genesis.properties index 4c980ec9..458b7379 100644 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/Makefile-genesis.properties +++ b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/Makefile-genesis.properties @@ -1,8 +1,8 @@ # -#Tue Jun 26 23:05:15 EDT 2018 +#Tue Jun 26 23:11:07 EDT 2018 dspic33ep512mu810_pim.languagetoolchain.dir=D\:\\Program_Files_x86\\Microchip\\xc16\\v1.35\\bin dspic33ep512mu810_pim.languagetoolchain.version=1.35 -configurations-xml=29fbba57fd1b4b9341bdfb377559b143 +configurations-xml=a46daff09761c0504d46db897128cf15 com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=24107a0c2bb6fb23e8f1a7c080ca8f8d host.platform=windows conf.ids=dspic33ep512mu810_pim diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/configurations.xml b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/configurations.xml index 11b4d6ce..d2c1589b 100644 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/configurations.xml +++ b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/nbproject/configurations.xml @@ -123,6 +123,8 @@ + + diff --git a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/system_config/exp16/dspic33ep512mu810_pim/system.c b/Project/MPLAB-DSPIC33EP512MU810/RMP.X/system_config/exp16/dspic33ep512mu810_pim/system.c deleted file mode 100644 index a01fc83c..00000000 --- a/Project/MPLAB-DSPIC33EP512MU810/RMP.X/system_config/exp16/dspic33ep512mu810_pim/system.c +++ /dev/null @@ -1,397 +0,0 @@ -/******************************************************************************* - System Initialization File - - File Name: - sys_init.c - - Summary: - System Initialization. - - Description: - This file contains source code necessary to initialize the system. - *******************************************************************************/ - -// DOM-IGNORE-BEGIN -/******************************************************************************* -Copyright (c) 2013 released Microchip Technology Inc. All rights reserved. - -Microchip licenses to you the right to use, modify, copy and distribute -Software only when embedded on a Microchip microcontroller or digital signal -controller that is integrated into your product or third party product -(pursuant to the sublicense terms in the accompanying license agreement). - -You should refer to the license agreement accompanying this Software for -additional information regarding your rights and obligations. - -SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, -EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF -MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. -IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER -CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR -OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES -INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR -CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF -SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES -(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. - *******************************************************************************/ -// DOM-IGNORE-END - -// **************************************************************************** -// **************************************************************************** -// Section: Configuration Bits -// **************************************************************************** -// **************************************************************************** -#include -#include "app.h" - -// FGS -#pragma config GWRP = OFF // General Segment Write-Protect bit (General Segment may be written) -#pragma config GSS = OFF // General Segment Code-Protect bit (General Segment Code protect is disabled) -#pragma config GSSK = OFF // General Segment Key bits (General Segment Write Protection and Code Protection is Disabled) - -// FOSCSEL -#pragma config FNOSC = FRC // Initial Oscillator Source Selection Bits (Internal Fast RC (FRC)) -#pragma config IESO = ON // Two-speed Oscillator Start-up Enable bit (Start up device with FRC, then switch to user-selected oscillator source) - -// FOSC -#pragma config POSCMD = XT // Primary Oscillator Mode Select bits (XT Crystal Oscillator Mode) -#pragma config OSCIOFNC = OFF // OSC2 Pin Function bit (OSC2 is clock output) -#pragma config IOL1WAY = OFF // Peripheral pin select configuration (Allow multiple reconfigurations) -#pragma config FCKSM = CSECMD // Clock Switching Mode bits (Clock switching is enabled,Fail-safe Clock Monitor is disabled) - -// FWDT -#pragma config WDTPOST = PS32768 // Watchdog Timer Postscaler Bits (1:32,768) -#pragma config WDTPRE = PR128 // Watchdog Timer Prescaler bit (1:128) -#pragma config PLLKEN = ON // PLL Lock Wait Enable bit (Clock switch to PLL source will wait until the PLL lock signal is valid.) -#pragma config WINDIS = OFF // Watchdog Timer Window Enable bit (Watchdog Timer in Non-Window mode) -#pragma config FWDTEN = OFF // Watchdog Timer Enable bit (Watchdog timer enabled/disabled by user software) - -// FPOR -#pragma config FPWRT = PWR128 // Power-on Reset Timer Value Select bits (128ms) -#pragma config BOREN = ON // Brown-out Reset (BOR) Detection Enable bit (BOR is enabled) -#pragma config ALTI2C1 = ON // Alternate I2C pins for I2C1 (ASDA1/ASCK1 pins are selected as the I/O pins for I2C1) -#pragma config ALTI2C2 = ON // Alternate I2C pins for I2C2 (ASDA2/ASCK2 pins are selected as the I/O pins for I2C2) - -// FICD -#pragma config ICS = PGD1 // ICD Communication Channel Select bits (Communicate on PGEC1 and PGED1) -#pragma config RSTPRI = PF // Reset Target Vector Select bit (Device will obtain reset instruction from Primary flash) -#pragma config JTAGEN = OFF // JTAG Enable bit (JTAG is disabled) - -// FAS -#pragma config AWRP = OFF // Auxiliary Segment Write-protect bit (Auxiliary program memory is not write-protected) -#pragma config APL = OFF // Auxiliary Segment Code-protect bit (Aux Flash Code protect is disabled) -#pragma config APLK = OFF // Auxiliary Segment Key bits (Aux Flash Write Protection and Code Protection is Disabled) - - -// **************************************************************************** -// **************************************************************************** -// Section: File Scope Functions -// **************************************************************************** -// **************************************************************************** - -void SOSC_Configuration ( void ) ; -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _OscillatorFail ( void ) ; -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _AddressError ( void ) ; -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _StackError ( void ) ; -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _MathError ( void ) ; - -// **************************************************************************** -// **************************************************************************** -// Section: System Initialization -// **************************************************************************** -// **************************************************************************** -/******************************************************************************* - Function: - void SYS_Initialize ( void ) - - Summary: - Initializes the Explorer 16 board peripherals - - Description: - This routine initializes the Explorer 16 board peripherals for the demo. - In a bare-metal environment (where no OS is supported), this routine should - be called almost immediately after entering the "main" routine. - - Precondition: - The C-language run-time environment and stack must have been initialized. - - Parameters: - None. - - Returns: - None. - - Example: - - SYS_INT_Initialize(NULL); - - - Remarks: - Basic System Initialization Sequence: - - 1. Initilize minimal board services and processor-specific items - (enough to use the board to initialize drivers and services) - 2. Initialize all supported system services - 3. Initialize all supported modules - (libraries, drivers, middleware, and application-level modules) - 4. Initialize the main (static) application, if present. - - The order in which services and modules are initialized and started may be - important. - - */ - -void SYS_Initialize ( void ) -{ - /* Enable LEDs*/ - LED_Enable ( LED_D9 ) ; - LED_Enable ( LED_D10 ) ; - - /* Turn On LEDs*/ - LED_On ( LED_D9 ) ; - LED_On ( LED_D10 ) ; - - /* Enable Switch S3*/ - BUTTON_Enable ( BUTTON_S3 ) ; - - /* Enable ADC to the Potentiometer channel */ - - ADC_ChannelEnable ( ADC_CHANNEL_POTENTIOMETER ) ; - - - /* Initialize LCD*/ - PRINT_SetConfiguration ( PRINT_CONFIGURATION_LCD ) ; - - /* Configure Secondary Ocillator for Timer 1 to work as RTC counter*/ - SOSC_Configuration ( ) ; -} - -void SOSC_Configuration ( void ) -{ - char a , b , c , *p ; - - a = 2 ; - b = 0x46 ; - c = 0x57 ; - p = (char *) &OSCCON ; - - asm volatile ("mov.b %1,[%0] \n" - "mov.b %2,[%0] \n" - "mov.b %3,[%0] \n" : /* no outputs */ : "r"( p ) , "r"( b ) , "r"( c ) , - "r"( a ) ) ; -} - -// ***************************************************************************** -// ***************************************************************************** -// Section: Interrupt Handlers -// ***************************************************************************** -// ***************************************************************************** -/******************************************************************************* - - Function: - void __attribute__((__interrupt__)) _AD1Interrupt( void )) - - Summary: - ISR routine for the ADC1 Interrupt. - - Description: - This is the raw Interrupt Service Routine (ISR) for the ADC 1 interrupt. - This routine calls the ADC's interrupt routine to service the - interrupt. - - Precondition: - The ADC peripheral must have been initialized for ADC 1. - - Parameters: - None. - - Returns: - None. - - Remarks: - This routine must not be "called" as a C-language function is called. It - is "vectored" to by the processor when the interrupt occurs. - */ - -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _AD1Interrupt ( void ) -{ - static int count = 0 ; - - /* Simple "I am here" indicator */ - if ( count++ == 2000 ) - { - LED_Toggle ( LED_D9 ) ; - count = 0 ; - } - - /* Save the Potentiometer data */ - appData.temp1 = ADC1BUF0 ; - - /* set flag to update LCD */ - appData.adc_lcd_update = 1 ; - - /* reset ADC interrupt flag */ - IFS0bits.AD1IF = 0 ; -} -/******************************************************************************* - Function: - void __attribute__((__interrupt__)) _T1Interrupt( void )) - - Summary: - ISR routine for the T1 Interrupt. - - Description: - This is the raw Interrupt Service Routine (ISR) for the Timer 3 interrupt. - This routine calls the Timer1's interrupt routine to service the - interrupt. - - Precondition: - The Timer peripheral must have been initialized for Timer 3. - - Parameters: - None. - - Returns: - None. - - Remarks: - This routine must not be "called" as a C-language function is called. It - is "vectored" to by the processor when the interrupt occurs. - */ -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _T1Interrupt ( void ) -{ - /* update seconds */ - if ( appData.seconds < 59 ) - { - appData.seconds++ ; - } - /* update minutes */ - else - { - appData.seconds = 0x00 ; - if ( appData.minutes < 59 ) - { - appData.minutes++ ; - } - /* update hours */ - else - { - appData.minutes = 0x00 ; - if ( appData.hours < 23 ) - { - appData.hours ++ ; - } - else - { - appData.hours = 0x00 ; - } - } - } - - /* set flag to update LCD */ - appData.rtc_lcd_update = 1 ; - - /* Toggle LED at 1 Hz rate */ - LED_Toggle ( LED_D10 ) ; - - /* reset Timer 1 interrupt flag */ - IFS0bits.T1IF = 0 ; -} - -// ***************************************************************************** -// ***************************************************************************** -// Section: Primary Exception Vector handlers -// ***************************************************************************** -// ***************************************************************************** - -// ***************************************************************************** -/* void __attribute__((__interrupt__,auto_psv)) _OscillatorFail(void) - - Summary: - Provides the required exception vector handlers for Oscillator trap - - Description: - This routine is used if INTCON2bits.ALTIVT = 0 and it handles the oscillator - trap. - - Remarks: - All trap service routines in this file simply ensure that device - continuously executes code within the trap service routine. Users - may modify the basic framework provided here to suit to the needs - of their application. - */ - -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _OscillatorFail ( void ) -{ - INTCON1bits.OSCFAIL = 0 ; //Clear the trap flag - while (1) ; -} - -// ***************************************************************************** -/* void __attribute__((__interrupt__,auto_psv)) _AddressError(void) - - Summary: - Provides the required exception vector handlers for Address Error trap - - Description: - This routine is used if INTCON2bits.ALTIVT = 0 and it handles the address - error trap. - - Remarks: - All trap service routines in this file simply ensure that device - continuously executes code within the trap service routine. Users - may modify the basic framework provided here to suit to the needs - of their application. - */ - -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _AddressError ( void ) -{ - INTCON1bits.ADDRERR = 0 ; //Clear the trap flag - while (1) ; -} - -// ***************************************************************************** -/* void __attribute__((__interrupt__,auto_psv)) _StackError(void)) - - Summary: - Provides the required exception vector handlers for Stack Error trap - - Description: - This routine is used if INTCON2bits.ALTIVT = 0 and it handles the stack - error trap. - - Remarks: - All trap service routines in this file simply ensure that device - continuously executes code within the trap service routine. Users - may modify the basic framework provided here to suit to the needs - of their application. - */ - -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _StackError ( void ) -{ - INTCON1bits.STKERR = 0 ; //Clear the trap flag - while (1) ; -} - -// ***************************************************************************** -/* void __attribute__((__interrupt__,auto_psv)) _MathError(void)) - - Summary: - Provides the required exception vector handlers for Math Error trap - - Description: - This routine is used if INTCON2bits.ALTIVT = 0 and it handles the math - error trap. - - Remarks: - All trap service routines in this file simply ensure that device - continuously executes code within the trap service routine. Users - may modify the basic framework provided here to suit to the needs - of their application. - */ - -void __attribute__ ( ( __interrupt__ , auto_psv ) ) _MathError ( void ) -{ - INTCON1bits.MATHERR = 0 ; //Clear the trap flag - while (1) ; -}