Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

using 4 adc channel of xmega64 A3 microcontroller

Status
Not open for further replies.

skaddi

Newbie level 5
Joined
Nov 4, 2013
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
68
Hi all;
due to the point that xmega64 A3 has two ADC ( ADC A & ADC B) that each one has 4 channel;
I started to use 3 channel of ADC A.
but , the received data from third channel is always wrong. However the first & second one are true .
Now ,I really don't know what is the problem?
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,755
Helped
4,347
Reputation
8,703
Reaction score
4,309
Trophy points
1,393
Activity points
130,768
Hi,

it is impossible tu guess what is wrong.

We need valid informations: Code and schematic.

* "is always wrong". What does that mean? ---> We need a much more detailed error description. Values...

Klaus
 
  • Like
Reactions: skaddi

    skaddi

    Points: 2
    Helpful Answer Positive Rating

skaddi

Newbie level 5
Joined
Nov 4, 2013
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
68
Hi,

it is impossible tu guess what is wrong.

We need valid informations: Code and schematic.

* "is always wrong". What does that mean? ---> We need a much more detailed error description. Values...

Klaus
you are right...
for more detail in continue I will put my schematic and the codes.
vfb battery.JPG
I want to read the VFB_BATTERY in third channel...

the codes for ADCA :

Code:
  adc_get_calibration_data(ADC_CAL_ADCA);
    adc_set_conversion_parameters(&adca_conf,ADC_SIGN_OFF,ADC_RES_12,ADC_REF_AREFA);
    adc_set_clock_rate(&adca_conf,125000UL);
    adc_set_conversion_trigger(&adca_conf,ADC_TRIG_FREERUN_SWEEP,3,0);
   // adc_set_config_compare_value(adcb_conf,KCK_MAX_CHARGE_AMP);
    adc_write_configuration(&ADCA,&adca_conf);


and the setting for each channel :

Code:
////for test by zahra  for motor 4 in channel 0
    //
	adcch_read_configuration(&ADCA,1,&adca_ch_conf);
	adcch_set_input(&adca_ch_conf,ADCCH_POS_PIN6,ADCCH_NEG_NONE,ADC_CH_GAIN_1X_gc);
	//adcch_disable_interrupt(&adcb_ch_conf);
	adcch_write_configuration(&ADCA,1,&adca_ch_conf);
	
	//for test by zahra  for VFB_battery.. in channel 2
	
	adcch_read_configuration(&ADCA,3,&adca_ch_conf);
	adcch_set_input(&adca_ch_conf,ADCCH_POS_PIN3,ADCCH_NEG_NONE,ADC_CH_GAIN_1X_gc);
	//adcch_disable_interrupt(&adcb_ch_conf);
	adcch_write_configuration(&ADCA,3,&adca_ch_conf);
	
	/* Configure ADC channel 1:  motor3 current feedback
    * - Input: ADCB5
    * - Set Interrupt Mode: Below the threshold
    * - interrupts disable
    //*/
    adcch_read_configuration(&ADCA,2, &adca_ch_conf);
    adcch_set_input(&adca_ch_conf,ADCCH_POS_PIN5,ADCCH_NEG_NONE,ADC_CH_GAIN_1X_gc);
	//adcch_set_interrupt_mode(&adcb_ch_conf,ADCCH_MODE_ABOVE);
	//adcch_enable_interrupt(&adcb_ch_conf);
    adcch_write_configuration(&ADCA,2,&adca_ch_conf);  
		
    
    
    adc_enable(&ADCA);
    adc_start_conversion(&ADCA,ADC_CH0);
    adc_start_conversion(&ADCA,ADC_CH1);
    adc_start_conversion(&ADCA,ADC_CH2);
    //adc_start_conversion(&ADCA,ADC_CH3);

thanks for your attention...
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,755
Helped
4,347
Reputation
8,703
Reaction score
4,309
Trophy points
1,393
Activity points
130,768
Hi,

This is neither a schematic nor an error description.
I'm out.

Good luck.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top