Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to communicate on UART with computer and read the value from the computer_ XSDK

Status
Not open for further replies.

Saras015

Banned
Joined
Apr 5, 2017
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
0
Hi all,

I am trying out an e.g. "Factorial" Program in SDK. I need to give input in Tera Terminal and answer should be printed back on the Console.

Suppose if i input "Enter the number " = 5 (In terminal), i need to get the result back = 120 on the console screen back. Please help me what syntax should use in the coding section to input and to get output on the screen.

I have used "XUartLite_RecvByte(XPAR_UARTLITE_0_BASEADDR)", but not working.

Code:
int main (void)
{

int input;
int i;
uint32_t fact=1;
while(1)
{

//reads from the Hyperterminal
input= XUartLite_RecvByte(XPAR_UARTLITE_0_BASEADDR);


if ((input>= 0x30) && (input <= 0x37))
{
//prints the data read from the HyperTerminal
	    	    {
		fact =fact*input;
	    	    }
xil_printf("%d ", fact);

}
else

{
xil_printf("\n\r please enter a VALID number (0 -> 7)\n\r");
}
}
}

Thanks.
 
Last edited by a moderator:

Hi,

I can´t find an error description.
So where is the problem?

* Say what you expect
* and how it behaves instead.

added:
and we need to see the complete code ....like UART setup,
and informations like: what microcontroler, what compiler...

Klaus
 

Thanks for your response. I am using XSDK and UART (Tera Terminal).

Like prinf and scanf statements in C compiler where we can give input in console and view the output in console, same like i need the "Factorial program" to be run in the TERA TERMINAL using XSDK.

" I need to give input manually in the UART using XSDK, and read the output in the UART". Is their any syntax to be followed to give input manually. Please if anyone response me. Thanks
 

It is also not very clear of what you want to do.

You want to read out the data which is inside the UART register XPAR_UARTLITE_0_BASEADDR and perform the factorial of that number?
If so, how do you know that XPAR_UARTLITE_0_BASEADDR contains a valid number whose fact. can be calc?
 

It is also not very clear of what you want to do.

You want to read out the data which is inside the UART register XPAR_UARTLITE_0_BASEADDR and perform the factorial of that number?
If so, how do you know that XPAR_UARTLITE_0_BASEADDR contains a valid number whose fact. can be calc?



‎I have a KC705 board. I am trying to write an application for "Factorial of N Numbers" in XSDK. I have connected UART as a peripheral, so that i can see the progress in the hyper terminal. I want to give the N values of variables in real time when the program is executing using like scanf function in C. so that when i enter i can see the variables in the hyper terminal. but the compiler is showing errors when i wrote like below.


Shall i use this "XUartLite_RecvByte() function. How it functions.

How can i give input to the terminal in real time. Anybody have any idea please help.


Thanks in advance
 

How to give i/ps in real time in hyper terminal using XSDK for microblaze processor

I have a KC705 board. I am trying to write an application for "Factorial of N Numbers" in XSDK. I have connected UART as a peripheral, so that i can see the progress in the hyper terminal. I want to give the N values of variables in real time when the program is executing using like scanf function in C. so that when i enter i can see the variables in the hyper terminal. but the compiler is showing errors when i wrote like below.


Shall i use this "XUartLite_RecvByte() function. How it functions.

How can i give input to the terminal in real time. Anybody have any idea please help.

Source code: IT IS NOT WORKING. ANY MODIFICATION IN CODES, please welcome


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
int main()
{
    int i;
    uint32_t fact=1;
    uint32_t N;
init_platform();
XFact Xfactorial;
XFact  *xfactptr=&Xfactorial;
XFact_Initialize(xfactptr,XPAR_FACT_0_DEVICE_ID);
print("\r\n----\r\nFactorial Function\n\r");
for(i=1;i<=10;i++)
        {
    fact =fact*i;
        }
 
//fact= XUartLite_RecvByte(XPAR_UARTLITE_0_BASEADDR);
 
XUartLite_SendByte(XPAR_FACT_0_S_AXI_A_BASEADDR, fact);
 
xil_printf("Factorial is %d\r\n", fact);
cleanup_platform();
   return 0;
}



Thanks in advance
 
Last edited by a moderator:

How to read and print 108-bit data in XSDK through terminal ?

XSDK is a 32-bit processor but i need to print data of 108-bit through XSDK in Tera Terminal. How to concatenate the functions to get 108-bit in XSDK.

Any idea and suggestion, please welcome.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top