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 i can input numbers > 9 for microblaze processor via 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
I am using inbyte() func. for input in my project.But i am facing a problem that with foresaid function i can only able to take numbers from 0~9.Is there anyway to take inputs >9?

Using Kintex 705 and Tera Terminal. I need to enter number above 9 in the terminal.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
int Factorial()
{
 
int i;
u32 fact=1;
u32 N, j;
while (1) {
print("Enter the number \n\r");
N = inbyte();
j = N - 0x30;
for (i=1; i<=j; i++)
{
fact = fact*i;
xil_printf("[sw] Factorial = %d\r\n", fact);
}
return fact;
}
}



Any suggestion. please welcome.
 

Attachments

  • Factorial_print console.PNG
    Factorial_print console.PNG
    178.9 KB · Views: 120

Similar to printf(), a C compiler has library functions to read formatted decimal input, e.g. scanf().
 

Thanks for your response. I cant understand please explain me in detail. How can i enter number above 9 in the terminal.

I am using XSDK and tera Terminal.
 

Since your input will be in decimal, #2 tells you to try out the alternative function scanf() instead of inbyte(). Else you need to explore what other functions are supported by the Xilinx compiler.
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
XUartLite_RecvByte and XUartLite_SendByte Not working_XSDK

Hi, I am fresher to VIVADO and XSDK, so i have taken simple Task "factorial" program to run in hyper terminal using XSDK. I need to input the number to terminal, so i have used "XUartLite_RecvByte" and "XUartLite_SendByte" function for inputting the Number to Factorial program. Please anyone sort out my problem
Using Kintex 705 and Tera Terminal.

Since i am facing a problem that with foresaid function i can only able to take numbers from 0~9.Is there anyway to take inputs >9?

Using Kintex 705 and Tera Terminal. I need to enter above 9 in the terminal.


Its showing wrong result.

Source code


Code:
int main()
{
    int i;
    uint32_t fact=1;
    u8 N;
init_platform();
//XFact Xfactorial;
//XFact  *xfactptr=&Xfactorial;
//XFact_Initialize(xfactptr,XPAR_FACT_0_DEVICE_ID);
print("\r\n----\r\nFactorial Function\n\r");

N= XUartLite_RecvByte(0x40600000);
         XUartLite_SendByte(0x40600000,N);
         xil_printf("\r\n\r");

 for(i=1;i<=N;i++)
        {
    fact =fact*i;
    XUartLite_SendByte(0x40600000,fact);
    xil_printf("Factorial is %d\r\n", fact);
        }
//XUartLite_SendByte(0x40600000,fact);
    //xil_printf("\n ");
cleanup_platform();
return 0;
}
 

Attachments

  • Error Report.PNG
    Error Report.PNG
    52.7 KB · Views: 75

A few replies to Thaus' post were deleted as they were no longer relevant to the discussion after their thread was merged with this existing thread involving the same identical problem.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top