281 lines
14 KiB
C
281 lines
14 KiB
C
/**
|
|
@Generated Pin Manager Header File
|
|
|
|
@Company:
|
|
Microchip Technology Inc.
|
|
|
|
@File Name:
|
|
pin_manager.h
|
|
|
|
@Summary:
|
|
This is the Pin Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs
|
|
|
|
@Description
|
|
This header file provides APIs for driver for .
|
|
Generation Information :
|
|
Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.81.8
|
|
Device : PIC18F26K83
|
|
Driver Version : 2.11
|
|
The generated drivers are tested against the following:
|
|
Compiler : XC8 2.36 and above
|
|
MPLAB : MPLAB X 6.00
|
|
*/
|
|
|
|
/*
|
|
(c) 2018 Microchip Technology Inc. and its subsidiaries.
|
|
|
|
Subject to your compliance with these terms, you may use Microchip software and any
|
|
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
|
|
license terms applicable to your use of third party software (including open source software) that
|
|
may accompany Microchip software.
|
|
|
|
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
|
|
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
|
|
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
|
|
FOR A PARTICULAR PURPOSE.
|
|
|
|
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
|
|
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
|
|
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
|
|
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
|
|
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
|
|
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
|
|
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
|
|
SOFTWARE.
|
|
*/
|
|
|
|
#ifndef PIN_MANAGER_H
|
|
#define PIN_MANAGER_H
|
|
|
|
/**
|
|
Section: Included Files
|
|
*/
|
|
|
|
#include <xc.h>
|
|
|
|
#define INPUT 1
|
|
#define OUTPUT 0
|
|
|
|
#define HIGH 1
|
|
#define LOW 0
|
|
|
|
#define ANALOG 1
|
|
#define DIGITAL 0
|
|
|
|
#define PULL_UP_ENABLED 1
|
|
#define PULL_UP_DISABLED 0
|
|
|
|
// get/set OUTPUT1 aliases
|
|
#define OUTPUT1_TRIS TRISAbits.TRISA0
|
|
#define OUTPUT1_LAT LATAbits.LATA0
|
|
#define OUTPUT1_PORT PORTAbits.RA0
|
|
#define OUTPUT1_WPU WPUAbits.WPUA0
|
|
#define OUTPUT1_OD ODCONAbits.ODCA0
|
|
#define OUTPUT1_ANS ANSELAbits.ANSELA0
|
|
#define OUTPUT1_SetHigh() do { LATAbits.LATA0 = 1; } while(0)
|
|
#define OUTPUT1_SetLow() do { LATAbits.LATA0 = 0; } while(0)
|
|
#define OUTPUT1_Toggle() do { LATAbits.LATA0 = ~LATAbits.LATA0; } while(0)
|
|
#define OUTPUT1_GetValue() PORTAbits.RA0
|
|
#define OUTPUT1_SetDigitalInput() do { TRISAbits.TRISA0 = 1; } while(0)
|
|
#define OUTPUT1_SetDigitalOutput() do { TRISAbits.TRISA0 = 0; } while(0)
|
|
#define OUTPUT1_SetPullup() do { WPUAbits.WPUA0 = 1; } while(0)
|
|
#define OUTPUT1_ResetPullup() do { WPUAbits.WPUA0 = 0; } while(0)
|
|
#define OUTPUT1_SetPushPull() do { ODCONAbits.ODCA0 = 0; } while(0)
|
|
#define OUTPUT1_SetOpenDrain() do { ODCONAbits.ODCA0 = 1; } while(0)
|
|
#define OUTPUT1_SetAnalogMode() do { ANSELAbits.ANSELA0 = 1; } while(0)
|
|
#define OUTPUT1_SetDigitalMode() do { ANSELAbits.ANSELA0 = 0; } while(0)
|
|
|
|
// get/set OUTPUT2 aliases
|
|
#define OUTPUT2_TRIS TRISAbits.TRISA1
|
|
#define OUTPUT2_LAT LATAbits.LATA1
|
|
#define OUTPUT2_PORT PORTAbits.RA1
|
|
#define OUTPUT2_WPU WPUAbits.WPUA1
|
|
#define OUTPUT2_OD ODCONAbits.ODCA1
|
|
#define OUTPUT2_ANS ANSELAbits.ANSELA1
|
|
#define OUTPUT2_SetHigh() do { LATAbits.LATA1 = 1; } while(0)
|
|
#define OUTPUT2_SetLow() do { LATAbits.LATA1 = 0; } while(0)
|
|
#define OUTPUT2_Toggle() do { LATAbits.LATA1 = ~LATAbits.LATA1; } while(0)
|
|
#define OUTPUT2_GetValue() PORTAbits.RA1
|
|
#define OUTPUT2_SetDigitalInput() do { TRISAbits.TRISA1 = 1; } while(0)
|
|
#define OUTPUT2_SetDigitalOutput() do { TRISAbits.TRISA1 = 0; } while(0)
|
|
#define OUTPUT2_SetPullup() do { WPUAbits.WPUA1 = 1; } while(0)
|
|
#define OUTPUT2_ResetPullup() do { WPUAbits.WPUA1 = 0; } while(0)
|
|
#define OUTPUT2_SetPushPull() do { ODCONAbits.ODCA1 = 0; } while(0)
|
|
#define OUTPUT2_SetOpenDrain() do { ODCONAbits.ODCA1 = 1; } while(0)
|
|
#define OUTPUT2_SetAnalogMode() do { ANSELAbits.ANSELA1 = 1; } while(0)
|
|
#define OUTPUT2_SetDigitalMode() do { ANSELAbits.ANSELA1 = 0; } while(0)
|
|
|
|
// get/set OUTPUT3 aliases
|
|
#define OUTPUT3_TRIS TRISAbits.TRISA2
|
|
#define OUTPUT3_LAT LATAbits.LATA2
|
|
#define OUTPUT3_PORT PORTAbits.RA2
|
|
#define OUTPUT3_WPU WPUAbits.WPUA2
|
|
#define OUTPUT3_OD ODCONAbits.ODCA2
|
|
#define OUTPUT3_ANS ANSELAbits.ANSELA2
|
|
#define OUTPUT3_SetHigh() do { LATAbits.LATA2 = 1; } while(0)
|
|
#define OUTPUT3_SetLow() do { LATAbits.LATA2 = 0; } while(0)
|
|
#define OUTPUT3_Toggle() do { LATAbits.LATA2 = ~LATAbits.LATA2; } while(0)
|
|
#define OUTPUT3_GetValue() PORTAbits.RA2
|
|
#define OUTPUT3_SetDigitalInput() do { TRISAbits.TRISA2 = 1; } while(0)
|
|
#define OUTPUT3_SetDigitalOutput() do { TRISAbits.TRISA2 = 0; } while(0)
|
|
#define OUTPUT3_SetPullup() do { WPUAbits.WPUA2 = 1; } while(0)
|
|
#define OUTPUT3_ResetPullup() do { WPUAbits.WPUA2 = 0; } while(0)
|
|
#define OUTPUT3_SetPushPull() do { ODCONAbits.ODCA2 = 0; } while(0)
|
|
#define OUTPUT3_SetOpenDrain() do { ODCONAbits.ODCA2 = 1; } while(0)
|
|
#define OUTPUT3_SetAnalogMode() do { ANSELAbits.ANSELA2 = 1; } while(0)
|
|
#define OUTPUT3_SetDigitalMode() do { ANSELAbits.ANSELA2 = 0; } while(0)
|
|
|
|
// get/set OUTPUT4 aliases
|
|
#define OUTPUT4_TRIS TRISAbits.TRISA3
|
|
#define OUTPUT4_LAT LATAbits.LATA3
|
|
#define OUTPUT4_PORT PORTAbits.RA3
|
|
#define OUTPUT4_WPU WPUAbits.WPUA3
|
|
#define OUTPUT4_OD ODCONAbits.ODCA3
|
|
#define OUTPUT4_ANS ANSELAbits.ANSELA3
|
|
#define OUTPUT4_SetHigh() do { LATAbits.LATA3 = 1; } while(0)
|
|
#define OUTPUT4_SetLow() do { LATAbits.LATA3 = 0; } while(0)
|
|
#define OUTPUT4_Toggle() do { LATAbits.LATA3 = ~LATAbits.LATA3; } while(0)
|
|
#define OUTPUT4_GetValue() PORTAbits.RA3
|
|
#define OUTPUT4_SetDigitalInput() do { TRISAbits.TRISA3 = 1; } while(0)
|
|
#define OUTPUT4_SetDigitalOutput() do { TRISAbits.TRISA3 = 0; } while(0)
|
|
#define OUTPUT4_SetPullup() do { WPUAbits.WPUA3 = 1; } while(0)
|
|
#define OUTPUT4_ResetPullup() do { WPUAbits.WPUA3 = 0; } while(0)
|
|
#define OUTPUT4_SetPushPull() do { ODCONAbits.ODCA3 = 0; } while(0)
|
|
#define OUTPUT4_SetOpenDrain() do { ODCONAbits.ODCA3 = 1; } while(0)
|
|
#define OUTPUT4_SetAnalogMode() do { ANSELAbits.ANSELA3 = 1; } while(0)
|
|
#define OUTPUT4_SetDigitalMode() do { ANSELAbits.ANSELA3 = 0; } while(0)
|
|
|
|
// get/set OUTPUT5 aliases
|
|
#define OUTPUT5_TRIS TRISAbits.TRISA4
|
|
#define OUTPUT5_LAT LATAbits.LATA4
|
|
#define OUTPUT5_PORT PORTAbits.RA4
|
|
#define OUTPUT5_WPU WPUAbits.WPUA4
|
|
#define OUTPUT5_OD ODCONAbits.ODCA4
|
|
#define OUTPUT5_ANS ANSELAbits.ANSELA4
|
|
#define OUTPUT5_SetHigh() do { LATAbits.LATA4 = 1; } while(0)
|
|
#define OUTPUT5_SetLow() do { LATAbits.LATA4 = 0; } while(0)
|
|
#define OUTPUT5_Toggle() do { LATAbits.LATA4 = ~LATAbits.LATA4; } while(0)
|
|
#define OUTPUT5_GetValue() PORTAbits.RA4
|
|
#define OUTPUT5_SetDigitalInput() do { TRISAbits.TRISA4 = 1; } while(0)
|
|
#define OUTPUT5_SetDigitalOutput() do { TRISAbits.TRISA4 = 0; } while(0)
|
|
#define OUTPUT5_SetPullup() do { WPUAbits.WPUA4 = 1; } while(0)
|
|
#define OUTPUT5_ResetPullup() do { WPUAbits.WPUA4 = 0; } while(0)
|
|
#define OUTPUT5_SetPushPull() do { ODCONAbits.ODCA4 = 0; } while(0)
|
|
#define OUTPUT5_SetOpenDrain() do { ODCONAbits.ODCA4 = 1; } while(0)
|
|
#define OUTPUT5_SetAnalogMode() do { ANSELAbits.ANSELA4 = 1; } while(0)
|
|
#define OUTPUT5_SetDigitalMode() do { ANSELAbits.ANSELA4 = 0; } while(0)
|
|
|
|
// get/set OUTPUT6 aliases
|
|
#define OUTPUT6_TRIS TRISAbits.TRISA5
|
|
#define OUTPUT6_LAT LATAbits.LATA5
|
|
#define OUTPUT6_PORT PORTAbits.RA5
|
|
#define OUTPUT6_WPU WPUAbits.WPUA5
|
|
#define OUTPUT6_OD ODCONAbits.ODCA5
|
|
#define OUTPUT6_ANS ANSELAbits.ANSELA5
|
|
#define OUTPUT6_SetHigh() do { LATAbits.LATA5 = 1; } while(0)
|
|
#define OUTPUT6_SetLow() do { LATAbits.LATA5 = 0; } while(0)
|
|
#define OUTPUT6_Toggle() do { LATAbits.LATA5 = ~LATAbits.LATA5; } while(0)
|
|
#define OUTPUT6_GetValue() PORTAbits.RA5
|
|
#define OUTPUT6_SetDigitalInput() do { TRISAbits.TRISA5 = 1; } while(0)
|
|
#define OUTPUT6_SetDigitalOutput() do { TRISAbits.TRISA5 = 0; } while(0)
|
|
#define OUTPUT6_SetPullup() do { WPUAbits.WPUA5 = 1; } while(0)
|
|
#define OUTPUT6_ResetPullup() do { WPUAbits.WPUA5 = 0; } while(0)
|
|
#define OUTPUT6_SetPushPull() do { ODCONAbits.ODCA5 = 0; } while(0)
|
|
#define OUTPUT6_SetOpenDrain() do { ODCONAbits.ODCA5 = 1; } while(0)
|
|
#define OUTPUT6_SetAnalogMode() do { ANSELAbits.ANSELA5 = 1; } while(0)
|
|
#define OUTPUT6_SetDigitalMode() do { ANSELAbits.ANSELA5 = 0; } while(0)
|
|
|
|
// get/set OUTPUT7 aliases
|
|
#define OUTPUT7_TRIS TRISAbits.TRISA6
|
|
#define OUTPUT7_LAT LATAbits.LATA6
|
|
#define OUTPUT7_PORT PORTAbits.RA6
|
|
#define OUTPUT7_WPU WPUAbits.WPUA6
|
|
#define OUTPUT7_OD ODCONAbits.ODCA6
|
|
#define OUTPUT7_ANS ANSELAbits.ANSELA6
|
|
#define OUTPUT7_SetHigh() do { LATAbits.LATA6 = 1; } while(0)
|
|
#define OUTPUT7_SetLow() do { LATAbits.LATA6 = 0; } while(0)
|
|
#define OUTPUT7_Toggle() do { LATAbits.LATA6 = ~LATAbits.LATA6; } while(0)
|
|
#define OUTPUT7_GetValue() PORTAbits.RA6
|
|
#define OUTPUT7_SetDigitalInput() do { TRISAbits.TRISA6 = 1; } while(0)
|
|
#define OUTPUT7_SetDigitalOutput() do { TRISAbits.TRISA6 = 0; } while(0)
|
|
#define OUTPUT7_SetPullup() do { WPUAbits.WPUA6 = 1; } while(0)
|
|
#define OUTPUT7_ResetPullup() do { WPUAbits.WPUA6 = 0; } while(0)
|
|
#define OUTPUT7_SetPushPull() do { ODCONAbits.ODCA6 = 0; } while(0)
|
|
#define OUTPUT7_SetOpenDrain() do { ODCONAbits.ODCA6 = 1; } while(0)
|
|
#define OUTPUT7_SetAnalogMode() do { ANSELAbits.ANSELA6 = 1; } while(0)
|
|
#define OUTPUT7_SetDigitalMode() do { ANSELAbits.ANSELA6 = 0; } while(0)
|
|
|
|
// get/set OUTPUT8 aliases
|
|
#define OUTPUT8_TRIS TRISAbits.TRISA7
|
|
#define OUTPUT8_LAT LATAbits.LATA7
|
|
#define OUTPUT8_PORT PORTAbits.RA7
|
|
#define OUTPUT8_WPU WPUAbits.WPUA7
|
|
#define OUTPUT8_OD ODCONAbits.ODCA7
|
|
#define OUTPUT8_ANS ANSELAbits.ANSELA7
|
|
#define OUTPUT8_SetHigh() do { LATAbits.LATA7 = 1; } while(0)
|
|
#define OUTPUT8_SetLow() do { LATAbits.LATA7 = 0; } while(0)
|
|
#define OUTPUT8_Toggle() do { LATAbits.LATA7 = ~LATAbits.LATA7; } while(0)
|
|
#define OUTPUT8_GetValue() PORTAbits.RA7
|
|
#define OUTPUT8_SetDigitalInput() do { TRISAbits.TRISA7 = 1; } while(0)
|
|
#define OUTPUT8_SetDigitalOutput() do { TRISAbits.TRISA7 = 0; } while(0)
|
|
#define OUTPUT8_SetPullup() do { WPUAbits.WPUA7 = 1; } while(0)
|
|
#define OUTPUT8_ResetPullup() do { WPUAbits.WPUA7 = 0; } while(0)
|
|
#define OUTPUT8_SetPushPull() do { ODCONAbits.ODCA7 = 0; } while(0)
|
|
#define OUTPUT8_SetOpenDrain() do { ODCONAbits.ODCA7 = 1; } while(0)
|
|
#define OUTPUT8_SetAnalogMode() do { ANSELAbits.ANSELA7 = 1; } while(0)
|
|
#define OUTPUT8_SetDigitalMode() do { ANSELAbits.ANSELA7 = 0; } while(0)
|
|
|
|
// get/set RB3 procedures
|
|
#define RB3_SetHigh() do { LATBbits.LATB3 = 1; } while(0)
|
|
#define RB3_SetLow() do { LATBbits.LATB3 = 0; } while(0)
|
|
#define RB3_Toggle() do { LATBbits.LATB3 = ~LATBbits.LATB3; } while(0)
|
|
#define RB3_GetValue() PORTBbits.RB3
|
|
#define RB3_SetDigitalInput() do { TRISBbits.TRISB3 = 1; } while(0)
|
|
#define RB3_SetDigitalOutput() do { TRISBbits.TRISB3 = 0; } while(0)
|
|
#define RB3_SetPullup() do { WPUBbits.WPUB3 = 1; } while(0)
|
|
#define RB3_ResetPullup() do { WPUBbits.WPUB3 = 0; } while(0)
|
|
#define RB3_SetAnalogMode() do { ANSELBbits.ANSELB3 = 1; } while(0)
|
|
#define RB3_SetDigitalMode() do { ANSELBbits.ANSELB3 = 0; } while(0)
|
|
|
|
// get/set RB4 procedures
|
|
#define RB4_SetHigh() do { LATBbits.LATB4 = 1; } while(0)
|
|
#define RB4_SetLow() do { LATBbits.LATB4 = 0; } while(0)
|
|
#define RB4_Toggle() do { LATBbits.LATB4 = ~LATBbits.LATB4; } while(0)
|
|
#define RB4_GetValue() PORTBbits.RB4
|
|
#define RB4_SetDigitalInput() do { TRISBbits.TRISB4 = 1; } while(0)
|
|
#define RB4_SetDigitalOutput() do { TRISBbits.TRISB4 = 0; } while(0)
|
|
#define RB4_SetPullup() do { WPUBbits.WPUB4 = 1; } while(0)
|
|
#define RB4_ResetPullup() do { WPUBbits.WPUB4 = 0; } while(0)
|
|
#define RB4_SetAnalogMode() do { ANSELBbits.ANSELB4 = 1; } while(0)
|
|
#define RB4_SetDigitalMode() do { ANSELBbits.ANSELB4 = 0; } while(0)
|
|
|
|
/**
|
|
@Param
|
|
none
|
|
@Returns
|
|
none
|
|
@Description
|
|
GPIO and peripheral I/O initialization
|
|
@Example
|
|
PIN_MANAGER_Initialize();
|
|
*/
|
|
void PIN_MANAGER_Initialize (void);
|
|
|
|
/**
|
|
* @Param
|
|
none
|
|
* @Returns
|
|
none
|
|
* @Description
|
|
Interrupt on Change Handling routine
|
|
* @Example
|
|
PIN_MANAGER_IOC();
|
|
*/
|
|
void PIN_MANAGER_IOC(void);
|
|
|
|
|
|
|
|
#endif // PIN_MANAGER_H
|
|
/**
|
|
End of File
|
|
*/ |