
#include "floatstr_t.h"
//#include "./fft/FFTRealFixLen.h"

#define Space			32

#define S_Slash 		127
#define S_uV 			142
#define S_mV 			128
#define S_V  			129	
#define S_kV  			143	
#define S_uA 			144
#define S_mA 			145
#define S_A  			146	
#define S_kA 			147
#define S_nS 			130	
#define S_uS 			131	
#define S_mS 			132
#define S_S  			133
#define Ground_Sign		134
#define Text_Count_Dot		135
#define Zero_Level_Sym		136
#define Menu_Select		137

#define Pos_Pulse		138
#define Neg_Pulse		139
#define Big_Smaller		140
#define Big_Bigger		141

#define Trigger_Sign		148
#define OverVolt_Sign		149
#define UnderVolt_Sign		150
#define Square_Sign    		151

#define PI 3.14159265358979323

// BF insert
#define FFT_LENGTH 		1024  	 	// number of digitized values
#define LEVEL 			10         	// number of butterfly levels 10 = ld(1024)

#define GRID_HEIGHT		400	//384
#define GRID_WIDTH		600
#define GRID_XY			400	//384
#define GRID_XY_XOFFS		120	//80
#define GRID_XOFFS		20
#define GRID_YOFFS		20
#define TOP_PLANE_MIN		0
#define TOP_PLANE_MAX		360	//360
#define GRID_PLANE_MIN		400	//380
#define GRID_PLANE_MAX		8440	//8500	//8120
#define BOTT_PLANE_MIN		8480	//8500	//8140
#define BOTT_PLANE_MAX		9600
#define SCR_PLANE_MIN		0
#define SCR_PLANE_MAX		9600
// BF insert end

#define protected_Config_Flash			(unsigned long *)	0x000F0000
#define SAVE_SIGNAL_NR_A01			(unsigned long *)	0x00100000
#define SAVE_SIGNAL_NR_A02			(unsigned long *)	0x00110000
#define SAVE_SIGNAL_NR_A03			(unsigned long *)	0x00120000
#define SAVE_SIGNAL_NR_A04			(unsigned long *)	0x00130000
#define SAVE_SIGNAL_NR_A05			(unsigned long *)	0x00140000
#define SAVE_SIGNAL_NR_A06			(unsigned long *)	0x00150000
#define SAVE_SIGNAL_NR_A07			(unsigned long *)	0x00160000
#define SAVE_SIGNAL_NR_A08			(unsigned long *)	0x00170000
#define SAVE_SIGNAL_NR_A09			(unsigned long *)	0x00180000
#define SAVE_SIGNAL_NR_A10			(unsigned long *)	0x00190000
#define SAVE_SIGNAL_NR_A11			(unsigned long *)	0x001A0000
#define SAVE_SIGNAL_NR_A12			(unsigned long *)	0x001B0000
#define SAVE_SIGNAL_NR_A13			(unsigned long *)	0x001C0000
#define SAVE_SIGNAL_NR_A14			(unsigned long *)	0x001D0000
#define SAVE_SIGNAL_NR_A15			(unsigned long *)	0x001E0000
#define SAVE_SIGNAL_NR_A16			(unsigned long *)	0x001F0000
#define SAVE_SIGNAL_NR_B01			(unsigned long *)	0x00200000
#define SAVE_SIGNAL_NR_B02			(unsigned long *)	0x00210000
#define SAVE_SIGNAL_NR_B03			(unsigned long *)	0x00220000
#define SAVE_SIGNAL_NR_B04			(unsigned long *)	0x00230000
#define SAVE_SIGNAL_NR_B05			(unsigned long *)	0x00240000
#define SAVE_SIGNAL_NR_B06			(unsigned long *)	0x00250000
#define SAVE_SIGNAL_NR_B07			(unsigned long *)	0x00260000
#define SAVE_SIGNAL_NR_B08			(unsigned long *)	0x00270000
#define SAVE_SIGNAL_NR_B09			(unsigned long *)	0x00280000
#define SAVE_SIGNAL_NR_B10			(unsigned long *)	0x00290000
#define SAVE_SIGNAL_NR_B11			(unsigned long *)	0x002A0000
#define SAVE_SIGNAL_NR_B12			(unsigned long *)	0x002B0000
#define SAVE_SIGNAL_NR_B13			(unsigned long *)	0x002C0000
#define SAVE_SIGNAL_NR_B14			(unsigned long *)	0x002D0000
#define SAVE_SIGNAL_NR_B15			(unsigned long *)	0x002E0000
#define SAVE_SIGNAL_NR_B16			(unsigned long *)	0x002F0000
#define SAVE_SIGNAL_NR_C01			(unsigned long *)	0x00300000
#define SAVE_SIGNAL_NR_C02			(unsigned long *)	0x00310000
#define SAVE_SIGNAL_NR_C03			(unsigned long *)	0x00320000
#define SAVE_SIGNAL_NR_C04			(unsigned long *)	0x00330000
#define SAVE_SIGNAL_NR_C05			(unsigned long *)	0x00340000
#define SAVE_SIGNAL_NR_C06			(unsigned long *)	0x00350000
#define SAVE_SIGNAL_NR_C07			(unsigned long *)	0x00360000
#define SAVE_SIGNAL_NR_C08			(unsigned long *)	0x00370000
#define SAVE_SIGNAL_NR_C09			(unsigned long *)	0x00380000
#define SAVE_SIGNAL_NR_C10			(unsigned long *)	0x00390000
#define SAVE_SIGNAL_NR_C11			(unsigned long *)	0x003A0000
#define SAVE_SIGNAL_NR_C12			(unsigned long *)	0x003B0000
#define SAVE_SIGNAL_NR_C13			(unsigned long *)	0x003C0000
#define SAVE_SIGNAL_NR_C14			(unsigned long *)	0x003D0000
#define SAVE_SIGNAL_NR_C15			(unsigned long *)	0x003E0000
#define SAVE_SIGNAL_NR_C16			(unsigned long *)	0x003F0000
#define SAVE_SIGNAL_NR_D01			(unsigned long *)	0x00400000
#define SAVE_SIGNAL_NR_D02			(unsigned long *)	0x00410000
#define SAVE_SIGNAL_NR_D03			(unsigned long *)	0x00420000
#define SAVE_SIGNAL_NR_D04			(unsigned long *)	0x00430000
#define SAVE_SIGNAL_NR_D05			(unsigned long *)	0x00440000
#define SAVE_SIGNAL_NR_D06			(unsigned long *)	0x00450000
#define SAVE_SIGNAL_NR_D07			(unsigned long *)	0x00460000
#define SAVE_SIGNAL_NR_D08			(unsigned long *)	0x00470000
#define SAVE_SIGNAL_NR_D09			(unsigned long *)	0x00480000
#define SAVE_SIGNAL_NR_D10			(unsigned long *)	0x00490000
#define SAVE_SIGNAL_NR_D11			(unsigned long *)	0x004A0000
#define SAVE_SIGNAL_NR_D12			(unsigned long *)	0x004B0000
#define SAVE_SIGNAL_NR_D13			(unsigned long *)	0x004C0000
#define SAVE_SIGNAL_NR_D14			(unsigned long *)	0x004D0000
#define SAVE_SIGNAL_NR_D15			(unsigned long *)	0x004E0000
#define SAVE_SIGNAL_NR_D16			(unsigned long *)	0x004F0000
#define SAVE_SIGNAL_NR_E01			(unsigned long *)	0x00500000
#define SAVE_SIGNAL_NR_E02			(unsigned long *)	0x00510000
#define SAVE_SIGNAL_NR_E03			(unsigned long *)	0x00520000
#define SAVE_SIGNAL_NR_E04			(unsigned long *)	0x00530000
#define SAVE_SIGNAL_NR_E05			(unsigned long *)	0x00540000
#define SAVE_SIGNAL_NR_E06			(unsigned long *)	0x00550000
#define SAVE_SIGNAL_NR_E07			(unsigned long *)	0x00560000
#define SAVE_SIGNAL_NR_E08			(unsigned long *)	0x00570000
#define SAVE_SIGNAL_NR_E09			(unsigned long *)	0x00580000
#define SAVE_SIGNAL_NR_E10			(unsigned long *)	0x00590000
#define SAVE_SIGNAL_NR_E11			(unsigned long *)	0x005A0000
#define SAVE_SIGNAL_NR_E12			(unsigned long *)	0x005B0000
#define SAVE_SIGNAL_NR_E13			(unsigned long *)	0x005C0000
#define SAVE_SIGNAL_NR_E14			(unsigned long *)	0x005D0000
#define SAVE_SIGNAL_NR_E15			(unsigned long *)	0x005E0000
#define SAVE_SIGNAL_NR_E16			(unsigned long *)	0x005F0000

#define TestData_Flash				(unsigned long *)	0x00700000 //0x006B0000
#define WTAG_Logo_Half_Flash			(unsigned long *)	0x006C0000
#define WTAG_Logo            			(unsigned long *)	0x006D0000
#define UI_Plane1_Flash				(unsigned long *)	0x006E0000
#define UI_Plane2_Flash				(unsigned long *)	0x006F0000
#define UI_Plane3_Flash				(unsigned long *)	0x00700000
#define UI_Plane4_Flash				(unsigned long *)	0x00710000
#define UI_Plane5_Flash				(unsigned long *)	0x00720000
#define Channel_Plane1_Flash			(unsigned long *)	0x00730000
#define Channel_Plane2_Flash			(unsigned long *)	0x00740000
#define Channel_Plane3_Flash			(unsigned long *)	0x00750000
#define Channel_Plane4_Flash			(unsigned long *)	0x00760000
#define Channel_Math_Plane_Flash		(unsigned long *)	0x00770000
#define Memory_Plane1_Flash			(unsigned long *)	0x00780000
#define Memory_Plane2_Flash			(unsigned long *)	0x00790000
#define Memory_Plane3_Flash			(unsigned long *)	0x007A0000
#define Marker_Plane1_Flash			(unsigned long *)	0x007B0000
#define Marker_Plane2_Flash			(unsigned long *)	0x007C0000
#define Grid_Plane_Flash			(unsigned long *)	0x007D0000
#define Grid_Delayed_Plane_Flash		(unsigned long *)	0x007E0000
#define Config_Flash				(unsigned long *)	0x007F0000

