Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21942

ADC of msp430

$
0
0

Hello,

I am  tringto read multiple channels from adc of msp430f1232 but having some problems. can someone please help me?

My code looks like this..

I initialized ADC as

ADC10CTL1 = 0x401E;
ADC10AE0 = 0x1C; //Port A2, A3 and A4 Enabled for Analogue
ADC10AE1 = 0x00;
ADC10DTC0 = 0x00;
ADC10DTC1 = 0x01;

void main()
//———————————
{
	Init();
	value1 = (unsigned int *)0x20B;
	value2 = (unsigned int *)0x20D;
	value3 = (unsigned int *)0x20F;
	// value = &MOD_Ua;
	__enable_interrupt(); // Enable all interrupts
	for(;;)
	{
		if (!(ADC10CTL1 & BIT0))                      // if not busy

		{

			ADC10SA = 0x20B; // Data buffer start

			ADC10CTL0 |= ENC + ADC10SC; // Start sampling and conversion
		}
	}
}

#pragma vector = ADC10_VECTOR

__interrupt void ADC10_ (void)
//————————————————————————————————
//--------------------------------------------------------------------------------
// ADC10 interrupt
//--------------------------------------------------------------------------------
{
	{
		P1OUT = P1OUT ^ BIT3;
		MOD_Uc = *value1;
		MOD_Ub = *value2;
		MOD_Ua = *value3;
	}
}

When i start debugging it enters in adc interrupt once and after that adc busy bit stays high and does not allow me to start sampling again. i saw in the debugger that adcmem register values keep on changing.

Also can you help me when it is said in the document that write to register ADC10SA is required to initiate DTC transfer.

Any help will be appreciated.


Viewing all articles
Browse latest Browse all 21942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>