n

Dependencies:   mbed

Fork of LG by igor Apu

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CyclesSync.h Source File

CyclesSync.h

00001 /**--------------File Info---------------------------------------------------------------------------------
00002 ** File name:           CycleSync.h
00003 ** Last modified Date:  2011-09-06
00004 ** Last Version:        V1.00
00005 ** Descriptions:
00006 **
00007 **--------------------------------------------------------------------------------------------------------
00008 ** Created by:          Electrooptica Inc.
00009 ** Created date:        2011-09-06
00010 ** Version:             V1.00
00011 ** Descriptions:        There is the routines for device synchronization
00012 **
00013 **--------------------------------------------------------------------------------------------------------
00014 *********************************************************************************************************/
00015 #include "LPC17xx.h"
00016 #include "CntrlGLD.h"
00017 
00018 //#define   PERFOMANCE
00019 
00020 //#define   PERFOMANCE
00021 
00022 #define DEVICE_SAMPLE_RATE_HZ       10000       //e. sampling frequency 10 kHz //r. частота дискретизации 10 кГц
00023 #define DEVICE_SAMPLE_RATE_uks      100000000       //e. sampling frequency 10 kHz //r. частота дискретизации 10 кГц
00024 #define DELAY_UART_ENBL             4000            //e. delay = DELAY_UART_ENBL*8/CLCK
00025 #define DELAY_UART_DISBL            2500            //e. delay = DELAY_UART_ENBL*8/CLCK
00026 #define RATE_REPER_OR_REFMEANDR     0x0000      //e. difference of general counters (not dither counters), latched by Reper or by Sign Meander //r. разность обычных счетчиков (не вибросч), защелкнутых по Reper`у или по RefMeandr`у
00027 #define RATE_VIBRO_1                0x0001      //e. difference of dither counters after the filter of moving average //r. разность вибросчетчиков после фильтра скольз.среднего
00028 
00029 #define  HALF_PERIOD                0x00000004
00030 #define  WHOLE_PERIOD               0x00000008
00031 #define  RESET_PERIOD               0x0000000C
00032 //-----------------------------PWM Registers----------------------------------------
00033 
00034 #define TCR_CNT_EN      0x00000001
00035 #define TCR_RESET       0x00000002
00036 #define TCR_PWM_EN      0x00000008
00037 
00038 #define PWMMR0I         (1 << 0)
00039 #define PWMMR0R         (1 << 1)
00040 #define PWMMR0S         (1 << 2)
00041 #define PWMENA1         (1 << 9)
00042 #define LER0_EN         (1 << 0)
00043 
00044 //-----------------------Drive cycle registers------------------------------------
00045 #define MR0_RESET       0x00000002
00046 #define MR1_RESET       0x00000010
00047 #define MR1_STOP        0x00000020
00048 #define MR0_STOP        0x00000004
00049 #define MR0_NO_STOP     0x00000000
00050 #define MR0_INT_EN      0x00000001
00051 #define SYNC_CLCK4      0xffff3fff
00052 #define SYNC_CLCK       0xfffffff
00053 
00054 //------------------------WDT registers--------------------------------------------
00055 #define WDEN        (0x1<<0)
00056 #define WDRESET     (0x1<<1)
00057 #define WDTOF       (0x1<<2)
00058 #define WDINT       (0x1<<3)
00059 #define WDT_FEED_VALUE  0x003FFFFF
00060 
00061 extern uint32_t     WDTInit( void );
00062 extern void         WDTFeed( void );
00063 extern uint32_t     Sys_Clock;
00064 extern  int32_t     time_1_Sec;
00065 extern uint32_t     trm_cycl;
00066 extern  int32_t     PrevPeriod;
00067 extern uint32_t     Ext_Latch_ResetEnable;
00068 extern volatile uint32_t        Latch_Rdy;
00069 extern volatile uint32_t        data_Rdy;
00070 extern  int32_t     LatchPhase;
00071 extern uint32_t     PeriodElapsed;
00072 extern uint32_t     count;
00073 extern uint32_t main_cycle_latch;
00074 extern uint32_t Out_main_cycle_latch; //e. counter of main cycles between external latch pulse appearence
00075 extern uint32_t T_latch, Out_T_latch, temp_T_latch;
00076 
00077 extern void CounterIquiryCycle_Init(uint32_t);
00078 extern void ExtLatch_Init(void);
00079 extern void IntLatch_Init(void);
00080 extern void Latch_Event(void);
00081 extern void SetIntLatch(uint32_t);
00082 extern void SwitchRefMeandInt(uint32_t);
00083 extern int SwitchMode(void);
00084 
00085 #if defined PERFOMANCE
00086 void IntLatch(void);
00087 #endif
00088 
00089 void ServiceTime(void);
00090 
00091 /*****************************************************************************
00092 **                            End Of File
00093 ******************************************************************************/