#define SAMPLE  double      /* define the type used for data samples */
#define NTAPS 11
#define IMP_SIZE (3 * NTAPS)

#define adc1      				(unsigned long *)	0x00A00000
#define adc2      				(unsigned long *)	0x00A00010
#define adc3      				(unsigned long *)	0x00A00020
#define adc4      				(unsigned long *)	0x00A00030
// Constants


extern unsigned long tc_varstart ;;		// Kennung Varstart
extern unsigned long tc_version ;;		// Factory version 			//BF changed
extern unsigned long tc_subversion ;;		// Factory subversion 			//BF changed
extern unsigned long tc_dev_version ;;		// Developer version			//BF changed
extern unsigned long tc_dev_subversion ;;	// Developer subversion			//BF changed
extern unsigned long tc_hw_sw_version ;;	// Type 		0 ;
extern unsigned long tc_hw_version ;;		// Version 		0 // Var to read hardware version
extern unsigned long tc_model ;;		// 2012, 2022 ...
extern unsigned long tc_serial ;;		// 1
extern unsigned long tc_production_lot1 ;;	// E
extern unsigned long tc_production_lot2 ;;	// E
extern unsigned long tc_shipment_date ;;	// 2C7

extern const unsigned char  C_GROUND_SIGN	;;
extern const unsigned char  C_MENU_SELECT_SIGN	;;
extern const unsigned char Colors[7][3] ;
extern const unsigned char clYellow 		;;
extern const unsigned char clCyan   		;;
extern const unsigned char clPurple 		;;
extern const unsigned char clGreen 		;;
extern const unsigned char clRed    		;;
extern const unsigned char clBlue   		;;
extern const unsigned char clBlack  		;;
extern const unsigned char clGray   		;;
extern const unsigned char clDarkGray   	;;
extern const unsigned char clWhite  		;;	
extern const unsigned char clOrange 		;;
extern const unsigned char clCHI    		;;
extern const unsigned char clCHII   		;;
extern const unsigned char clCHIII  		;;
extern const unsigned char clCHIV   		;;
extern const unsigned char clBackground 	;;
extern const unsigned char clFrame 		;;//0x14;
extern const unsigned char clButton 		;;//0x0C;
extern const unsigned char clCursor 		;;
extern const unsigned char btnUnpushed		;;
extern const unsigned char btnPushed 		;;
extern const unsigned char btnDraw			;;
extern const unsigned char btnRemove 		;;
extern const unsigned long BitMasks[32] ;
extern const unsigned long BitMasks2[32] ;
// Constants
extern const int DrawOffsetX ;;									// Draw Offset from Left
extern const int DrawOffsetY ;;									// Draw Offset from Top
extern const int DrawXYOffsetX1 ;;								// Draw Offset from Top
extern const int DrawXYOffsetX2 ;;								// Draw Offset from Left
extern const int SignalOffset ;;								// Signal Offset , half Signal
//extern const int PreReg_Offset ;;								// Signal Offset , half Signal
extern int PreReg_Offset ;;									// Signal Offset , half Signal
extern const int FFTOffsetY ;;									// Draw Offset from Left
extern const int CH1OffsetX ;;									// Draw Offset from Left
extern const int CH2OffsetX ;;									// Draw Offset from Left
extern const int CH3OffsetX ;;									// Draw Offset from Left
extern const int CH4OffsetX ;;									// Draw Offset from Left
extern const int correction ;;  //18;								// Draw Correction for the Signals
extern const int timerAutoFreefirst ;;								// Trigger Auto Timer 100 ms -> wird array der timebases
extern const int timerAutoFreefast  ;;								// Trigger Auto Timer 10 ms
extern unsigned long timer_counter_value ;;
extern unsigned long timer_counter_max ;;
extern int timer_reload_low ;;
extern int timer_reload_high ;;
extern unsigned long timer_array_first[32];
extern unsigned long timer_array_fast[32] ;
//extern const int timerAutoFreefirst ;;							// Trigger Auto Timer 100 ms -> wird array der timebases
//extern const int timerAutoFreefast  ;;							// Trigger Auto Timer 10 ms
extern const int timerrotPeriod     ;;//25 000 000;						// Rotary change timer
extern const int timersecPeriod     ;;						// Statusbar display time							
extern const unsigned long tb_value[32] ;
extern const unsigned int rollmode_value[9] ;
extern const unsigned int voltage_offsets[12] ;
extern const float voltage_factor[12] ;
extern const unsigned int voltage_relevat[10][9] ;
extern const unsigned char GridColorArray[4] ;;
extern const unsigned int Splash_Logo_PosX ;;
extern const unsigned int Splash_Logo_PosY ;;
extern const unsigned int Splash_Data_PosX ;;
extern const unsigned int Splash_Data_PosY ;;
extern const short SIG_Start_Stop[20][2];
extern const short SIG_Size[20];
extern const float Zoom_Faktor_Table[20] ;;
extern float ZFT_float ;;
extern float ZFT_float_old ;;
extern float ZFT_float_dmode ;;
extern float ZFT_float_dmode_old ;;
extern const float Offset_Faktor_Table[20] ;;
extern float OFT_float ;;
extern float OFT_float_old ;;
extern const short Zoom_Index_Table[32][5] ;
extern short ZIT_short ;;
extern short ZIT_short_old ;;
extern short ZIT_short_dmode ;;
extern short ZIT_short_dmode_old ;;
extern const float PreTrigger_Offset_Table[32][5] ;
extern const short Zoom_Index_Table[32][5] ;
extern const int Extern_Trigger_Values[33] ;
extern const float Extern_Trigger_Strs[33] ;
extern unsigned long tc_test_var ;;
extern unsigned long tc_test_var2 ;;
extern unsigned char DrawSignal ;;
extern unsigned char keyboard_found ;;
extern unsigned long slope_value ;;
extern double Test_Slip;
extern int Test_Range;
extern bool Transfer_man_data;

extern double ct_vfactor_buf;
extern double ct_vfactor2_buf;


extern double dcd_vfactor_buf;
extern double voltoff1;	
extern double voltoff2;
extern double dcd_tfactor_buf;
extern double timeoff1;	
extern double timeoff2;
extern double dzp_factor_buf;


