Hi,
To check uart_echo example, what are the connections need to be made? and how the texts will display in hyperterminal ?
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.
Hi,
To check uart_echo example, what are the connections need to be made? and how the texts will display in hyperterminal ?
Hi Amit,
I have changed the settings to 115200bps. And COM5 port (specific port) is selected in hyperlink. And now
"Enter text:" is not displayed.
whatever I typed in the keyboard displayed in hyperlink and led blinks at the time. But how can i know the text is transmitted and recieved through controller? and may i know the expected output format of the example?
Hello Mary
The uart_echo example sends back the same data. To be certain and to be able to modify the data, in the interrupt handler change the while loop to read the data and do a case conversion using subtraction of the difference of upper and lower case and then send the modified data back
Regards
Amit
Hi Amit,
The GPIO_DATA register have 0x00000010. Is any header files need to be changed.
Hi Amit,
Actually I need to measure frequency deviation of AC signal. For that initially I am working with pulse. Now I develop a code to check zero crossing of AC input. Here is my code. I am giving input such that, the input goes to zero for every 0.02sec. And I am using TimerValueGet to get time period. But for every cycle the timer value varies (input fall to zero in 0.02 sec interval). Can you suggest what may be the error? Timer value mostly changes between 250000 to 310000. And one more thing, the value Time (Time=(TimeCount/320000);) mostly shows 0.0/1609. Thank you so much for your help.
#include <stdbool.h> #include <stdint.h> #include "inc/hw_memmap.h" #include "driverlib/adc.h" #include "driverlib/gpio.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "inc/hw_types.h" #include "driverlib/fpu.h" #include "driverlib/debug.h" #include "driverlib/timer.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" #define GPIO_PA0_U0RX 0x00000001 #define GPIO_PA1_U0TX 0x00000401 volatile unsigned long Old_Count; volatile unsigned long New_Count=0; int FallingEdges=0; volatile unsigned long TimeCount; float Ans; float frequency; float freq; float Time; float Time2,freq2,frequency2; int Cycle=0; int Time1,Temp1,Time3,freq1,Temp2,freq3,frequency1,Temp3,frequency3; void ConfigureUART(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); UARTStdioConfig(0, 115200, 16000000); } main(void) { uint32_t pui32ADC0Value[0]; SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN| SYSCTL_XTAL_16MHZ); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); SysCtlDelay(3); TimerDisable(TIMER0_BASE,TIMER_A); TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC_UP); TimerLoadSet(TIMER0_BASE, TIMER_A, 0x00FFFFFF); TimerEnable(TIMER0_BASE, TIMER_A); GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_5); ADCIntEnable(ADC0_BASE, 3); ADCSequenceDisable(ADC0_BASE, 3); ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 3, 0,ADC_CTL_CH8 | ADC_CTL_IE | ADC_CTL_END); ConfigureUART(); UARTprintf("\033[2JFrequency Measurement:-\n"); ADCSequenceEnable(ADC0_BASE, 3); while (1) { ADCProcessorTrigger(ADC0_BASE, 3); while (!ADCIntStatus(ADC0_BASE, 3, false)) { } ADCIntClear(ADC0_BASE, 3); ADCSequenceDataGet(ADC0_BASE, 3, pui32ADC0Value); Ans=(pui32ADC0Value[0]*3.3)/4095; UARTprintf("\npui32ADC0Value[0]:%d\n",pui32ADC0Value[0]); if (pui32ADC0Value[0]==0) { Old_Count=New_Count; New_Count=TimerValueGet(TIMER0_BASE, TIMER_A); UARTprintf("\nCycles:%d\n",Cycle); TimeCount=New_Count-Old_Count; Time=((float)TimeCount/320000); freq=1/Time; frequency=freq*50; //for float Time1=Time; Time2=Time*100000; Temp1=Time1*100000; Time3=Time2-Temp1; freq1=freq; freq2=freq*100000; Temp2=freq1*100000; freq3=freq2-Temp2; frequency1=frequency; frequency2=frequency*100000; Temp3=frequency1*100000; frequency3=frequency2-Temp3; UARTprintf("\nAns:%d\n",Ans); UARTprintf("\nCycles:%d\n",Cycle); UARTprintf("\nNew_Count:%d\n",New_Count); UARTprintf("\nOld_Count:%d\n",Old_Count); UARTprintf("\nTimeCount:%d\n",TimeCount); UARTprintf("\nTime:%d\n",Time); UARTprintf("\nTime:%d.%d\n",Time1,Time3); UARTprintf("\nFrequency:%d.%d\n",freq1,freq3); UARTprintf("\nFrequency:%d.%d\n",frequency1,frequency3); } } }
Hi Amit,
I tried that with "if (pui32ADC0Value<20)". Other values made more deviate in the measurement. And I got the measured frequency values for absolute 50Hz frequency input in terminal are:
Freq:49.45384 Freq:49.45109 Freq:41.91323 Freq:49.46454 Freq:49.24365 Freq:49.1525 Freq:49.23228 Freq:49.1795 Freq:49.23137 Freq:41.89633 Freq:49.1690 Freq:49.23683 Freq:49.1555 Freq:49.23804 Freq:49.924 Freq:49.45843 Freq:49.789 Freq:41.90565 Freq:49.1570
And I can't get the correct frequency. Why the timer value that much varies? What I need to change in the code to get the correct measure?