We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for
Did you mean:
Visitor
4,203 Views
Registered: ‎11-11-2009

## problem taking input from hyperterminal-help!!!

i am using EDK 10.1 and Spartan 3E

i had written a very basic code to take two integers from the user and display the sum. the code looks something like this

#include "stdio.h"

int main(void)

{

int a,b,c;

xil_printf("enter the first no:");

scanf("%d",&a);

xil_printf("enter the second no:");

scanf("%d",&b);

c=a+b;

xil_printf("result is %d",c);

return(0)

}

the hyperterminal receives the first no. but does not accept the second no and the result displayed is a garbage no.

I dont  know what the problem is.pls help

4 Replies
Highlighted
Scholar
4,196 Views
Registered: ‎08-21-2008

## Re: problem taking input from hyperterminal-help!!!

Hello.

Try this code and also compare your code with this.

*********************************************************

#include "xuartlite_l.h"
#include "xio.h"

main()
{
Xuint8 data1,data2,sum;

xil_printf("\n\rEntering MAIN\n\r");
while(1)
{

sum = data1+data2
xil_printf("\nSUM=0x%x", sum);
}
}
Best of luck.
--
Unlimited in my Limits.
Visitor
4,124 Views
Registered: ‎11-11-2009

## Re: problem taking input from hyperterminal-help!!!

Hey

Thanks alot tat code worked out for us .

I have one more doubt for - are pointers acceptable in sdk? We are workin on Hauffman codec for which we need to creat trees and so we need pointers. Can u pls throw some light on this problem.

Thank you.

Scholar
4,121 Views
Registered: ‎08-21-2008

## Re: problem taking input from hyperterminal-help!!!

Hello.

As far as pointers are concerned its a feature of C language.

SDK supports C so i don't think there is any point for unacceptance of pointers in SDK.

Pointers are not tool dependent.

Although i haven't used SDK much but its logical.

Message Edited by prateek_bhatt on 11-21-2009 12:55 AM
Best of luck.
--
Unlimited in my Limits.
Visitor
4,110 Views
Registered: ‎07-31-2009

## Re: problem taking input from hyperterminal-help!!!

Pointer can be used for sure, I am using it. Please note that once you use malloc() function or c++ new operation, be sure that the heap size is set correctly in the linker script so that you can manage the memory.