extern unsigned long *prog_flash_adr;
extern unsigned long prog_flash_adress;
extern unsigned char prog_flash_length;
extern unsigned long prog_flash_offset;
extern unsigned char Flash_Read_Buffer[1024];
extern unsigned long Flash_Protect_Buffer[256];
extern volatile unsigned char config_loaded ;;
extern unsigned char init_done ;;
extern unsigned char config_changed ;;
extern unsigned char first_start ;;
extern unsigned char GridColorArrayPos ;;
extern unsigned char GridColor_Val ;;
extern unsigned char GridColor_Val_Delayed ;;
extern unsigned char GridColorArrayPos_Delayed ;;
extern unsigned char WT_Logo_Color_Val ;;		//0x10 / 0x21 / 0x31 
extern int Testint ;;
extern long Testlong ;;
extern unsigned char Test_Mode ;;
extern unsigned char ADC_Debug_Mode ;;     // If true than printf ADC Debug information
extern unsigned char Debug_Mode ;;         // If true than printf Debug information
extern unsigned char Command_Mode ;;         // If true than printf Command information
extern unsigned char Calc_Mode ;;
extern unsigned char ExtraTrg_Mode ;;
extern volatile unsigned char Search_Mode ;;
extern volatile unsigned char Search_Auto ;;
extern unsigned char volt_filter_Mode ;;        // CH1 Bit 0 / CH2 Bit 1 / CH3 Bit 2 / CH4 Bit 3
extern unsigned char m2k_filter_Mode ;;        // CH1 Bit 0 / CH2 Bit 1 / CH3 Bit 2 / CH4 Bit 3
extern unsigned int zeros_filter_Mode ;;    // CH1 mem 1 Bit 0 / CH1 mem 2 Bit 1 / CH1 mem 3 Bit 2 / CH1 mem 4 Bit 3
extern unsigned int kill_adc ;;             // CH1 adc 1 Bit 0 / CH1 adc 2 Bit 1 / CH1 adc 3 Bit 2 / CH1 adc 4 Bit 3
extern unsigned char OneShotRestart ;;       // If set only one shot after restart.
extern unsigned char Splash_drawed ;;
extern unsigned char Splash_removed ;;
extern volatile unsigned char Search_Channel ;;
extern volatile unsigned char Search_Step ;;
extern volatile unsigned char Search_Bad_Sig_cnt ;;
extern volatile unsigned char Search_Hidden ;;
extern volatile unsigned char adc_started ;;
extern volatile unsigned char AutoFreeRun ;;
extern volatile unsigned char AutoSearchTrigger ;;
extern volatile unsigned char AutoTimerOff ;;
extern int Average_Max ;;
extern int Average_Cnt ;;
extern unsigned char Connect_Vals ;;
extern unsigned char signal_zoomed1 ;;
extern unsigned char signal_zoomed2 ;;
extern unsigned char signal_zoomed3 ;;
extern unsigned char signal_zoomed4 ;;
extern volatile unsigned long calc_counter ;;
extern volatile unsigned int sps_counter ;;
extern volatile unsigned int vs_counter ;;
extern unsigned int ctrl_reg ;;				//0x0003;
extern unsigned int adc_ctrl_reg ;;			//0;
extern unsigned int adc_del_reg ;;
extern unsigned int pre_reg ;;				//0x004C;
extern unsigned int trg_val_reg ;;			//0;
extern unsigned int trg_hyst_reg ;;			//0;
extern unsigned int ext_trg_val_reg ;;		//0;
extern unsigned int triggering ;;				//2;
extern unsigned int channel_Adr_add ;;
extern unsigned int channel_Adr_add2 ;;
extern unsigned int trg_val_CHI_reg ;;			//0;
extern unsigned int trg_val_CHII_reg ;;			//0;
extern unsigned int trg_val_CHIII_reg ;;			//0;
extern unsigned int trg_val_CHIV_reg ;;			//0;
extern unsigned int trig_range_reg ;;
extern unsigned int trig_width_reg ;;		//0;
extern unsigned long trig_holdoff_reg ;;
extern volatile long buffer_addr ;;	
extern volatile long buffer_peak ;;	
extern volatile long buffer_witten ;;	
extern volatile long buffer_long ;;	
extern volatile long buffer_adradd ;;
extern int HoldOff_Value ;;
extern int HoldOff_Expo ;;   //ns
extern int HoldOff_Steps ;;
extern int Pulse11_Value ;;
extern int Pulse11_Expo ;;   //ns
extern int Pulse11_Steps ;;
extern int Pulse12_Value ;;
extern int Pulse12_Expo ;;   //ns
extern int Pulse12_Steps ;;
extern int Pulse21_Value ;;
extern int Pulse21_Expo ;;   //ns
extern int Pulse21_Steps ;;
extern int Pulse22_Value ;;
extern int Pulse22_Expo ;;   //ns
extern int Pulse22_Steps ;;
extern float Math_Off_Mul_Value ;;
extern int Math_Off_Mul_Value_int ;;
extern int Math_Off_Mul_Expo ;;   //ns
extern float Math_Off_Mul_Steps ;;
extern float Math_Off_Sub_Value ;;
extern int Math_Off_Sub_Value_int ;;
extern int Math_Off_Sub_Expo ;;   //ns
extern float Math_Off_Sub_Steps ;;
extern float Math_Off_Add_Value ;;
extern int Math_Off_Add_Value_int ;;
extern int Math_Off_Add_Expo ;;   //ns
extern float Math_Off_Add_Steps ;;
extern unsigned long adc_change12_reg ;;
extern unsigned long adc_change34_reg ;;
extern unsigned long adc_ctr12_reg ;;
extern unsigned long adc_ctr34_reg ;;
extern unsigned long timebase_reg ;;	//0xFFFFFFF8;
extern unsigned long ram_adress_reg ;;
extern unsigned int test_port_reg ;;
extern unsigned int triggering_bak ;;
extern unsigned int ctrl_reg_bak ;;
extern unsigned int adc_ctrl_reg_bak ;;
extern unsigned long timebase_reg_bak ;;
extern unsigned int pre_reg_bak ;;
extern unsigned int channel_Adr_add_bak ;;
extern unsigned int trg_val_reg_bak ;;
extern unsigned int trg_hyst_reg_bak ;;
extern unsigned int trig_range_reg_bak ;;
extern unsigned long trig_holdoff_reg_bak ;;
extern unsigned int trig_width_reg_bak ;;
extern unsigned char GridColor_Val_bak ;;
extern unsigned long adc_change12_reg_bak ;;
extern unsigned long adc_change34_reg_bak ;;
extern char Selected_Voltage_CH1_bak ;;
extern char Selected_Voltage_CH2_bak ;;
extern char Selected_Voltage_CH3_bak ;;
extern char Selected_Voltage_CH4_bak ;;
extern int ZeroLevelCH1_bak ;;
extern int ZeroLevelCH2_bak ;;
extern int ZeroLevelCH3_bak ;;
extern int ZeroLevelCH4_bak ;;
extern int Virtual_ZeroLevelCH1_bak ;;
extern int Virtual_ZeroLevelCH2_bak ;;
extern int Virtual_ZeroLevelCH3_bak ;;
extern int Virtual_ZeroLevelCH4_bak ;;
extern int ZeroLevelCH1_cor_offset ;;
extern int ZeroLevelCH2_cor_offset ;;
extern int ZeroLevelCH3_cor_offset ;;
extern int ZeroLevelCH4_cor_offset ;;
extern int ZeroLevelCH1_XY_bak ;;
extern int ZeroLevelCH2_XY_bak ;;
extern int VZeroLevelCH1_XY_bak ;;
extern int VZeroLevelCH2_XY_bak ;;
extern int Trigger_Pos_CH1_bak ;;										// Stores the Trigger Position on Channel 1
extern int Trigger_Pos_CH2_bak ;;										// Stores the Trigger Position on Channel 2
extern int Trigger_Pos_CH3_bak ;;										// Stores the Trigger Position on Channel 3
extern int Trigger_Pos_CH4_bak ;;
extern int Timebase_Offset_Pos_bak ;;
extern int Trigger_Offset_Pos_bak ;;
extern int AC_CH1_bak ;;
extern int AC_CH2_bak ;;
extern int AC_CH3_bak ;;
extern int AC_CH4_bak ;;
extern int Invert_CH1_bak ;;
extern int Invert_CH2_bak ;;
extern int Invert_CH3_bak ;;
extern int Invert_CH4_bak ;;
extern int MAINMODE_bak ;;
extern int ROLLMODE_bak ;;
extern int ROLLMODESTARTED_bak ;;
extern int AUTOMODE_bak ;;
extern int Acquire_bak_0 ;;
extern int Acquire_bak_1 ;;
extern volatile int HistoMax_1 ;;
extern volatile int HistoMax_2 ;;	
extern volatile int HistoSt_1 ;;
extern volatile int HistoSt_2 ;;
extern volatile int HistoDiv ;;
extern char  Selected_Timebase_bak;                                          // 10 �S // 500 nS
extern short SIGNALFaktor_idx_bak;                                           // zoom factor 1 ;
extern short SIGNAL_StartFr_idx_bak;                                         // running. so 0
extern short draw_start ;;
extern short draw_stop ;;
extern short draw_offset ;;
extern short draw_factor ;;
extern short draw_dm_ixstart ;;
extern short draw_dm_ixstop ;;
extern short draw_dm_ixoffset ;;
extern short draw_dm_ixfactor ;;
//extern long timebase_reg_bak;                                      // real timebase
extern char  Display_Timebase_bak;                                          // Displayed timebase is 10 �s
extern char Continius_bak;
extern char SingleMode_bak;
extern int CH1_DAC_Offset_bak ;;
extern int CH2_DAC_Offset_bak ;;
extern int CH3_DAC_Offset_bak ;;
extern int CH4_DAC_Offset_bak ;;
extern int Channel1_Zero_Sign_Offset_1_bak ;;
extern int Channel1_Zero_Sign_Offset_2_bak ;;
extern int Channel1_Zero_Sign_Offset_3_bak ;;
extern int Channel2_Zero_Sign_Offset_1_bak ;;
extern int Channel2_Zero_Sign_Offset_2_bak ;;
extern int Channel2_Zero_Sign_Offset_3_bak ;;
extern int Channel3_Zero_Sign_Offset_1_bak ;;
extern int Channel3_Zero_Sign_Offset_2_bak ;;
extern int Channel3_Zero_Sign_Offset_3_bak ;;
extern int Channel4_Zero_Sign_Offset_1_bak ;;
extern int Channel4_Zero_Sign_Offset_2_bak ;;
extern int Channel4_Zero_Sign_Offset_3_bak ;;
extern char Channel_1_Active_bak ;;
extern char Channel_2_Active_bak ;;
extern char Channel_3_Active_bak ;;
extern char Channel_4_Active_bak ;;
extern char Channel_Math_Active_bak ;;
extern char testtoggle ;;
extern int CH1_DAC_Offset ;;
extern int CH1_Zero_Offset ;;
extern unsigned char CH1_DAC_1 ;;
extern unsigned char CH1_DAC_2 ;;
extern unsigned char CH1_DAC_3 ;;
extern unsigned char CH1_DAC_4 ;;
extern int CH2_DAC_Offset ;;
extern int CH2_Zero_Offset ;;
extern unsigned char CH2_DAC_1 ;;
extern unsigned char CH2_DAC_2 ;;
extern unsigned char CH2_DAC_3 ;;
extern unsigned char CH2_DAC_4 ;;
extern int CH3_DAC_Offset ;;
extern int CH3_Zero_Offset ;;
extern unsigned char CH3_DAC_1 ;;
extern unsigned char CH3_DAC_2 ;;
extern unsigned char CH3_DAC_3 ;;
extern unsigned char CH3_DAC_4 ;;
extern int CH4_DAC_Offset ;;
extern int CH4_Zero_Offset ;;
extern unsigned char CH4_DAC_1 ;;
extern unsigned char CH4_DAC_2 ;;
extern unsigned char CH4_DAC_3 ;;
extern unsigned char CH4_DAC_4 ;;
extern int CH1_DAC_OffsetOld ;;
extern unsigned char CH1_DAC_1Old ;;
extern unsigned char CH1_DAC_2Old ;;
extern unsigned char CH1_DAC_3Old ;;
extern unsigned char CH1_DAC_4Old ;;
extern int CH2_DAC_OffsetOld ;;
extern unsigned char CH2_DAC_1Old ;;
extern unsigned char CH2_DAC_2Old ;;
extern unsigned char CH2_DAC_3Old ;;
extern unsigned char CH2_DAC_4Old ;;
extern int CH3_DAC_OffsetOld ;;
extern unsigned char CH3_DAC_1Old ;;
extern unsigned char CH3_DAC_2Old ;;
extern unsigned char CH3_DAC_3Old ;;
extern unsigned char CH3_DAC_4Old ;;
extern int CH4_DAC_OffsetOld ;;
extern unsigned char CH4_DAC_1Old ;;
extern unsigned char CH4_DAC_2Old ;;
extern unsigned char CH4_DAC_3Old ;;
extern unsigned char CH4_DAC_4Old ;;
extern int Channel1_1_ADC_Correction ;;
extern int Channel1_2_ADC_Correction ;;
extern int Channel1_3_ADC_Correction ;;//256;
extern int Channel1_4_ADC_Correction ;;
extern int Channel2_1_ADC_Correction ;;
extern int Channel2_2_ADC_Correction ;;
extern int Channel2_3_ADC_Correction ;;//256;
extern int Channel2_4_ADC_Correction ;;
extern int Channel3_1_ADC_Correction ;;
extern int Channel3_2_ADC_Correction ;;
extern int Channel3_3_ADC_Correction ;;//256;
extern int Channel3_4_ADC_Correction ;;
extern int Channel4_1_ADC_Correction ;;
extern int Channel4_2_ADC_Correction ;;
extern int Channel4_3_ADC_Correction ;;//256;
extern int Channel4_4_ADC_Correction ;;
extern char CH1_X_Offset_1 ;;
extern char CH1_X_Offset_2 ;;
extern char CH1_X_Offset_3 ;;
extern char CH1_X_Offset_4 ;;
extern char CH2_X_Offset_1 ;;
extern char CH2_X_Offset_2 ;;
extern char CH2_X_Offset_3 ;;
extern char CH2_X_Offset_4 ;;
extern char CH3_X_Offset_1 ;;
extern char CH3_X_Offset_2 ;;
extern char CH3_X_Offset_3 ;;
extern char CH3_X_Offset_4 ;;
extern char CH4_X_Offset_1 ;;
extern char CH4_X_Offset_2 ;;
extern char CH4_X_Offset_3 ;;
extern char CH4_X_Offset_4 ;;
extern int Channel1_Zero_Sign_Offset_1 ;;
extern int Channel1_Zero_Sign_Offset_2 ;;
extern int Channel1_Zero_Sign_Offset_3 ;;
extern int Channel2_Zero_Sign_Offset_1 ;;
extern int Channel2_Zero_Sign_Offset_2 ;;
extern int Channel2_Zero_Sign_Offset_3 ;;
extern int Channel3_Zero_Sign_Offset_1 ;;
extern int Channel3_Zero_Sign_Offset_2 ;;
extern int Channel3_Zero_Sign_Offset_3 ;;
extern int Channel4_Zero_Sign_Offset_1 ;;
extern int Channel4_Zero_Sign_Offset_2 ;;
extern int Channel4_Zero_Sign_Offset_3 ;;
extern int Rot_Time ;;
extern int LED_ON[16];
extern int LED_Buf ;;
extern int Display_Line_Adresses[480];
extern int Display_Line_Adresses2[480];
//int *Display_Line_Adresses ;;
//int *Display_Line_Adresses2 ;;
extern volatile unsigned char VSync_Needed ;;
extern volatile unsigned char DrawSignals_Needed ;;
extern volatile unsigned char uart2_buffer[64];
extern volatile unsigned char send_buffer[64];
extern volatile char uart2_count;
extern volatile unsigned char ClearPlane ;;
extern volatile unsigned char DrawPlane ;;
extern volatile unsigned char RemovePlane ;;
extern volatile unsigned char ClearPhase ;;
extern volatile unsigned char UpdateMarkerPlane ;;
extern volatile unsigned char UpdateMenuTextPlane ;;
extern volatile int TestVar ;;
extern volatile int Rotary_Direction ;;
extern volatile int Rotary_Direction_mem ;;
extern volatile int Rotary_Direction_mem_pulse ;;
extern volatile int Rotary_Switch ;;
extern volatile int Rotary_Steps ;;
extern volatile int Rotary_Changed ;;
extern volatile int Keyboard_mem ;;
extern volatile char Keyboard_Changed ;;
extern volatile char ADC_Data_Available ;;
extern volatile char ADC_Data_Available_cnt ;;
extern unsigned long TransPlane_Buffer_Adr1 ;;
extern unsigned long TransPlane_Plane_Adr1 ;;
extern unsigned long TransPlane_Buffer_Adr2 ;;
extern unsigned long TransPlane_Plane_Adr2 ;;
extern unsigned short SwitchesCH1;
extern unsigned short SwitchesCH2;
extern unsigned short SwitchesCH3;
extern unsigned short SwitchesCH4;
extern unsigned short SwitchesTB;
extern unsigned short SwitchesCH1Old;
extern unsigned short SwitchesCH2Old;
extern unsigned short SwitchesCH3Old;
extern unsigned short SwitchesCH4Old;
extern unsigned short SwitchesTBOld;
extern unsigned long *Buffer_Mark1Plane ;; //0x008D3BF4;
extern unsigned long *Buffer_UI2Plane ;;
extern unsigned char *SIGNAL_IntBuf ;;
extern int *SIGNAL1_Histo ;;   // double used for Rollmode. No Interpolation for rollmode
extern int *SIGNAL2_Histo ;;
extern int *SIGNAL3_Histo ;;
extern int *SIGNAL4_Histo ;;
extern int *SIGNALM_Histo ;;
extern unsigned char *SIGNAL1_Intpolate ;;   // double used for Rollmode. No Interpolation for rollmode
extern unsigned char *SIGNAL2_Intpolate ;;
extern unsigned char *SIGNAL3_Intpolate ;;
extern unsigned char *SIGNAL4_Intpolate ;;
extern unsigned char *SIGNALM_Intpolate ;;
extern unsigned char *SIGNAL1_Intpolate_delayed ;;
extern unsigned char *SIGNAL2_Intpolate_delayed ;;
extern unsigned char *SIGNAL3_Intpolate_delayed ;;
extern unsigned char *SIGNAL4_Intpolate_delayed ;;
extern unsigned char *SIGNALM_Intpolate_delayed ;;
extern unsigned char *SIGNAL1_IntBuf_YZoom ;;
extern unsigned char *SIGNAL2_IntBuf_YZoom ;;
extern unsigned char *SIGNAL3_IntBuf_YZoom ;;
extern unsigned char *SIGNAL4_IntBuf_YZoom ;;
extern unsigned char *SIGNALM_IntBuf_YZoom ;;
extern unsigned char *SIGNAL1_SUM_MIN ;;
extern unsigned char *SIGNAL1_SUM_MAX ;;
extern unsigned char *SIGNAL2_SUM_MIN ;;
extern unsigned char *SIGNAL2_SUM_MAX ;;
extern unsigned char *SIGNAL3_SUM_MIN ;;
extern unsigned char *SIGNAL3_SUM_MAX ;;
extern unsigned char *SIGNAL4_SUM_MIN ;;
extern unsigned char *SIGNAL4_SUM_MAX ;;
extern unsigned char *SIGNALM_SUM_MIN ;;
extern unsigned char *SIGNALM_SUM_MAX ;;
extern unsigned long *readout_sigbuf ;;
extern unsigned char *readout_sigbuf_char ;;
extern unsigned char *SIGNAL1_SUM_MIN ;;
extern unsigned char *SIGNAL1_SUM_MAX ;;
extern unsigned char *SIGNAL2_SUM_MIN ;;
extern unsigned char *SIGNAL2_SUM_MAX ;;
extern unsigned char *SIGNAL3_SUM_MIN ;;
extern unsigned char *SIGNAL3_SUM_MAX ;;
extern unsigned char *SIGNAL4_SUM_MIN ;;
extern unsigned char *SIGNAL4_SUM_MAX ;;
extern unsigned char *SIGNALM_SUM_MIN ;;
extern unsigned char *SIGNALM_SUM_MAX ;;
extern unsigned char *SIGNAL1 ;;
extern unsigned char *SIGNAL2 ;;
extern unsigned char *SIGNAL3 ;;
extern unsigned char *SIGNAL4 ;;
extern unsigned char *SIGNALM ;;
extern unsigned long *Buffer_PlaneM ;;
extern unsigned long *Buffer_Plane1 ;;
extern unsigned long *Buffer_Plane2 ;;
extern unsigned long *Buffer_Plane3 ;;
extern unsigned long *Buffer_Plane4 ;;
extern unsigned long *Planes ;;
extern unsigned long *UI_Plane1 ;;
extern unsigned long *UI_Plane2 ;;
extern unsigned long *UI_Plane3 ;;
extern unsigned long *UI_Plane4 ;;
extern unsigned long *UI_Plane5 ;;
extern unsigned long *Channel_Plane1 ;;
extern unsigned long *Channel_Plane2 ;;
extern unsigned long *Channel_Plane3 ;;
extern unsigned long *Channel_Plane4 ;;
extern unsigned long *Channel_Math_Plane ;;
extern unsigned long *Memory_Plane1 ;;
extern unsigned long *Memory_Plane2 ;;
extern unsigned long *Memory_Plane3 ;;
extern unsigned long *Marker_Plane1 ;;
extern unsigned long *Marker_Plane2 ;;
extern unsigned long *Grid_Plane ;;
extern long v_Buffer_PlaneM ;;
extern long v_Buffer_Plane1 ;;
extern long v_Buffer_Plane2 ;;
extern long v_Buffer_Plane3 ;;
extern long v_Buffer_Plane4 ;;
extern long v_Channel_Plane1 ;;
extern long v_Channel_Plane2 ;;
extern long v_Channel_Plane3 ;;
extern long v_Channel_Plane4 ;;
extern long v_Channel_Math_Plane ;;
//extern unsigned char SIGNALBUF[16384];
//extern unsigned char SIGNALBUF1[16384];
//extern unsigned char SIGNALBUF2[16384];
//extern unsigned char SIGNALBUF3[16384];
//extern unsigned char SIGNALBUF4[16384];
//extern unsigned char SIGNALBUFM[16384];
//unsigned long *Buffer_Mark1Plane ;;
//unsigned long *Buffer_UI2Plane ;;  // shared -> menu not in Signal Part
extern unsigned long buffer_long1 ;;
extern unsigned long buffer_long2 ;;
extern unsigned long buffer_long3 ;;
extern unsigned long buffer_long4 ;;
extern unsigned long buffer_addi ;;
extern short SIGNAL1_MIN ;;
extern short SIGNAL1_MDL ;;
extern short SIGNAL1_MAX ;;
extern short SIGNAL1_BASE ;;
extern short SIGNAL1_TOP ;;
extern short SIGNAL1_AVG ;;
extern short SIGNAL1_AVG_CNT ;;
extern short SIGNAL1_THRES_LOW ;;
extern short SIGNAL1_THRES_MDL ;;
extern short SIGNAL1_THRES_UP ;;
extern short SIGNAL1_THRES_PRE_POSITIV_1 ;;
extern short SIGNAL1_THRES_LOW_POSITIV_1 ;;
extern short SIGNAL1_THRES_MDL_POSITIV_1 ;;
extern short SIGNAL1_THRES_UP_POSITIV_1 ;;
extern short SIGNAL1_THRES_OVER_POSITIV_1 ;;
extern short SIGNAL1_THRES_PRE_NEGATIV_1 ;;
extern short SIGNAL1_THRES_LOW_NEGATIV_1 ;;
extern short SIGNAL1_THRES_MDL_NEGATIV_1 ;;
extern short SIGNAL1_THRES_UP_NEGATIV_1 ;;
extern short SIGNAL1_THRES_OVER_NEGATIV_1 ;;
extern short SIGNAL1_THRES_PRE_POSITIV_2 ;;
extern short SIGNAL1_THRES_LOW_POSITIV_2 ;;
extern short SIGNAL1_THRES_MDL_POSITIV_2 ;;
extern short SIGNAL1_THRES_UP_POSITIV_2 ;;
extern short SIGNAL1_THRES_OVER_POSITIV_2 ;;
extern short SIGNAL1_THRES_PRE_NEGATIV_2 ;;
extern short SIGNAL1_THRES_LOW_NEGATIV_2 ;;
extern short SIGNAL1_THRES_MDL_NEGATIV_2 ;;
extern short SIGNAL1_THRES_UP_NEGATIV_2 ;;
extern short SIGNAL1_THRES_OVER_NEGATIV_2 ;;
extern short SIGNAL1_THRES_PRE_POSITIV_LAST ;;
extern short SIGNAL1_THRES_LOW_POSITIV_LAST ;;
extern short SIGNAL1_THRES_MDL_POSITIV_LAST ;;
extern short SIGNAL1_THRES_UP_POSITIV_LAST ;;
extern short SIGNAL1_THRES_OVER_POSITIV_LAST ;;
extern short SIGNAL1_THRES_PRE_NEGATIV_LAST ;;
extern short SIGNAL1_THRES_LOW_NEGATIV_LAST ;;
extern short SIGNAL1_THRES_MDL_NEGATIV_LAST ;;
extern short SIGNAL1_THRES_UP_NEGATIV_LAST ;;
extern short SIGNAL1_THRES_OVER_NEGATIV_LAST ;;
extern short SIGNAL2_MIN ;;
extern short SIGNAL2_MDL ;;
extern short SIGNAL2_MAX ;;
extern short SIGNAL2_BASE ;;
extern short SIGNAL2_TOP ;;
extern short SIGNAL2_AVG ;;
extern short SIGNAL2_AVG_CNT ;;
extern short SIGNAL2_THRES_LOW ;;
extern short SIGNAL2_THRES_MDL ;;
extern short SIGNAL2_THRES_UP ;;
extern short SIGNAL2_THRES_PRE_POSITIV_1 ;;
extern short SIGNAL2_THRES_LOW_POSITIV_1 ;;
extern short SIGNAL2_THRES_MDL_POSITIV_1 ;;
extern short SIGNAL2_THRES_UP_POSITIV_1 ;;
extern short SIGNAL2_THRES_OVER_POSITIV_1 ;;
extern short SIGNAL2_THRES_PRE_NEGATIV_1 ;;
extern short SIGNAL2_THRES_LOW_NEGATIV_1 ;;
extern short SIGNAL2_THRES_MDL_NEGATIV_1 ;;
extern short SIGNAL2_THRES_UP_NEGATIV_1 ;;
extern short SIGNAL2_THRES_OVER_NEGATIV_1 ;;
extern short SIGNAL2_THRES_PRE_POSITIV_2 ;;
extern short SIGNAL2_THRES_LOW_POSITIV_2 ;;
extern short SIGNAL2_THRES_MDL_POSITIV_2 ;;
extern short SIGNAL2_THRES_UP_POSITIV_2 ;;
extern short SIGNAL2_THRES_OVER_POSITIV_2 ;;
extern short SIGNAL2_THRES_PRE_NEGATIV_2 ;;
extern short SIGNAL2_THRES_LOW_NEGATIV_2 ;;
extern short SIGNAL2_THRES_MDL_NEGATIV_2 ;;
extern short SIGNAL2_THRES_UP_NEGATIV_2 ;;
extern short SIGNAL2_THRES_OVER_NEGATIV_2 ;;
extern short SIGNAL2_THRES_PRE_POSITIV_LAST ;;
extern short SIGNAL2_THRES_LOW_POSITIV_LAST ;;
extern short SIGNAL2_THRES_MDL_POSITIV_LAST ;;
extern short SIGNAL2_THRES_UP_POSITIV_LAST ;;
extern short SIGNAL2_THRES_OVER_POSITIV_LAST ;;
extern short SIGNAL2_THRES_PRE_NEGATIV_LAST ;;
extern short SIGNAL2_THRES_LOW_NEGATIV_LAST ;;
extern short SIGNAL2_THRES_MDL_NEGATIV_LAST ;;
extern short SIGNAL2_THRES_UP_NEGATIV_LAST ;;
extern short SIGNAL2_THRES_OVER_NEGATIV_LAST ;;
extern short SIGNAL3_MIN ;;
extern short SIGNAL3_MDL ;;
extern short SIGNAL3_MAX ;;
extern short SIGNAL3_BASE ;;
extern short SIGNAL3_TOP ;;
extern short SIGNAL3_AVG ;;
extern short SIGNAL3_AVG_CNT ;;
extern short SIGNAL3_THRES_LOW ;;
extern short SIGNAL3_THRES_MDL ;;
extern short SIGNAL3_THRES_UP ;;
extern short SIGNAL3_THRES_PRE_POSITIV_1 ;;
extern short SIGNAL3_THRES_LOW_POSITIV_1 ;;
extern short SIGNAL3_THRES_MDL_POSITIV_1 ;;
extern short SIGNAL3_THRES_UP_POSITIV_1 ;;
extern short SIGNAL3_THRES_OVER_POSITIV_1 ;;
extern short SIGNAL3_THRES_PRE_NEGATIV_1 ;;
extern short SIGNAL3_THRES_LOW_NEGATIV_1 ;;
extern short SIGNAL3_THRES_MDL_NEGATIV_1 ;;
extern short SIGNAL3_THRES_UP_NEGATIV_1 ;;
extern short SIGNAL3_THRES_OVER_NEGATIV_1 ;;
extern short SIGNAL3_THRES_PRE_POSITIV_2 ;;
extern short SIGNAL3_THRES_LOW_POSITIV_2 ;;
extern short SIGNAL3_THRES_MDL_POSITIV_2 ;;
extern short SIGNAL3_THRES_UP_POSITIV_2 ;;
extern short SIGNAL3_THRES_OVER_POSITIV_2 ;;
extern short SIGNAL3_THRES_PRE_NEGATIV_2 ;;
extern short SIGNAL3_THRES_LOW_NEGATIV_2 ;;
extern short SIGNAL3_THRES_MDL_NEGATIV_2 ;;
extern short SIGNAL3_THRES_UP_NEGATIV_2 ;;
extern short SIGNAL3_THRES_OVER_NEGATIV_2 ;;
extern short SIGNAL3_THRES_PRE_POSITIV_LAST ;;
extern short SIGNAL3_THRES_LOW_POSITIV_LAST ;;
extern short SIGNAL3_THRES_MDL_POSITIV_LAST ;;
extern short SIGNAL3_THRES_UP_POSITIV_LAST ;;
extern short SIGNAL3_THRES_OVER_POSITIV_LAST ;;
extern short SIGNAL3_THRES_PRE_NEGATIV_LAST ;;
extern short SIGNAL3_THRES_LOW_NEGATIV_LAST ;;
extern short SIGNAL3_THRES_MDL_NEGATIV_LAST ;;
extern short SIGNAL3_THRES_UP_NEGATIV_LAST ;;
extern short SIGNAL3_THRES_OVER_NEGATIV_LAST ;;
extern short SIGNAL4_MIN ;;
extern short SIGNAL4_MDL ;;
extern short SIGNAL4_MAX ;;
extern short SIGNAL4_BASE ;;
extern short SIGNAL4_TOP ;;
extern short SIGNAL4_AVG ;;
extern short SIGNAL4_AVG_CNT ;;
extern short SIGNAL4_THRES_LOW ;;
extern short SIGNAL4_THRES_MDL ;;
extern short SIGNAL4_THRES_UP ;;
extern short SIGNAL4_THRES_PRE_POSITIV_1 ;;
extern short SIGNAL4_THRES_LOW_POSITIV_1 ;;
extern short SIGNAL4_THRES_MDL_POSITIV_1 ;;
extern short SIGNAL4_THRES_UP_POSITIV_1 ;;
extern short SIGNAL4_THRES_OVER_POSITIV_1 ;;
extern short SIGNAL4_THRES_PRE_NEGATIV_1 ;;
extern short SIGNAL4_THRES_LOW_NEGATIV_1 ;;
extern short SIGNAL4_THRES_MDL_NEGATIV_1 ;;
extern short SIGNAL4_THRES_UP_NEGATIV_1 ;;
extern short SIGNAL4_THRES_OVER_NEGATIV_1 ;;
extern short SIGNAL4_THRES_PRE_POSITIV_2 ;;
extern short SIGNAL4_THRES_LOW_POSITIV_2 ;;
extern short SIGNAL4_THRES_MDL_POSITIV_2 ;;
extern short SIGNAL4_THRES_UP_POSITIV_2 ;;
extern short SIGNAL4_THRES_OVER_POSITIV_2 ;;
extern short SIGNAL4_THRES_PRE_NEGATIV_2 ;;
extern short SIGNAL4_THRES_LOW_NEGATIV_2 ;;
extern short SIGNAL4_THRES_MDL_NEGATIV_2 ;;
extern short SIGNAL4_THRES_UP_NEGATIV_2 ;;
extern short SIGNAL4_THRES_OVER_NEGATIV_2 ;;
extern short SIGNAL4_THRES_PRE_POSITIV_LAST ;;
extern short SIGNAL4_THRES_LOW_POSITIV_LAST ;;
extern short SIGNAL4_THRES_MDL_POSITIV_LAST ;;
extern short SIGNAL4_THRES_UP_POSITIV_LAST ;;
extern short SIGNAL4_THRES_OVER_POSITIV_LAST ;;
extern short SIGNAL4_THRES_PRE_NEGATIV_LAST ;;
extern short SIGNAL4_THRES_LOW_NEGATIV_LAST ;;
extern short SIGNAL4_THRES_MDL_NEGATIV_LAST ;;
extern short SIGNAL4_THRES_UP_NEGATIV_LAST ;;
extern short SIGNAL4_THRES_OVER_NEGATIV_LAST ;;
extern short SIGNALM_MIN ;;
extern short SIGNALM_MDL ;;
extern short SIGNALM_MAX ;;
extern short SIGNALM_BASE ;;
extern short SIGNALM_TOP ;;
extern short SIGNALM_AVG ;;
extern short SIGNALM_AVG_CNT ;;
extern short SIGNALM_THRES_LOW ;;
extern short SIGNALM_THRES_MDL ;;
extern short SIGNALM_THRES_UP ;;
extern short SIGNALM_THRES_PRE_POSITIV_1 ;;
extern short SIGNALM_THRES_LOW_POSITIV_1 ;;
extern short SIGNALM_THRES_MDL_POSITIV_1 ;;
extern short SIGNALM_THRES_UP_POSITIV_1 ;;
extern short SIGNALM_THRES_OVER_POSITIV_1 ;;
extern short SIGNALM_THRES_PRE_NEGATIV_1 ;;
extern short SIGNALM_THRES_LOW_NEGATIV_1 ;;
extern short SIGNALM_THRES_MDL_NEGATIV_1 ;;
extern short SIGNALM_THRES_UP_NEGATIV_1 ;;
extern short SIGNALM_THRES_OVER_NEGATIV_1 ;;
extern short SIGNALM_THRES_PRE_POSITIV_2 ;;
extern short SIGNALM_THRES_LOW_POSITIV_2 ;;
extern short SIGNALM_THRES_MDL_POSITIV_2 ;;
extern short SIGNALM_THRES_UP_POSITIV_2 ;;
extern short SIGNALM_THRES_OVER_POSITIV_2 ;;
extern short SIGNALM_THRES_PRE_NEGATIV_2 ;;
extern short SIGNALM_THRES_LOW_NEGATIV_2 ;;
extern short SIGNALM_THRES_MDL_NEGATIV_2 ;;
extern short SIGNALM_THRES_UP_NEGATIV_2 ;;
extern short SIGNALM_THRES_OVER_NEGATIV_2 ;;
extern short SIGNALM_THRES_PRE_POSITIV_LAST ;;
extern short SIGNALM_THRES_LOW_POSITIV_LAST ;;
extern short SIGNALM_THRES_MDL_POSITIV_LAST ;;
extern short SIGNALM_THRES_UP_POSITIV_LAST ;;
extern short SIGNALM_THRES_OVER_POSITIV_LAST ;;
extern short SIGNALM_THRES_PRE_NEGATIV_LAST ;;
extern short SIGNALM_THRES_LOW_NEGATIV_LAST ;;
extern short SIGNALM_THRES_MDL_NEGATIV_LAST ;;
extern short SIGNALM_THRES_UP_NEGATIV_LAST ;;
extern short SIGNALM_THRES_OVER_NEGATIV_LAST ;;
extern volatile short ROLLMODE_OFFSET ;;
extern volatile short ROLLMODE_POS ;;
extern volatile short ROLLMODE_BUFFVALUE_CH1 ;;
extern volatile short ROLLMODE_BUFFVALUE_CH2 ;;
extern volatile short ROLLMODE_BUFFVALUE_CH3 ;;
extern volatile short ROLLMODE_BUFFVALUE_CH4 ;;
extern volatile short ROLLMODE_BUFFVALUE_CHM ;;
extern volatile short ROLLMODE_CNT ;;
extern volatile short ROLLMODE_TB ;;
extern volatile char ROLLMODE_STARTED ;;
extern volatile char ROLLMODE_Value_rec ;;
extern volatile short SIGNAL_StartFr_idx ;;
extern volatile short SIGNAL_OFFSET ;;
extern volatile short SIGNALFaktor_idx ;;
extern volatile short SIGNALFaktor_idx_Old ;;
extern volatile short dmode_SIGNAL_StartFr_idx ;;
extern volatile short dmode_SIGNAL_OFFSET ;;
extern volatile short dmode_SIGNALFaktor_idx ;;
extern char dmode_Selected_Timebase;										// Selected Timebase
extern int dmode_Timebase_Offset_Pos_Old;
extern int dmode_Trigger_Offset_Pos_Old;
extern int dmode_Cursor_Vertical_Position1_Old;
extern int dmode_Cursor_Vertical_Position2_Old;
extern int dmode_QM_Vertical_Position1_Old;
extern int dmode_QM_Vertical_Position2_Old;
extern int dmode_Window_Offset_Pos;
extern int dmode_Window_Offset_Pos_Old;
extern float dmode_factor ;;
extern int Cursor_Delayed_1 ;;
extern int Cursor_Delayed_2 ;;
extern int Cursor_Delayed_Size ;;
extern int Cursor_Delayed_1_Old ;;
extern int Cursor_Delayed_2_Old ;;
extern volatile char multi_active ;;
extern volatile int ch1_value;
extern volatile int ch1_factor ;;
extern volatile int ch1_result;
extern volatile int ch2_value;
extern volatile int ch2_factor ;;
extern volatile int ch2_result;
extern volatile int ch3_value;
extern volatile int ch3_factor ;;
extern volatile int ch3_result;
extern volatile int ch4_value;
extern volatile int ch4_factor ;;
extern volatile int ch4_result;  
extern unsigned char buf_arr[600];
extern unsigned char buf_min ;;
extern unsigned char buf_max ;;
extern int Voltage_Correction[4][12] ;
extern float Volt_Correct_float[4][12] ;
extern int Voltage_Offset[4][4] ;
extern short FIR_Tabel[6][9];
extern short FIR_Tab_big[256][6][9];
extern char FirEnabledCH1 ;;
extern char FirEnabledCH2 ;;
extern char FirEnabledCH3 ;;
extern char FirEnabledCH4 ;;
extern short FirStartCH ;;
extern short FirStartCH_delayed ;;
extern char SmoothEnabledCH1 ;;
extern char SmoothEnabledCH2 ;;
extern char SmoothEnabledCH3 ;;
extern char SmoothEnabledCH4 ;;

