/*
 *
 * This function returns 1 if CRO to be used
 *  or else returns 0
 *
 */
 int cro_use(void)
 {
  char choice;
  clear_help();
  gotoxy(1,21);
  write(1,"PRESS y TO USE C.R.O:",21);
  choice = getche();
  clear_help();
  if(window_flag && (choice == 'y' || choice == 'Y') ) {
	window_flag = 0;
	initgraph(&gdriver,&gmode, "");
  }
  return(choice == 'y' || choice == 'Y');
 }




/*
 *
 * This function returns time unit selcted in micro seconds
 * In case of improper choice made return value defaults to
 * 20micro seconds per unit
 *
 */


 int cro_x(void)
 {
  char time_unit;
  char *help_buff = "YOU ARE SETTING SECONDS ON TIME AXIS                                           \nPRESS 1,2,3,4,5,6,7,8,9 OR 0 TO SELECT (MICRO SECONDS) 20K,10K,5K,2K,          \n1K,500,200,100,50 OR 20 .ANY OTHER KEY IS TAKEN AS 0.                          \n";


  clear_help();
  gotoxy(1,20);
  write(1,help_buff,240);
  time_unit = getche();
  clear_help();
  switch(time_unit) {
	case '1':return(20000);
	case '2':return(10000);
	case '3':return(5000);
	case '4':return(2000);
	case '5':return(1000);
	case '6':return(500);
	case '7':return(200);
	case '8':return(100);
	case '9':return(50);
	case '0':return(20);
  }
  return(20);
 }


/*
 *
 * This function returns voltage unit selected in milli volts
 * In case of improper choice made return value defaults to
 * 1000milli volts per unit
 *
 */
 int cro_y(int k)
 {
  char voltage_unit;
  char help_buff[512];


  sprintf(help_buff,"YOU ARE SETTING VOLTS PER ONE UNIT ON Y_AXIS FOR PORT %3d:                     \nPRESS 1,2,3,4,5,6,7,8 OR 0 TO SELECT 2V,.5V,.2V,.1V,50mV,20mV,10mV,1mV OR 1V   \nANY OTHER KEY IS TAKEN AS 0.DO NOT PRESS ENTER KEY AFTER YOUR ENTRY            \n",k);
  clear_help();
  gotoxy(1,20);
  write(1,help_buff,240);
  voltage_unit = getche();
  clear_help();
  switch(voltage_unit) {
	case '1':return(2000);
	case '2':return(500);
	case '3':return(200);
	case '4':return(100);
	case '5':return(50);
	case '6':return(20);
	case '7':return(10);
	case '8':return(1);
	case '0':return(1000);
  }
  return(1000);
 }
