int main(void)
{
	init_PM();
	init_LCD();
	init_Potentiometer();
	init_CurrentSensor();
	init_INTC();
	fill_Display();
	set_Velocidad(velocidad);
	set_Direccion(direccion);
	init_PWM(velocidad,direccion);
	while (1)
	{
		adc_start(&AVR32_ADC);
		adc_value_pot = adc_get_value(&AVR32_ADC,EXAMPLE_ADC_POTENTIOMETER_CHANNEL);
		adc_start(&AVR32_ADC);
		adc_value_current = adc_get_value(&AVR32_ADC,3);
		set_Duty_Cycle(adc_value_pot);
		set_Current(adc_value_current);
		if(bandera ==1){
			set_Velocidad(velocidad);
			set_Direccion(direccion);
			update_PWM(velocidad, direccion);
		}
		delay_ms(400);
	}//WHILE
}//MAIN
/**@brief Battery measurement timer timeout handler.
 *
 * @details This function will be called each time the battery level measurement timer expires.
 *          This function will start the ADC.
 *
 * @param[in]   p_context   Pointer used for passing some arbitrary information (context) from the
 *                          app_start_timer() call to the timeout handler.
 */
void battery_level_meas_timeout_handler(void * p_context)
{
    UNUSED_PARAMETER(p_context);
 #if ADC_BAT_LV_Func  
   	adc_start();
 #endif	
}
Ejemplo n.º 3
0
 /****************************************************************************
 Reads the Analog 2 pin on Due.
 Retun values for the IR sensor.
 ****************************************************************************/
 uint32_t ReadAnalog2(void)
 {
	 uint32_t IRSensorer;
	 adc_start(ADC);
	 IRSensorer = adc_get_channel_value(ADC,ADC_CHANNEL_5);
	 return IRSensorer;
 }
Ejemplo n.º 4
0
static hal_result_t s_cmd_set_curr_tare(uint8_t *data_in, uint8_t *data_out, uint8_t *len_data_out) // CAN_CMD_SET_CURR_TARE
{ 
    hal_result_t res = hal_res_OK;
    int16_t sender_status;
    adc_state_t adc_st;

//******************************************************************************
//********************* IMPORTANTE***********************************************
//ferma la spediziobne di messaggi perchè la current tare è coinvolta nei calcoli
    sender_status = sender_is_running();
    sender_stop();    
    
    switch(data_in[1])
    {
        case 0:
        {
            calc_current_tare_init();
        } break;
        
        case 1:
        {
            /* In this case I must stop adc because new tare values depend on adc values.*/
            adc_st = adc_is_running();
            adc_stop();

            calc_current_tare_reset();

            if(adc_st_started == adc_st)
            {
                adc_start();
            }
        } break;
        
        case 2:
        {

            res = calc_current_tare_set_value(data_in[2], (data_in[3]<<8 | data_in[4]));
        } break;

#warning -> acemor: nei default si devono mettere i break.        
        default:
        {
            res = hal_res_NOK_wrongparam; 
        } break;
    
    }

    if(sender_status)
    {
        sender_start();
    }

    if(hal_res_OK != res)
    {
        return(hal_res_NOK_wrongparam); 
    }

    *len_data_out = 0;
    return(res); 
}  
Ejemplo n.º 5
0
Archivo: main.c Proyecto: nesl/nilmbee
int main(void)
{
    //uint8_t last_is_zero = 1;

    uint8_t i, is_active;
    uint8_t adcv, adcmax, adcmin;
    uint8_t score = 0, score_shifter = 0;

    pin_init();
    adc_init();

    while(1) {
        for (i=0, adcmax=0, adcmin=255; i<100; i++) {
            adc_start();
            while (!(ADCSRA & (1<<ADIF)));
            adcv = ADCL;
            if (adcv > adcmax) adcmax = adcv;
            if (adcv < adcmin) adcmin = adcv;
        }
        rand_counter ++ ;

        tx_word(adcmax - adcmin);
        _delay_ms(400);
    }
}
Ejemplo n.º 6
0
void TC0_Handler(void)
{	static b = 0;
	volatile uint32_t ul_dummy;
	ul_dummy = tc_get_status(TC0,0);
	adc_start(ADC);

}
Ejemplo n.º 7
0
void bios(void) {
  uart_start();
  pwm_setup(2);
  adc_start(1);
  twi_start();

  //button code
  init_buttons();

  //set the CPU_POW led pin to high to show we have power
  DDRD |= (1<<CPU_POW);
  PORTD |= (1<<CPU_POW);

  //set the status leds as outputs
  DDRD |= (1<<stat_led1);
  DDRD |= (1<<stat_led2);

  //if this is my dev board, pull them low because the leds are cathode
  #if DEV
    PORTD &= ~(1<<stat_led1)
          & ~(1<<stat_led2);
  #endif

  #if DEBUG
    uart_sendstr("0x01 - Hardware setup successful...");
    uart_sendstr("Bios complete...");
    uart_sendstr("Starting main code...");
  #endif
  return;
}
Ejemplo n.º 8
0
 /***************************************************************************
 Reads the Analog 0 pin on Due.
 Retun values for the x-axis of the joystick.
 ***************************************************************************/
 uint32_t ReadAnalog0(void)
 {
	 uint32_t xAngle;
	 adc_start(ADC);
	 xAngle = adc_get_channel_value(ADC,ADC_CHANNEL_7);
	 return xAngle;
 }
