84 lines
2.7 KiB
C
84 lines
2.7 KiB
C
/*****************************************************************************
|
|
* Copyright (C) 2008
|
|
* ProbeStar Telematics, LLC
|
|
* All Rights Reserved. Proprietary and Confidential.
|
|
*============================================================================
|
|
* PIC Period Counters
|
|
*----------------------------------------------------------------------------
|
|
*****************************************************************************/
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef _PERIOD_H_
|
|
#define _PERIOD_H_
|
|
|
|
/*****************************************************************************
|
|
* includes
|
|
*****************************************************************************/
|
|
|
|
// this is application specific
|
|
#include "system.h"
|
|
#include "types.h"
|
|
|
|
/*****************************************************************************
|
|
* defines
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* macros
|
|
*****************************************************************************/
|
|
|
|
// CCP1/CCP2
|
|
#ifdef CCP1_PIN
|
|
#define Period1Cnt() g_wPeriod1
|
|
#define Period1Clr() g_wPeriod1=0
|
|
#define Period1Clear() g_stPeriod1.dw=0
|
|
#define Period1Read() g_stPeriod1.dw
|
|
#endif
|
|
#ifdef CCP2_PIN
|
|
#define Period2Cnt() g_wPeriod2
|
|
#define Period2Clr() g_wPeriod2=0
|
|
#define Period2Clear() g_stPeriod2.dw=0
|
|
#define Period2Read() g_stPeriod2.dw
|
|
#endif
|
|
|
|
/*****************************************************************************
|
|
* structs & typedefs
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* global constants
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* global variables
|
|
*****************************************************************************/
|
|
|
|
#ifdef CCP1_PIN
|
|
LIBBANK extern volatile WORD g_wPeriod1;
|
|
extern volatile long_dword g_stPeriod1;
|
|
#endif
|
|
#ifdef CCP2_PIN
|
|
LIBBANK extern volatile WORD g_wPeriod2;
|
|
extern volatile long_dword g_stPeriod2;
|
|
#endif
|
|
|
|
/*****************************************************************************
|
|
* C function prototypes
|
|
*****************************************************************************/
|
|
/* export C functions to C++ */
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// counters
|
|
extern void PeriodInit( void );
|
|
extern void PeriodHandler( void );
|
|
extern void PeriodClear( void );
|
|
extern BYTE PeriodRead( void );
|
|
extern void PeriodZero( BYTE byZero1, BYTE byZero2 );
|
|
|
|
#ifdef __cpluscplus
|
|
}
|
|
#endif
|
|
#endif
|