XMEGA ADC, How to show?

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

XMEGA ADC
using CVAVR produce ADC, but I do not know how to use the seven-segment display show??Cry

This PCB is to produce their own.

I am a novice .....SmileSmile

************************************************** ***********************

I do not know how to change .....
 

 

// ADCA channel 0 interrupt service routine
// Interrupt Mode: End Conversion

Interrupt [ADCA_CH0_vect] invalid adca_ch0_isr ( void )
{ unsigned int data;

// Read the AD conversion result
signed int data; // Read the AD conversion result
((unsigned char *) &data)[0]=ADCA.CH0.RESL;
((unsigned char *) &data)[1]=ADCA.CH0.RESH; // ADC offset compensation

data-=adca_offset;
 

 

// Your code here processing data stored in the "data" ADC results

 

}

...

...

...
...

 

Void main (void)

{

While (1) {}

}

 

 

This topic has a solution.

Last Edited: Fri. May 15, 2015 - 02:54 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well for one thing you need "data" to be a global outside the interrupt code as you will want to do the display stuff outside the interrupt (which should be kept as short as possible). Also:

 

signed int data; // Read the AD conversion result
((unsigned char *) &data)[0]=ADCA.CH0.RESL;
((unsigned char *) &data)[1]=ADCA.CH0.RESH;

 

Seems a very complicated way to achieve the same as:

 

signed int data; // Read the AD conversion result
data = ADCA.CH0.RESL;
data |= (ADCA.CH0.RESH << 8);