Hello all,
I'am using TM4C1294XL launchpad for my project development. I want to send the ADC data to labview software via UART. Below is my code setup
- MCU clock @120MHZ
- ADC sampling rate set to 256Hz with help of TIMER
- Serial transmission protocol is 115200bps, 8-N-1.
- Using UART0 for serial communication..
Below is while(1) loop of the main function
while(1)
{
ADCIntClear(ADC0_BASE, 1);
while(!ADCIntStatus(ADC0_BASE, 1, false))
{
}
ADCSequenceDataGet(ADC0_BASE, 1, ui32ADC0Value);
for(j=0;j<=255;j++)
{
outputsamples1[j] = ui32ADC0Value[0] ;
outputsamples2[j] = ui32ADC0Value[1] ;
outputsamples3[j] = ui32ADC0Value[2] ;
outputsamples4[j] = ui32ADC0Value[3] ;
}
CH1DATA= outputsamples1[a];
CH2DATA= outputsamples2[a];
CH3DATA= outputsamples3[a] ;
CH4DATA= outputsamples4[a];
/**** CONVERT 12 BIT ADC DATA TO 8 BIT****/
al = CH1DATA & 0xF00;
al = al>>8;
ah = CH1DATA & 0xFF;
bl = CH2DATA & 0xF00;
bl = bl>>8;
bh = CH2DATA & 0xFF;
cl = CH3DATA & 0xF00;
cl = cl>>8;
ch = CH3DATA & 0xFF;
dl = CH4DATA & 0xF00;
dl = dl>>8;
dh = CH4DATA & 0xFF;
CH1D = al | (ah<<8);
CH2D = bl | (bh<<8);
CH3D = cl | (ch<<8);
CH4D = dl | (dh<<8);
UARTPrintf("%d",CH1D);
UARTPrintf("%d",CH2D);
UARTPrintf("%d",CH3D);
UARTPrintf("%d",CH4D);
a=a+1;
if(a==256)
{
a=0;
}
}
I'am testing the code by sending sinewave but at the labview part the waveform is not coming as sinewave, instead it is some random noisy signal.
Do I need to convert the data into string before sending it to labview?If Yes, then how to do that?? Can't we send integers directly?
I also tried the UARTCharPut(UART0_BASE,CH1D) command But it is not sending anything to the PC.
Kindly help!!.