Ejemplo n.º 9
0
void TC0_Handler(void){

  volatile uint32_t ul_dummy, status;
  uint32_t valorDAC = 1024;
  ul_dummy = tc_get_status(TC0,0);
  UNUSED(ul_dummy);
  

  /************************************************************************/
  /* ADC                                                                     */
  /************************************************************************/
  if(nleituraADC >= 500){
	 adc_start(ADC);
	 nleituraADC = 0;
   }
   nleituraADC++;

  /************************************************************************/
  /* Escreve um novo valor no DAC                                         */
  /************************************************************************/
  status = dacc_get_interrupt_status(DACC_BASE);

  /* namostra > 2*pi  ?? */
  if(namostra > resolucao)
	namostra = 0;

  ySeno = (sin(deltaTeta*namostra)+1)*((float)max_digital)/MAX_AMPLITUDE_ANAG;
  dacc_write_conversion_data(DACC_BASE, ySeno);

  namostra++;

 
}
Ejemplo n.º 10
0
static void rtouch_start_read(uint32_t channel)
{
#ifdef AVR32_ADCIFA
	volatile avr32_adcifa_t *adcifa = &RTOUCH_ADC;

	s_current_channel = channel;

	if (channel < 8) {
		adcifa_sequence_conversion_opt[0].channel_p = channel;
		adcifa_sequence_conversion_opt[0].channel_n = AVR32_ADCIFA_INN_GNDANA;
		adcifa_sequence_conversion_opt[0].gain      = ADCIFA_SHG_1;
	} else {
		adcifa_sequence_conversion_opt[0].channel_p = AVR32_ADCIFA_INP_GNDANA;
		adcifa_sequence_conversion_opt[0].channel_n = channel;
		adcifa_sequence_conversion_opt[0].gain      = ADCIFA_SHG_1;
	}

	adcifa_configure_sequencer(adcifa, 0, &adcifa_sequence_opt,
			adcifa_sequence_conversion_opt);

	adcifa_start_sequencer(adcifa, 0);
#else
	volatile avr32_adc_t *adc = &RTOUCH_ADC;

	/* disable all touch channels */
	adc->chdr = RTOUCH_ADC_XL_CHANNEL | RTOUCH_ADC_YL_CHANNEL
			| RTOUCH_ADC_XH_CHANNEL | RTOUCH_ADC_YH_CHANNEL;

	/* enable current touch channel */
	adc->cher = channel;
	adc_start(adc);
#endif
}
Ejemplo n.º 11
0
// Start converting the enabled channels
void AnalogInStartConversion(uint32_t channels)
{
#if SAM3XA || SAM4S
	// Clear out any existing conversion complete bits in the status register
	for (uint32_t chan = 0; chan < 16; ++chan)
	{
		if ((adc_get_status(ADC) & (1 << chan)) != 0)
		{
			(void)adc_get_channel_value(ADC, static_cast<adc_channel_num_t>(chan));
		}
	}
	adc_start(ADC);
#elif SAM4E
	channels &= activeChannels;
	if ((channels & 0x0000FFFF) != 0)
	{
		StartConversion(AFEC0);
	}
	if ((channels & 0xFFFF0000) != 0)
	{
		StartConversion(AFEC1);
	}
#elif SAME70
	channels &= activeChannels;
	if ((channels & 0x000003FF) != 0)
	{
		StartConversion(AFEC0);
	}
	if ((channels & 0x003FF800) != 0)
	{
		StartConversion(AFEC1);
	}
#endif
}
Ejemplo n.º 12
0
 /****************************************************************************
 Reads the Analog 1 pin on Due.
 Retun values for the y-axis of the joystick.
 ****************************************************************************/
 uint32_t ReadAnalog1(void)
 {
	 uint32_t yAngle;
	 adc_start(ADC);
	 yAngle = adc_get_channel_value(ADC,ADC_CHANNEL_6);
	 return yAngle;
 }
