84 lines
3.5 KiB
C
84 lines
3.5 KiB
C
#ifndef __Pulse_h__
|
|
#define __Pulse_h__
|
|
|
|
#define PULSECCR0 TA2CCR0
|
|
#define PULSECCR1 TA2CCR1
|
|
#define PULSEEX0 TA2EX0
|
|
#define PULSECTL TA2CTL
|
|
#define PULSECCTL0 TA2CCTL0
|
|
#define PULSECCTL1 TA2CCTL1
|
|
#define PULSETAR TA2R
|
|
#define PULSE_INT_VECTOR TIMER2_A1_VECTOR
|
|
#define PULSE_PERIOD_VECTOR TIMER2_A0_VECTOR
|
|
|
|
#define DISABLE_PULSE_TA_INTERRUPT disable_TA2OV_interrupts()
|
|
//#define ENABLE_PULSE_TA_INTERRUPT enable_TA2OV_interrupts()
|
|
|
|
#define DISABLE_PULSE_INTERRUPT disable_TA2CCP_interrupts(CCP0)
|
|
#define ENABLE_PULSE_INTERRUPT enable_TA2CCP_interrupts(CCP0)
|
|
|
|
#define CAPTURECCR0 TA1CCR0
|
|
#define CAPTUREEX0 TA1EX0
|
|
#define CAPTURECTL TA1CTL
|
|
#define CAPTURECCTL0 TA1CCTL0
|
|
#define CAPTURETAR TA1R
|
|
#define CAPTURETACCP0_VECTOR TIMER1_A0_VECTOR
|
|
#define DISABLE_CAPTURE_INTERRUPT disable_TA1CCP_interrupts(CCP0)
|
|
#define ENABLE_CAPTURE_INTERRUPT enable_TA1CCP_interrupts(CCP0)
|
|
|
|
#define CAPTURECCR1 TA1CCR1
|
|
#define CAPTURECCTL1 TA1CCTL1
|
|
#define CAPTURETACCP1_VECTOR TIMER1_A1_VECTOR
|
|
#define DISABLE_UPDATEPERIOD_INTERRUPT disable_TA1CCP_interrupts(CCP1)
|
|
#define ENABLE_UPDATEPERIOD_INTERRUPT enable_TA1CCP_interrupts(CCP1)
|
|
|
|
//******************************************************************************
|
|
// for memory WIDTH
|
|
#define PULSE_UNIT_WIDTH 3
|
|
#define PULSE_LEVEL_WIDTH 2
|
|
//#define PULSE_COUNTER_WIDTH 3
|
|
|
|
#define PULSE_BASE_WIDTH 6
|
|
//******************************************************************************
|
|
// for memory CRC
|
|
#define PULSE_UNIT_CRC (PULSE_UNIT_WIDTH-1)
|
|
//#define PULSE_COUNTER_CRC (PULSE_COUNTER_WIDTH-1)
|
|
#define PULSE_LEVEL_CRC (PULSE_LEVEL_WIDTH-1)
|
|
//******************************************************************************
|
|
// for memory address
|
|
#define PULSE_UNIT PULSE_BASE
|
|
#define PULSE_LEVEL (PULSE_UNIT + PULSE_UNIT_WIDTH)
|
|
//#define PULSE_COUNTER (PULSE_UNIT + PULSE_UNIT_WIDTH)
|
|
|
|
//******************************************************************************
|
|
#define PULSE_UNIT_MAX 10000
|
|
#define MAX_TIMER_PULSE 500
|
|
#define PULSE_UPDATE_TIME 7372 // 450ms //6553 (400ms) // acc pulse update time: 400ms, 16384
|
|
//******************************************************************************
|
|
extern unsigned int PulsePeriod[];
|
|
extern signed int targetPulse;
|
|
extern unsigned long int pulseCounter;
|
|
extern bool isPulseUpdaed;
|
|
|
|
extern const unsigned int MaxPulseOutput[];
|
|
extern const unsigned int PULSE_TABLE[];
|
|
//******************************************************************************
|
|
void PulseParameterInit(void);
|
|
void CapturePulseStart(unsigned int timerCLK);
|
|
void DisableCapturePulse(void);
|
|
void CloseFloawRatePulse(void);
|
|
void CompareLossCount(void);
|
|
void ReadyForCalibrationPulseOutput(void);
|
|
//__interrupt void PulseUpdate_isr(void);
|
|
void ReadyForUserPulseOutput(void);
|
|
void SetPulseUpdateTime(void);
|
|
void DisablePulseTimerInterrupt(void);
|
|
//__interrupt void Pulse_isr(void);
|
|
//__interrupt void ClosePulse_isr(void);
|
|
//__interrupt void CloseCapture_isr(void);
|
|
void UpdateAccPulse(void);
|
|
bool ReadPulseUnitByInternalModbus(void);
|
|
bool WritePulseUnitByInternalModbus(void);
|
|
|
|
#endif
|