// FFT variables
//extern long fft_length ;;		// BF deleted
extern float fft_values[512];
extern float fft_frequencies[512];
extern float fft_mag[512];
extern float fft_max ;;
extern float fft_window[3][512] ;
extern unsigned char *val_bytes ;;
extern unsigned char *freq_bytes ;;
//FFTRealFixLen <12> fft_object; // 4096-poextern int (2^12) FFT object constructed.
//FFTRealFixLen <9> fft_object; // 256-poextern int (2^8) FFT object constructed.
/* BF insert for FFT */
extern float *sin_tab ;;	
extern float *cos_tab ;;	
extern float *freq_re ;;
extern float *freq_im ;;
extern int *bit_rev ;;
/* BF insert end */

extern short LogicData[32];
extern char USB_Connected ;;
extern char USB_Data_Trans;
extern char USB_SendAllData;
extern char USB_At_Startup ;;
extern char USB_OnlyTrigger;
extern char USB_Data_Requested ;;
extern volatile char Continius;
extern volatile char Signal_Loaded ;;
extern volatile char SingleMode ;;
extern volatile char Single_Restart ;;
extern volatile char ButtonChanged ;;
extern volatile char RoteryChanged ;;
extern volatile char RoteryReady ;;
extern volatile char UserIface_active ;;
extern volatile char UserIface_active_2 ;;
extern volatile char Menu_Popup_visible ;;
extern char DoDraw ;;
extern char SavePointer ;;
extern short led_status;											// Stores the LED Port Bits;
extern char ScreenShotActive;										// is 1 when sending screen shot
extern char PopUpPosition;
extern char IsPopuped;												// When it is Popuped it is 1, else 0
extern char PopupTimeCounter;										// Counter for Popup Pulldown
extern char TriggerLevelChanged ;;								// Was Triggerlevel changed
extern char TriggerOffsetChanged ;;								// Was Triggerlevel changed
extern char TriggerModeChanged ;;								// Was Triggermode changed
extern char TriggerWayChanged ;;									// Was Triggerway changed
extern char TimebaseChanged ;;									// Was Timebase changed
extern char TimeOffsetChanged ;;									// Was Time_Offset changed
extern char SIGNALFaktorChanged ;;								// Was SIGNALFaktor changed
extern char TriggerLevelActive ;;								// Is Triggerlevel selected ?
extern char TimeOffsetActive ;;									// Is Time_Offset selected ?
extern char StatusbarChanged ;;									// When 1 then is changed
extern char ZeroPopupChanged ;;									// When 1 then is changed
extern char MenuPopupChanged ;;									// When 1 then is changed
extern char MenuPopupActive ;;									// Stores the actual Menupopup
extern char VoltageChangedCh1 ;;									// Was Voltage changed
extern char VoltageChangedCh2 ;;									// Was Voltage changed
extern char VoltageChangedCh3 ;;									// Was Voltage changed
extern char VoltageChangedCh4 ;;									// Was Voltage changed
extern char MenuPopupChanged2 ;;									// Was MenuPopup changed
extern char MenuOnlyChanged ;;									// When 1 then is changed 
extern char MenuItemChanged[6] ;;
extern char MenuItemPushed[6] ;;				// When Menuitem is pushed drawed
extern char MenuItemPushed_old[6] ;;			// When Menuitem is pushed drawed
extern char MenuStatusChanged ;;									// When switching on/off a menu holds menunr
extern char MenuAktive ;;                                        // When Menu was deaktive
extern char MenuAktive_old ;;                                    // When Menu was deaktive
extern char EdgeToggle ;;                                        // for switching between Holdoff and Probe
extern char PulseToggle ;;                                       // for switching between smaller/bigger pulse width
extern char MathToggle ;;                                        // for switching between Scale and Offset
extern char FFTToggle ;;                                         // for switching between Scale and Offset
extern char VS_ZeroChangedCh1 ;;									// Was Zero changed
extern char VS_ZeroChangedCh2 ;;									// Was Zero changed
extern char VS_ZeroChangedCh3 ;;									// Was Zero changed
extern char VS_ZeroChangedCh4 ;;									// Was Zero changed
extern char VS_TrigLevelChanged ;;								// Was Triggerlevel changed
extern int MenuPopupX;
extern int MenuPopupY;
extern int MenuPopupSizeX;
extern int MenuPopupSizeY;
extern char MenuStored;
extern char MenuActive;
extern char MenuActiveOld;
extern char MenuChanged;
extern int MenuTimeCounter;										// Counter for Menu Pulldown
extern char MenuItemCount;											// Store the count of the Menuitems
extern char MenuOldItemCount;										// Store the count of the old Menuitems
extern char New_Menu ;;
extern char Active_Menu ;;
extern char Menu_Changed ;;
//extern char Btns_Status[6] ;;	//BF not used
extern int wheelchanged ;;
extern int Rot_Summary ;;                                        // Stores the value from Rot speed Calculation
extern long Memory_Position;										// Store memory position
extern volatile char NumberOfChannels ;;
extern char Channel_1_Active;										// Store the channel activity
extern char Channel_2_Active;										// Store the channel activity
extern char Channel_3_Active;										// Store the channel activity
extern char Channel_4_Active;										// Store the channel activity
extern char Channel_Math_Active;									// Store the math activity
extern char Channel_1_Active_Old;									// Store the channel activity
extern char Channel_2_Active_Old;									// Store the channel activity
extern char Channel_3_Active_Old;									// Store the channel activity
extern char Channel_4_Active_Old;									// Store the channel activity
extern char Channel_Math_Active_Old;								// Store the math activity
extern char Selected_Timebase;										// Selected Timebase 
extern char Selected_Timebase_Old;										// Selected Timebase
extern char Selected_Expand_Timebase; 								// Selected Expand Timebase
extern char Display_Timebase;										// Selected Shown Timebase
extern char Display_Timebase_Old;	     							// Selected Shown Timebase
extern char Display_Mode ;;     									// Selected Normal or XY-Mode
extern int Timebase_Offset_Pos;									// Store the Timebase Offset Position in Pixel
extern int Timebase_Offset_Pos_Old;								// Store the old Timebase Offset Position in Pixel
extern volatile int Trigger_Offset_Pos;									// Store the Timebase Offset Position in Pixel
extern volatile int Trigger_Offset_Pos_Old;								// Store the old Timebase Offset Position in Pixel
extern volatile int Trigger_Offset_Calc;									// Store the Timebase Offset Position in Pixel
extern int Trig_Pos_Mem ;;                                     // Store the Triggerposition in Memory
extern int Trig_Pos_Display ;;                                 // Store the Triggerposition on Display
extern int Trig_Pos_Display_dmode ;;                           // Store the Triggerposition on Display in delayed mode
extern float Trig_Pos_Zoom ;;                                  // Store the Triggerzoom factor
extern int Trig_Mem_Pos ;;                                    // Store the Trigger Memory Offset
extern int Trig_Pos_Mem_old ;;                                     // Store the Triggerposition in Memory
extern int Trig_Pos_Display_old ;;                                 // Store the Triggerposition on Display
extern int Trig_Pos_Display_dmode_old ;;                           // Store the Triggerposition on Display in delayed mode
extern float Trig_Pos_Zoom_old ;;                                  // Store the Triggerzoom factor
extern int Trig_Mem_Pos_old ;;                                    // Store the Trigger Memory Offset
extern char TriggerWay;											// Stores the way to trigger
extern char Selected_Trigger_Source;								// Stores the Channel who Trigger
extern char Selected_Trigger_Source_Old;							// Stores the Channel who Trigger Old
extern char SelectedEdgeExtern;									// Store which extern is Selected
extern char TiggerLevelLine;										// If 1 then Draw Trigger Level Line
extern int Trigger_Pos_CH1;										// Stores the Trigger Position on Channel 1
extern int Trigger_Pos_CH2;										// Stores the Trigger Position on Channel 2
extern int Trigger_Pos_CH3;										// Stores the Trigger Position on Channel 3
extern int Trigger_Pos_CH4;										// Stores the Trigger Position on Channel 4
extern int Trigger_Pos_CHE;										// Stores the Trigger Position on External
extern int Trigger_Pos_CH1_Old;									// Stores the old Trigger Position on Channel 1
extern int Trigger_Pos_CH2_Old;									// Stores the old Trigger Position on Channel 2
extern int Trigger_Pos_CH3_Old;									// Stores the old Trigger Position on Channel 3
extern int Trigger_Pos_CH4_Old;									// Stores the old Trigger Position on Channel 4
extern int Trigger_Pos_CHE_Old;									// Stores the old Trigger Position on External
extern int Trigger_Pos_CH1_os ;;									// Stores the Trigger Position on Channel 1 of the screen
extern int Trigger_Pos_CH2_os ;;									// Stores the Trigger Position on Channel 2 of the screen
extern int Trigger_Pos_CH3_os ;;									// Stores the Trigger Position on Channel 3 of the screen
extern int Trigger_Pos_CH4_os ;;									// Stores the Trigger Position on Channel 4 of the screen
extern int Trigger_Pos_CHE_os ;;									// Stores the Trigger Position on External of the screen
extern char SelectedChannel;
extern char SelectedChannelOld;
extern int Virtual_ZeroLevelCH1;
extern int Virtual_ZeroLevelCH2;
extern int Virtual_ZeroLevelCH3;
extern int Virtual_ZeroLevelCH4;
extern int ZeroLevelCH1;
extern int ZeroLevelCH2;
extern int ZeroLevelCH3;
extern int ZeroLevelCH4;
extern int Virtual_ZeroLevelXYCH1;
extern int Virtual_ZeroLevelXYCH2;
extern int Virtual_ZeroLevelXYCH3;
extern int Virtual_ZeroLevelXYCH4;
extern int ZeroLevelCH1_Old;
extern int ZeroLevelCH2_Old;
extern int ZeroLevelCH3_Old;
extern int ZeroLevelCH4_Old;
extern volatile char Selected_Voltage_CH1;									// Selected Voltage_CH1
extern volatile char Selected_Voltage_CH1_Old;								// Selected Voltage_CH1
extern volatile char Selected_Voltage_CH2;									// Selected Voltage_CH2
extern volatile char Selected_Voltage_CH2_Old;								// Selected Voltage_CH2
extern volatile char Selected_Voltage_CH3;									// Selected Voltage_CH3
extern volatile char Selected_Voltage_CH3_Old;								// Selected Voltage_CH3
extern volatile char Selected_Voltage_CH4;									// Selected Voltage_CH4
extern volatile char Selected_Voltage_CH4_Old;								// Selected Voltage_CH4
extern volatile char Selected_TB;											// Selected TimeBase
extern volatile char Selected_ADCs_CH1;									// Selected ADC_CH1
extern volatile char Selected_ADCs_CH2;									// Selected ADC_CH2
extern volatile char Selected_ADCs_CH3;									// Selected ADC_CH3
extern volatile char Selected_ADCs_CH4;									// Selected ADC_CH4
extern char SelectedCursor;										// Which Cursor is selected
extern char SelectedCursorOld;										// Which Cursor was selected
extern char Cursor_Enabled;
extern char Cursor_Enabled_Old;
extern char CursorChanged;											// Was Cursor changed
extern char Cursor_XY_Selected;									// 0 ;
extern char Cursor_XY_Selected_Old;								// 0 ;
extern char Cursor_Both_Selected;
extern char Cursor_Both_Selected_Old;
extern char Cursor_Horizontal_Active; 								// 0 ;
extern char Cursor_Horizontal_Active_Old;							// 1 ;
extern long Cursor_Horizontal_Position_Real1;						// Store Real Cursor Position
extern long Cursor_Horizontal_Position_Real2;						// Store Real Cursor Position
extern long Cursor_Horizontal_Position1_Old;						// Store old Cursor horizontal I position
extern long Cursor_Horizontal_Position2_Old;						// Store old Cursor horizontal II position
extern char Cursor_Vertical_Active;								// 0 ;
extern char Cursor_Vertical_Active_Old;							// 1 ;
extern long Cursor_Vertical_Position_Real1;						// Store Real Cursor Position
extern long Cursor_Vertical_Position_Real2;						// Store Real Cursor Position
extern long Cursor_Vertical_Position1_Old;							// Store old Cursor vertical I position
extern long Cursor_Vertical_Position2_Old;							// Store old Cursor vertical II position
extern long Cursor_Vertical_Position_Real_XY_1;					// Store Real Cursor Position
extern long Cursor_Vertical_Position_Real_XY_2;					// Store Real Cursor Position
extern long Cursor_Vertical_Position_XY_1_Old;						// Store old Cursor vertical I position
extern long Cursor_Vertical_Position_XY_2_Old;						// Store old Cursor vertical II position
extern char Cursor_Data_Draw_Pos ;;								// Stores the draw position of the cursor data
extern char Cursor_Data_First_Draw ;;							// Is it draw first time ?
extern char QM_Enabled;
extern char QM_Enabled_Old;
extern char QM_Changed[3];											// Was quick measurment changed
extern char QM_Type[3];                                            // What type of measurment (look 1313 -> 52 ...
extern char QM_Type_Old[3];                                        // What type of measurment (look 1313 -> 52 ...
extern char QM_Channel[3];                                         // What channel is measured
extern char QM_Second_Channel[3];                                  // Fore delay / phase measurment
extern char QM_CHI_Edge[3];                                        // Fore delay  measurment // 1 ;
extern char QM_CHII_Edge[3];                                       // Fore delay  measurment // 1 ;
extern char BufPre[30];
extern char BufUnit[10];
extern char BufReturn[30];
extern char QM_V_A_Buf[1];
extern char QM_H_A_Buf[1];
extern char QM_Horizontal_Active; 								     // 0 ;
extern char QM_Horizontal_Active_Old;							     // 1 ;
extern long QM_Horizontal_Position_Real1;						// Store Real Cursor Position
extern long QM_Horizontal_Position_Real2;						// Store Real Cursor Position
extern long QM_Horizontal_Position1_Old;						// Store old Cursor horizontal I position
extern long QM_Horizontal_Position2_Old;						// Store old Cursor horizontal II position
extern char QM_Vertical_Active;								// 0 ;
extern char QM_Vertical_Active_Old;							// 1 ;
extern long QM_Vertical_Position_Real1;						// Store Real Cursor Position
extern long QM_Vertical_Position_Real2;						// Store Real Cursor Position
extern long QM_Vertical_Position1_Old;							// Store old Cursor vertical I position
extern long QM_Vertical_Position2_Old;							// Store old Cursor vertical II position
extern char Quick_Measure_Data_Draw_Pos ;;								// Stores the draw position of the cursor data
extern char Quick_Measure_First_Draw ;;							// Is it draw first time ?
extern char Quick_Measure_Threshold_btn_select;
extern char Memory_Window_visible ;;
extern int mb_window_start_old ;;
extern int mb_window_stop_old ;;
extern int mb_window_trigger_old ;;
extern int mb_window_cursor1_old ;;
extern int mb_window_cursor2_old ;;
extern int math_mul_scale ;;
extern int math_sub_scale ;;
extern int math_add_scale ;;