Ejemplo n.º 13
0
static hal_result_t s_cmd_set_tx_mode(uint8_t *data_in, uint8_t *data_out, uint8_t *len_data_out) // CAN_CMD_SET_TXMODE: // set continuous or on demand tx  0x205 len 2  data 7 0/1
{
    sender_stop();
    adc_stop();

    switch(data_in[1])
    {
        case 0://transmit calibrated data
        {
            CFG_6SG_BEHAV.tx_outMsg_mode = tx_outMsg_torqueData_on;
            s_tx_mode_check();
            adc_start();
            sender_start();
        } break;

        case 1: //do acquisition, but do not transmit
        {
            CFG_6SG_BEHAV.tx_outMsg_mode = tx_outMsg_readOnly;
            adc_start();
        } break;

        case 2: //debug mode
        {
            CFG_6SG_BEHAV.tx_outMsg_mode = tx_outMsg_off;
            
        } break;

        case 3: //TODO: transmit not calibrated data
        {
            CFG_6SG_BEHAV.tx_outMsg_mode = tx_outMsg_uncalibData_on;
            sendAmsg = 1;
            sendBmsg = 1;
            adc_start();
            sender_start();
        } break;

        case 4: //TODO: transmit calibrated and not calibrated
        {

        } break;


    }
    
    *len_data_out = 0;
    return(hal_res_OK);
}
Ejemplo n.º 14
0
void init_devices(void)
{
    // --------------------------------------------------------------
    // DDR and core CPU init
    // --------------------------------------------------------------

    // stop errant interrupts until set up
    cli();

    MCUCR = 0;
    TIMSK = 0;
    //GICR  = 0x00;

#if HALF_DUPLEX
    HALF_DUPLEX_DDR |= _BV(HALF_DUPLEX_PIN);
#endif

    LED1_DDR |= _BV(LED1);
    LED2_DDR |= _BV(LED2);


    // --------------------------------------------------------------
    // initialize subsystems
    // --------------------------------------------------------------

    lcd_init();
    uart_init();

    adc_init();

#if SERVANT_NPWM > 0
    timer1_init();      	// timers 0, 1
#endif

    timer0_init();
    sei(); 			// re-enable interrupts

    modbus_init();

    lcd_clear();
    lcd_gotoxy( 0, 0 );
    lcd_puts("Scan 1Wire:");
    lcd_gotoxy( 0, 1 );
    init_temperature();


    menu_init();

    // --------------------------------------------------------------
    // all peripherals are now initialized, start 'em
    // --------------------------------------------------------------

    adc_start();

#if SERVANT_NPWM > 0
    timer1_start();
#endif

}
Ejemplo n.º 15
0
static int init(struct widget *w)
{
    struct widget_priv *priv;

    priv = (struct widget_priv*) widget_malloc(sizeof(struct widget_priv));
    if (priv == NULL)
        return -1;
    w->priv = priv;


    switch (w->cfg->props.mode) {
        default:
        case 0:
            add_mavlink_callback(MAVLINK_MSG_ID_SYS_STATUS, mav_callback, CALLBACK_WIDGET, w);
            w->cfg->w = X_SIZE;
            w->cfg->h = Y_SIZE;
            break;
        case 1:
            /* adc ch 0 */
            adc_start(1);
            adc_link_ch(0, &priv->adc_raw);
            w->cfg->w = X_SIZE;
            w->cfg->h = 15;
            add_timer(TIMER_WIDGET, 2, timer_callback, w);
            break;
        case 2:
            /* adc ch 1 */
            adc_start(1);
            adc_link_ch(1, &priv->adc_raw);
            w->cfg->w = X_SIZE;
            w->cfg->h = 15;
            add_timer(TIMER_WIDGET, 2, timer_callback, w);
            break;
        case 3:
            /* adc ch 0,1 */
            adc_start(1);
            adc_link_ch(0, &priv->adc_raw);
            adc_link_ch(1, &priv->adc_raw2);
            w->cfg->w = X_SIZE;
            w->cfg->h = 30;
            add_timer(TIMER_WIDGET, 2, timer_callback, w);
            break;
    }

    return 0;
}
Ejemplo n.º 16
0
uint16_t
pressure_get (void)
{
    adc_start (PRESSURE_SENSOR_ADC);
    while (!adc_checkf ())
	;
    return adc_read ();
}
Ejemplo n.º 17
0
void adc_open_v1q()
{
    NUM_CHS2SCAN = 4;
    TRISBbits.TRISB3 = 1; // OPTIONAL
	TRISBbits.TRISB8 = 1; // input
    TRISBbits.TRISB9 = 1; // input

    TRISAbits.TRISA7 = 1; // input

	AD1CON1bits.FORM   = 0b10;	// Data Output Format: Fractional
	AD1CON1bits.SSRC   = 0b111;	// Sample Clock Source: internal timer (auto-convert)
	AD1CON1bits.ASAM   = 1;		// ADC Sample Control: Sampling begins immediately after conversion
	AD1CON1bits.AD12B  = 0;		// 12-bit ADC operation


	AD1CON2bits.CSCNA = 1;		// Scan Input Selections for CH0+ during Sample A bit
	AD1CON2bits.CHPS  = 0;		// Converts CH0
	AD1CON2bits.VCFG  = 0b000;  // use AVDD and AGND

	AD1CON3bits.ADRC = 0;		// ADC Clock is derived from Systems Clock (0; 1=internal clock)
	AD1CON3bits.ADCS = 63;		// ADC Conversion Clock Tad=Tcy*(ADCS+1)= (1/40M)*64 = 1.6us (625Khz)
								// ADC Conversion Time for 10-bit Tc=12*Tab = 19.2us
	AD1CON3bits.SAMC = 31;  // auto sample time bits

	/*
	Conversion time = sample + conversion
	                = 31*tad + 14*tad (12-bit)
	Conversion time * 7 * 8 = 0.0007s
	*/


	AD1CON1bits.ADDMABM = 0; 	// DMA buffers are built in scatter/gather mode
	AD1CON2bits.SMPI    = (NUM_CHS2SCAN-1);	// 4 ADC Channel is scanned
	AD1CON4bits.DMABL   = 3;	// Each buffer contains 8 words

	//AD1CSSH/AD1CSSL: A/D Input Scan Selection Register
	AD1CSSH = 0x0000;
	AD1CSSL = 0x0000;
	AD1CSSLbits.CSS3 = 1;			// Enable AN0 for channel scan
	AD1CSSLbits.CSS8 = 1;
	AD1CSSLbits.CSS9 = 1;
    AD1CSSHbits.CSS23 = 1; // RA7

 	//AD1PCFGH/AD1PCFGL: Port Configuration Register
	AD1PCFGL=0xFFFF;
	AD1PCFGH=0xFFFF;
	AD1PCFGLbits.PCFG3 = 0;		// AN0 as Analog Input
	AD1PCFGLbits.PCFG8 = 0;
 	AD1PCFGLbits.PCFG9 = 0;
	AD1PCFGHbits.PCFG23 = 0;

    IFS0bits.AD1IF   = 0;		// Clear the A/D interrupt flag bit
	IEC0bits.AD1IE   = 0;		// Do Not Enable A/D interrupt

	initDma0();

	adc_start();
}
Ejemplo n.º 18
0
uint32_t analogRead(void)
{
	adc_start(ADC);
	//delay_us(100);
	//delayMicroseconds(100);
	
	return adc_get_channel_value(ADC,ADC_CHANNEL_7);
	/* Replace with actual value read from A/D input*/
}
Ejemplo n.º 19
0
uint32_t adc_sample(const struct adc *adc)
{
	uint32_t data;
	adc_sel_in(adc->hw_idx);
	adc_start();
	while (ADCSRA & (1 << ADSC));
	data = adc_data();
	return data;
}
Ejemplo n.º 20
0
/**
 * \brief adc_temp_sensor Application entry point.
 *
 * Initialize adc to 12-bit, enable channel 15,turn on
 * temp sensor, pdc channel interrupt for temp sensor
 * and start conversion.
 *
 * \return Unused (ANSI-C compatibility).
 */
