Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LG2 by
InputOutput.h
00001 #ifndef InputOutput_H 00002 #define InputOutput_H 00003 00004 00005 #include "stdint.h" 00006 00007 //******************************I2C************************************************* 00008 #define I2C0 00009 00010 #define I2C_IDLE 1 00011 #define I2C_BUSY 0 00012 00013 #define I2CONSET_I2EN 0x0000040 /* I2C Control Set Register */ 00014 #define I2CONSET_AA 0x0000004 00015 #define I2CONSET_SI 0x0000008 00016 #define I2CONSET_STO 0x0000010 00017 #define I2CONSET_STA 0x0000020 00018 00019 #define I2CONCLR_AAC 0x0000004 /* I2C Control clear Register */ 00020 #define I2CONCLR_SIC 0x0000008 00021 #define I2CONCLR_STAC 0x0000020 00022 #define I2CONCLR_I2ENC 0x0000040 00023 00024 #define I2SCLH_SCLH 0x00000080 /* I2C SCL Duty Cycle High Reg */ 00025 #define I2SCLL_SCLL 0x00000080 /* I2C SCL Duty Cycle Low Reg */ 00026 00027 #define I2C_WRITELENGTH 0x00000006 /*Buffer length*/ 00028 #define A_ADDRESS 0x0000005E /*address of slave potentiometer (table 6-2 of pot's manual)*/ 00029 #define B_ADDRESS 0x0000005C /*address of slave potentiometer (table 6-2 of pot's manual)*/ 00030 #define WRITE_CMD 0x00000000 /*address of wiper0 register in memory map*/ 00031 00032 //********************************SPI************************************************ 00033 #define HALFWORDS_FOR_ADCs 3 00034 00035 #define WRITE_DAC0 0x00000030 //write data to DAC 0 00036 #define WRITE_DAC1 0x00000031 //write data to DAC 1 00037 00038 #define DAC (1<<23) //DAC identifer 00039 #define ADC (1<<16) //ADC identifer 00040 00041 #define SetCS(a) LPC_GPIO0->FIOSET = a //set CS signal for ADC or DAC 00042 #define ResetCS(a) LPC_GPIO0->FIOCLR = a //reset CS signal for ADC or DAC 00043 #define SetDAC(a) LPC_GPIO0->FIOSET = a //set CS signal for ADC or DAC 00044 #define ResetDAC(a) LPC_GPIO0->FIOCLR = a //reset CS signal for ADC or DAC 00045 00046 00047 00048 #define SSPCR1_SSE 0x00000002 00049 00050 #define TX_SSP_EMPT 0x00000001 00051 #define RX_SSP_notEMPT 0x00000004 00052 #define TX_SSP_notFULL 0x00000002 00053 #define RX_SSP_FULL 0x00000008 00054 #define SSP_BUSY 0x00000010 00055 00056 #define ADC_ERR_MSK 0x00000001 00057 #define DAC_ERR_MSK 0x00000002 00058 00059 #define TIMEOUT 1000 00060 00061 typedef union 00062 { 00063 int ArrayOut[31]; 00064 struct { 00065 int WP_reg; //e. PLC output voltage 00066 int WP_sin; //r. сигнал поиска СРП - синус 250 Гц 00067 int WP_pll; //r. выход XOR ФД контура СРП 00068 int HF_reg; //e. HFO output voltage 00069 00070 int HF_dif; 00071 00072 int WP_Phase_Det_Array[8]; //e. arrays for "worms" output //r. массивы для вывода "червячков" 00073 int WP_sin_Array[8]; 00074 int WP_scope1, WP_scope2; //e. temporary variables for Rate3 monitoring //r. временные переменные для наблюдения в Rate3 00075 00076 uint32_t F_ras; //e. really output frequency, divided by 16 (for transmission) 00077 uint32_t L_Vibro; //e. period of oscillation of the dither drive //r. период колебания вибропривода 00078 uint32_t T_Vibro; //e. pulse width of the dither drive //r. длительность импульса вибропривода 00079 uint32_t T_VB_pll; //e. PD output of the frequency regulator of the dither drive //r. выход ФД регулятора частоты вибропривода 00080 00081 int PS_dif; 00082 int BINS_dif; 00083 int Cnt_Dif; 00084 int Cnt_Pls; 00085 int Cnt_Mns; 00086 int Tmp_Out[6]; 00087 00088 __int64 SF_dif; 00089 00090 } Str; 00091 } OUTPUT; 00092 00093 00094 typedef union 00095 { 00096 int ArrayIn[3]; 00097 struct { 00098 int Tmp_in[2]; 00099 int HF_out; 00100 int WP_sel; 00101 }StrIn; 00102 } INPUT; 00103 00104 extern INPUT Input; 00105 extern OUTPUT Output; 00106 extern volatile uint32_t I2CMasterState; 00107 extern volatile uint32_t I2CMasterBuffer[]; 00108 void DAC_ADC_Exchange_Init(void); 00109 void DAC_ADC_Exchange(void); 00110 void ADC_Input(void); 00111 00112 void clc_HFO(void); 00113 00114 int clc_WP_sin(void); 00115 void clc_PLC(void); 00116 void init_PLC(void); 00117 00118 void clc_Pulses(void); 00119 void SOI_Init(void); 00120 00121 void VibroDither_SwitchOn(void); 00122 void VibroDither_SwitchOff(void); 00123 void VibroDither_Set(void); 00124 void DACInit(void); 00125 void DAC_Output(int); 00126 void clc_ThermoSensors(void); 00127 00128 void Out_G_photo(unsigned, unsigned); 00129 00130 void G_Photo_Exchange(void); 00131 00132 //endof file 00133 00134 #endif // InputOutput_H 00135
Generated on Thu Jul 14 2022 02:34:42 by
1.7.2