extern FloatStr Pulse11;
extern FloatStr Pulse21;
extern FloatStr Pulse12;
extern FloatStr Pulse22;
extern FloatStr Cursor_Delta_X;	
extern FloatStr Cursor_Delta_1X;
extern FloatStr Cursor_Delta_XY_X;
extern FloatStr Cursor_Delta_Y;
extern FloatStr Cursor_Vertical_Pos_1_Str;
extern FloatStr Cursor_Vertical_Pos_2_Str;
extern FloatStr Cursor_Vertical_Pos_XY_1_Str;
extern FloatStr Cursor_Vertical_Pos_XY_2_Str;
extern FloatStr Cursor_Horizontal_Pos_1_Str;
extern FloatStr Cursor_Horizontal_Pos_2_Str;
extern FloatStr QM_Slot1;
extern FloatStr QM_Slot2;
extern FloatStr QM_Slot3;
extern FloatStr QM_Slot1_Value;
extern FloatStr QM_Slot2_Value;
extern FloatStr QM_Slot3_Value;
extern FloatStr QM_Threshold_lower;
extern FloatStr QM_Threshold_middle;
extern FloatStr QM_Threshold_upper;
extern FloatStr Math_Offset;
extern FloatStr Math_Offset_mul;
extern FloatStr Math_Offset_sub;
extern FloatStr Math_Offset_add;
extern int dcd_channel_buf ;;
extern int dcd_volt_buf ;;
extern int dcd_zero_buf ;;
extern int dcd_voltmfactor_buf ;;
extern int dcd_hz1_buf ;;
extern int dcd_hz2_buf ;;
extern int dcd_vz1_buf ;;
extern int dcd_vz2_buf ;;
extern int dcd_time_buf ;;
extern FloatStr Zero_Level1_Str;
extern FloatStr Zero_Level2_Str;
extern FloatStr Zero_Level3_Str;
extern FloatStr Zero_Level4_Str;
extern int dzp_channel_buf ;;
extern short dzp_fprobe_buf ;;
extern char dzp_fselected_voltage_buf ;;
extern FloatStr Trigger_Level_Str;
extern FloatStr Trigger_ExtLevel_Str;
extern int ct_Selected_Trigger_Source_buf ;;
extern int ct_volt_buf ;;
extern int ct_voltmfactor_buf ;;
extern FloatStr Timebase_Offset_Str;  // unused
extern FloatStr Trigger_Offset_Str;
extern FloatStr HoldOff;
extern FloatStr FFT_Scale_Str;  // unused
extern FloatStr FFT_Offset_Str;
extern unsigned short MenuDef[32][3] ;
extern unsigned char MenuText[32][17] ;
extern unsigned short MenuItemDef[32][6] ;
extern unsigned char MenuItem151[16] ;;
extern unsigned char MenuItem[32][6][16] ;
extern unsigned char MenuEdgeBufText[7] ;;
extern unsigned short MenuDataDef[193] ;
extern char MenuData[193][16] ;
extern short MenuStatus[32][6] ;
extern short MenuPopupStatus[31][22] ;
extern unsigned short MenuPopupDef[31][2] ;;
extern char MenuPopupText[31][23][20] ;
//extern char SampleRateData[15][10] ;;
extern char Stringlist[1][32] ;;
extern char PatternStatus[5] ;;
extern unsigned short TriggerDataDef[11] ;;
extern unsigned char TriggerData[11][12] ;
extern unsigned short TimebaseDataDef[34] ;
extern unsigned char TimebaseData[34][10] ;
extern unsigned short SampleRateDataDef[34] ;
extern unsigned char SampleRateData[34][11] ;
extern const short TimebaseData_Matrix[34][5][10] ;
extern const float Timebase_Delayed_Factor_Matrix[34][5] ;
extern const unsigned short VoltageDataDef[11] ;;
extern const char VoltageData[11][5] ;
extern const float Voltage_Value_Matrix[12][13] ;
extern unsigned char FONT10X9[100][28];
extern unsigned char FONT12X9[120][28];
extern unsigned char bitbmBigArrowUp[] ;
extern unsigned char bitbmBigArrowDown[] ;
extern unsigned char bitbmCycleArrow[] ;
extern unsigned char bitbmSelectCycleArrow[] ;
extern unsigned char bitbmTimebaseOffset[] ;
extern unsigned char bitbmSubMenu[] ;
extern unsigned char bitbmCH1[] ;
extern unsigned char bitbmCH1_gnd[] ;
extern unsigned char bitbmCH1_XY[] ;
extern unsigned char bitbmCH2[] ;
extern unsigned char bitbmCH2_gnd[] ;
extern unsigned char bitbmCH3[] ;
extern unsigned char bitbmCH3_gnd[] ;
extern unsigned char bitbmCH4[] ;
extern unsigned char bitbmCH4_gnd[] ;
extern unsigned char bitbmMin[] ;
extern unsigned char bitbmMax[] ;
extern unsigned char bitbmTrigger[] ;
extern unsigned char bitbmTrigAVG[] ;
extern unsigned char bitbmCoppAC[] ;
extern unsigned char bitbmCoppDC[] ;
extern unsigned char bitbmCoppInv[] ;
extern unsigned char bitbmCoppLimit[] ;
extern unsigned char bitbmCoppLimit[] ;
extern unsigned char bitbmCoppACInv[] ;
extern unsigned char bitbmCoppACLimit[] ;
extern unsigned char bitbmCoppInvLimit[] ;
extern unsigned char bitbmCoppFull[] ;
extern unsigned char bitbmStopTrigger[] ;
extern unsigned char bitbmStopTrigger_stop[] ;
extern unsigned char bitbmWTAG[] ;

extern bool screen_sel;
extern bool screen_sel_old;
// support_interrupts   ;
// CONSTANTS            ;
// sim_extern char_stream  ;
// sim_extern char_stream  ;
