Example #1
0
static void
run_test(bool optimized GCC_UNUSED)
{
    char ch;
    int lo = continuous ? LO_CHAR : 'a' - LINES;
    int hi = continuous ? HI_CHAR : 'a' + LINES;

    if (lo < LO_CHAR)
	lo = LO_CHAR;
    if (hi > HI_CHAR)
	hi = HI_CHAR;

#if defined(TRACE) || defined(NCURSES_TEST)
    if (optimized) {
	Trace(("With hash mapping"));
	_nc_optimize_enable |= OPTIMIZE_HASHMAP;
    } else {
	Trace(("Without hash mapping"));
	_nc_optimize_enable &= ~OPTIMIZE_HASHMAP;
    }
#endif

    if (reverse_loops)
	for (ch = (char) hi; ch >= lo; ch--)
	    one_cycle(ch);
    else
	for (ch = (char) lo; ch <= hi; ch++)
	    one_cycle(ch);
}
Example #2
0
File: pwm.c Project: unais/MSP430-
main()
{
	P1DIR = BIT0;
	on_time = 0;
	while(1) {
		for(on_time=0;on_time<1000;on_time++)
			one_cycle();
		while(on_time--)
			one_cycle();

	}
}
Example #3
0
main()
{

	int dir = 1;
	P1DIR = 1;
	on_time = 0;
	while(1) {

	if(dir==1) 
		on_time +=20;
	else
		on_time -=20;
	
	one_cycle();
	

		if(on_time==MAX) 
			dir=-1;
			
	
		if(on_time==0) 
			dir=1;
			
	}
}
Example #4
0
main()
{
	int step = 10, dir = 1;
	P1DIR = BIT0;
	while(1) 
	{
		one_cycle();
		if(dir==1)
			on_time += step;
		else
			on_time -= step;
		if(on_time==0)
			dir = 1;
		if(on_time>=MAX)
			dir = -1; 
	}	
}
Example #5
0
int
main (int argc, char *argv[])
{

  int i;
  long seed = RAND_SEED;

  for (i = 1; i < argc; i++) {
    switch (*(argv[i] + 1)) {
    case 'r':
      seed = atoi (argv[++i]);
      break;
    default:
      fprintf (stderr, "Usage : %s\n", argv[0]);
      fprintf (stderr, "\t-r : random-seed(%ld)\n", seed);
      exit (0);
      break;
    }
  }

  srand48 (seed);
  init_1d_dk2011_bnf();

  // set_1d_ordered_connection();
  // test_symmetric_connections(1);
  init_gnuplot ();

  for (i = 0; i < N_LEARNING; i++) {
    if (i % 10 == 0) {
      sprintf (buf, "t=%d", i);
      //plot3d_gnuplot (buf);
      plot3d_gnuplot_file(buf,i);
    }
    one_cycle();
  }
  
}