Hello I am working with Stellaris lm3s3748
I wrote a code to read analog input signal from port ADC0 and write the output to pin U0TX to send the signal to the PC and display it, but am getting the same output signal (periodic pulses) what ever the analog in put is even without input the U0TX output is the same
I hope someone can help me if there is any problem in the code
#include "hw_types.h"
#include "hw_memmap.h"
#include "driverlib/adc.h"
#include "inc/lm3s3748.h"
#include <stdio.h>
#include "driverlib/gpio.h"
#include "hw_types.h"
#include "utils/ustdlib.h"
#include "grlib/grlib.h"
#include "driverlib/uart.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/rom.h"
#include "driverlib/debug.h"
#include "inc/hw_ints.h"
void main()
{
unsigned long ADC0Value[1];
SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
IntMasterEnable();
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
UARTEnable(UART0_BASE);
UARTIntEnable(UART0_BASE, UART_INT_TX);
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | ADC_CTL_IE | ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 3);
ADCIntClear(ADC0_BASE, 3);
while(1)
{
ADCProcessorTrigger(ADC0_BASE, 3);
while(!ADCIntStatus(ADC0_BASE, 3, false))
{}
ADCIntClear(ADC0_BASE, 3);
ADCSequenceDataGet(ADC0_BASE, 3, ADC0Value);
unsigned char y= ADC0Value[0];
UARTCharPut(UART0_BASE, y);
}
}
Thanks in advance