/***************************************************************************** * Copyright (C) 2008 * ProbeStar Telematics, LLC * All Rights Reserved. Proprietary and Confidential. *============================================================================ * PIC Port B *---------------------------------------------------------------------------- * Int Pin 0 Interrupt * Int Pin 1-2 Interrupt * Int Pin 4-7 Change detect *****************************************************************************/ /* prevent multiple inclusions */ #ifndef _PORTB_H_ #define _PORTB_H_ /***************************************************************************** * includes *****************************************************************************/ // this is application specific #include "system.h" #include "types.h" /***************************************************************************** * defines *****************************************************************************/ /***************************************************************************** * macros *****************************************************************************/ // INT0 #ifdef RB0_PIN #define PortB0Clr() g_bRb0Flag=0 #define PortB0Set() g_bRb0Flag=1 #define PortB0Get() g_bRb0Flag #define PortB0Clear() g_wRb0Count0=0 #define PortB0Count() g_wRb0Count0 #define PortB0Read() g_stCount0.dw // timer #1 reading #endif // INT0-2 #ifdef _PIC18 #ifdef RB1_PIN #define PortB1Clr() g_bRb1Flag=0 #define PortB1Set() g_bRb1Flag=1 #define PortB1Get() g_bRb1Flag #define PortB1Clear() g_wRb1Count=0 #define PortB1Count() g_wRb1Count #endif #ifdef RB2_PIN #define PortB2Clr() g_bRb2Flag=0 #define PortB2Set() g_bRb2Flag=1 #define PortB2Get() g_bRb2Flag #define PortB2Clear() g_wRb2Count=0 #define PortB2Count() g_wRb2Count #endif #endif #define PortB4567Flag() g_bRb4567Flag #define PortB4567Clear() g_bRb4567Flag=0 #ifdef RB4_PIN #define PortB4High() g_wRb4High #define PortB4Low() g_wRb4Low #endif #ifdef RB5_PIN #define PortB5High() g_wRb5High #define PortB5Low() g_wRb5Low #endif #ifdef RB6_PIN #define PortB6High() g_wRb6High #define PortB6Low() g_wRb6Low #endif #ifdef RB7_PIN #define PortB7High() g_wRb7High #define PortB7Low() g_wRb7Low #endif /***************************************************************************** * structs & typedefs *****************************************************************************/ /***************************************************************************** * global constants *****************************************************************************/ /***************************************************************************** * global variables *****************************************************************************/ #ifdef RB0_PIN LIBBANK extern volatile bit g_bRb0Flag; LIBBANK extern volatile long_dword g_stCount0; LIBBANK extern volatile WORD g_wRb0Counter; #endif #ifdef RB1_PIN LIBBANK extern volatile bit g_bRb1Flag; LIBBANK extern volatile WORD g_wRb1Counter; #endif #ifdef RB2_PIN LIBBANK extern volatile bit g_bRb2Flag; LIBBANK extern volatile WORD g_wRb2Counter; #endif LIBBANK extern volatile bit g_bRb4567Flag; #ifdef RB4_PIN LIBBANK extern volatile bit g_bRb4Flag; LIBBANK extern volatile WORD g_wRb4Low; LIBBANK extern volatile WORD g_wRb4High; #endif #ifdef RB5_PIN LIBBANK extern volatile bit g_bRb5Flag; LIBBANK extern volatile WORD g_wRb5Low; LIBBANK extern volatile WORD g_wRb5High; #endif #ifdef RB6_PIN LIBBANK extern volatile bit g_bRb6Flag; LIBBANK extern volatile WORD g_wRb6Low; LIBBANK extern volatile WORD g_wRb7High; #endif #ifdef RB7_PIN LIBBANK extern volatile bit g_bRb7Flag; LIBBANK extern volatile WORD g_wRb7Low; LIBBANK extern volatile WORD g_wRb7High; #endif /***************************************************************************** * C function prototypes *****************************************************************************/ /* export C functions to C++ */ #ifdef __cplusplus extern "C" { #endif // interrupt pins extern void PortB0Init( void ); extern void PortB0Handler( void ); extern void PortB12Init( BYTE byPins ); extern void PortB12Handler( void ); extern void PortB4567Init( void ); extern void PortB4567Handler( void ); #ifdef __cpluscplus } #endif #endif