This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

msp430 bar graph

Other Parts Discussed in Thread: MSP430F5325, PCM9211

hello sir,

i am using msp430f5325, i am implementing bar graph using this. here i am using A3, A2,A1,A0 for input and output display to lcd. input comming but bar graph will not display. settings are as-

void adc_init()
{

P6SEL =0x0F;

ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_8; // Turn on ADC12, set sampling time
// set multiple sample conversion
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1; // Use sampling timer, set mode
ADC12MCTL0 = ADC12INCH_0; // ref+=AVcc, channel = A0
ADC12MCTL1 = ADC12INCH_1+ADC12EOS;
ADC12IE = 0x08; // Enable ADC12IFG.0 , ADC12IFG.1

}


////////////////////////////////////////////////////////////////////////////////////////

void adc_conv()
{

static unsigned int A0_RES=0,A1_RES=0;
static unsigned int counter=10;

ADC12CTL0 |= ADC12ENC;
// Enable conversions
ADC12CTL0 |= ADC12SC; // Start convn - software trigger

__delay_cycles(100);

A0_results += ADC12MEM0; // Move A0 results, IFG is cleared
A1_results += ADC12MEM1; // Move A1 results, IFG is cleared

counter--;
if(counter==0)
{
A0_RES = (A0_results/10);
A1_RES = (A1_results/10);
A1=A0_RES;
B1=A1_RES;

adc2lcd(A0_RES, A1_RES);

A0_results=0;
A1_results=0;

counter=10;
}

}

here if we given input through XLR then conversion not show but when we give value itself then display comming. 

so if you got any error then plz tell me. i am very confused about it.

  • What is XLR?
    And where do you put in values yourself?
  • Hello sir,
    about XLR- The XLR connector is a style of electrical connector, primarily found on professional audio, video, and stage lighting equipment. The connectors are circular in design and have between 3 and 7 pins. They are most commonly associated with balanced audio interconnection, including AES3 digital audio, but are also used for lighting control, low-voltage power supplies, and other applications.

    2- here i am using pcm9211, our input fst goes to pcm9211 and then output of pcm9211 connected to msp430 A3,A2,A1,A0 pins. here i am using pcm for analog to digital converter.

    i want to know that where is the problem???
    i think you can understand my problem.
  • Quick calculation: SHT0_8 means 256 clock cycles sampling, plus 13 clock cycles conversion. After setting ADC12SC, it takes therefore 538 ADC12 clock cycles to do the conversions. You apparently use the default clock of ~5.4MHz, so it takes about 100µs to complete. If your MSP runs with 1MHz, then the 100MLCK cycles delay might work. But you might be too early to read ADC12MEM1.
    You set ADC12IE.3, which would trigger an interrupt once a conversion on ADC12MEM3 is done. It luckily never happens as you do not have an ISR and this would reset or crash the MSP.
    Instead of the delay, do
    while(!(ADC12IFG & BIT1));
    This waits until the conversion on ADC12MEM1 is completed, independent of the CPU and ADC clock speeds.

    As for the further calculations, the type of the variables must be known. If e.g. A0_results is an INT, then dividing it by 10 will remove the decimals of this division, even if further calculations are done with FLOAT.

    Also, the ADC doesn't give you a voltage. It gives you a relation to its reference (which is VCC in this case). Currently, you will get a value of 0..409 which means 0..VCC. hint: if you do some calculations anyway, then eliminate noise on the lower bis by shifting the result right by 2 or 3 bits. Shift operations are some magnitudes faster than divisions. Try to avoid them. Do multiplications and 'divide' by shifting in powers of two.
  • Hi,
    thanks for your reply, i got your point and working on it.

**Attention** This is a public forum