int main(void)
{
	/* Initialize the SAM system. */
	sysclk_init();
	board_init();

	/* Disable watchdog. */
	WDT->WDT_MR = WDT_MR_WDDIS;

	configure_console();
	/* Output example information. */
	puts(STRING_HEADER);

	/* 10 ms timer */
	if (SysTick_Config(sysclk_get_cpu_hz() / 100)) {
		puts("-F- Systick configuration error\r");
		while (1) {
		}
	}
	/* Enable peripheral clock. */
	pmc_enable_periph_clk(ID_ADC);
	/* Initialize ADC. */
	/*  startup = 8:    512 periods of ADCClock
	 * for prescale = 4
	 *     prescale: ADCClock = MCK / ( (PRESCAL+1) * 2 ) => 64MHz / ((4+1)*2) = 6.4MHz
	 *     ADC clock = 6.4 MHz
	 */
	adc_init(ADC, sysclk_get_cpu_hz(), 6400000, 8);

	adc_configure_timing(ADC, 0, ADC_SETTLING_TIME_3, 1);

	adc_configure_trigger(ADC, ADC_TRIG_SW, 0);

	adc_check(ADC, sysclk_get_cpu_hz());

	/* Enable channel for potentiometer. */
	adc_enable_channel(ADC, ADC_TEMPERATURE_SENSOR);

	/* Enable the temperature sensor. */
	adc_enable_ts(ADC);

	/* Enable ADC interrupt. */
	NVIC_EnableIRQ(ADC_IRQn);
	
	/* Start conversion. */
	adc_start(ADC);

	adc_read_buffer(ADC, gs_s_adc_values, BUFFER_SIZE);
	
	/* Enable PDC channel interrupt. */
	adc_enable_interrupt(ADC, ADC_ISR_RXBUFF);

	while (1) {
	}
}
Ejemplo n.º 21
0
static void acc_get_value (
   volatile avr32_adc_t * adc
,  xyz_t* val ) {

  // get value for adc channel
  adc_enable(adc,  ADC_CHANNEL_X);
  adc_start(adc) ;
  val->x = ( adc_get_value(adc, ADC_CHANNEL_X) >> ACC_SHIFT ) ;
  adc_disable(adc, ADC_CHANNEL_X);

  adc_enable(adc,  ADC_CHANNEL_Y);
  adc_start(adc) ;
  val->y = ( adc_get_value(adc, ADC_CHANNEL_Y) >> ACC_SHIFT ) ;
  adc_disable(adc, ADC_CHANNEL_Y);

  adc_enable(adc,  ADC_CHANNEL_Z);
  adc_start(adc) ;
  val->z = ( adc_get_value(adc, ADC_CHANNEL_Z) >> ACC_SHIFT ) ;
  adc_disable(adc, ADC_CHANNEL_Z);
}
Ejemplo n.º 22
0
ISR(ADC_vect, ISR_NOBLOCK)
{
	adc_start();
	uint16_t result = ADC;
	uint8_t ch = ADMUX & 0x1F;
	struct handler_t *p = handlers;
	while (p) {
		p->handler(ch, result);
		p = p->next;
	}
}
Ejemplo n.º 23
0
void sens_calibrate(unsigned char t)
{
	unsigned long sum[8] = {0,0,0,0,0,0,0,0};

	adc_wait_stop();
	for(unsigned char i = 0; i < t; i++)
	{
		for(unsigned char j = 0; j < 8; j++)
		{
			adc_start(j, 0);
			while(bit_is_set(ADCSRA, ADSC));
			sum[j] += ADC;
		}
	}
	for(unsigned char j = 0; j < 8; j++)
	{
		adc_offset[j] = calc_multi(sum[j], 1, t);
	}
	adc_start(0, _BV(ADIE));
}
Ejemplo n.º 24
0
void task_ad(void *p)
{
	while(1)
	{
		portTickType xLastWakeTime;
		const portTickType xTimeIncrement = AD_SAMPLING_TIME;
		adc_start(ADC);
		//while((adc_get_status(ADC) & 0x1<<24)==0); //Wait until DRDY get high
		GetSensorValue();
		vTaskDelayUntil(&xLastWakeTime, xTimeIncrement);
	}
}
Ejemplo n.º 25
0
/*************************************************************************
*                             野火嵌入式開發工作室
*
*  函數名稱:ad_once
*  功能說明:采集一次一路模擬量的AD值
*  參數說明:ADCn        模塊號( ADC0、 ADC1)
*            ADC_Channel 通道號
*            ADC_nbit    精度( ADC_8bit,ADC_12bit, ADC_10bit, ADC_16bit )
*  函數返回:無符號結果值
*  修改時間:2012-2-10
*  備    注:參考蘇州大學的例程,B通道不能軟件觸發!!!!
*************************************************************************/
u16 ad_once(ADCn adcn,ADC_Ch ch,ADC_nbit bit)  //采集某路模擬量的AD值
{
    u16 result = 0;
    ASSERT( ((adcn == ADC0) && (ch>=AD8 && ch<=AD18)) || ((adcn == ADC1)&& (ch>=AD4a && ch<=AD17)) ) ;   //使用斷言檢測ADCn_CHn是否正常

    adc_start(adcn, ch, bit);	  //啟動ADC轉換

    while (( ADC_SC1_REG(ADCx[adcn], 0 ) & ADC_SC1_COCO_MASK ) != ADC_SC1_COCO_MASK);
    result = ADC_R_REG(ADCx[adcn],0);
    ADC_SC1_REG(ADCx[adcn],0) &= ~ADC_SC1_COCO_MASK;
    return result;
}
Ejemplo n.º 26
0
int main()
{

   motors_init();
   movman_init();
   contacts_init();
   event_q_init();
   adc_init();
   leds_init();

   sei();

   adc_start();

   movman_schedule_move(
      WAIT_5_SECONDS_THEN_FULL_FORWARD_FOR_A_LONG_TIME,
      TO_MEET_STARTUP_REQUIREMENT,
      IMMEDIATELY);

   while(1){

      // Testing in the lab showed this runs every ~95us

      event_t e = event_q_get_next_event();

      switch(e){

         case LINE_DETECTED:
            handle_line_detected();
            break;
         case CONTACT_DETECTED_BOTH:
         case CONTACT_DETECTED_FRONT:
            handle_front_contact();
            break;
         case CONTACT_DETECTED_REAR:
            handle_rear_contact();
            break;
         case MOVEMENT_COMPLETE:
            handle_movement_complete();
            break;
         case NEW_PROXIMITY_READINGS:
            handle_new_prox_readings();
            break;
         default:
            break;


      }

   }

   return 0;
}
Ejemplo n.º 27
0
void sens_init()
{
	for(unsigned int i = 0; i < 8; i++)
	{
		adc_offset[i] = 0;
	}

	adc_chan = 0;
	adc_new_cycle = 0;

	adc_start(0, _BV(ADIE));
}
Ejemplo n.º 28
0
/**
 * Enable/disable external power supply and start measurements
**/
void setSensorStatus(void) {
	if (config.enable) {
		SENS_PORT |= _BV(SENS_PIN);
		adc_start();
		windspeed_start();
		led_on();
	} else {
		SENS_PORT &= ~_BV(SENS_PIN);
		adc_stop();
		windspeed_stop();
		led_blink();
	}
}
Ejemplo n.º 29
0
/* Read the sensor value. Ususally the measurement is already started in sensor's 
 * open() function. For those who can started immediately, you can also power on 
 * the sensor in this function and power off it after the measurement.
 */
uint16 light_value( TiLightSensor * light )
{
	uint16 value=0;
	uint8 count=0;
	adc_start( light->adc );
	while (count == 0)
	{
		// dbo_putchar( '*' );
		count = adc_read( light->adc, (char*)&value, sizeof(value), 0x00 );
		// dbo_putchar( '&' );
	}
	return value;
}
Ejemplo n.º 30
0
void TC_Handler()
{
	volatile uint32_t ul_dummy;
	
	//Nollställ statusbit för att bekräfta interupt
	ul_dummy = tc_get_status(TC2, 2);
	
	UNUSED(ul_dummy); //Förhindra varning
	
	//Gör saker
	adc_start(ADC);
	result = adc_get_latest_value(ADC);
}