FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-06-2005, 04:13 PM
Patrick
Guest
 
Posts: n/a
Default xil_printf not working as expected

Hello,

i know this is a rather stupid question, but i'm somewhat irritated.

I'm triing to send some data per Uartlite. For normal
characters/strings everything works fine, but if i try to send some
integers or long integers they aren't displayed.

(Short) example:

....

/* global definitions, no pointers */
Xuint32 interrupt_count = 0;
volatile Xuint32 jiffies = 0;

....

/* values incrementd during pit-isr, pit works, pit running at 100HZ
*/
void pit_timer_int_handler(void * baseaddr_p)
{
jiffies++;
interrupt_count++;

XTime_TSRClearStatusBits(XREG_TSR_PIT_INTERRUPT_ST ATUS);
}

....

main(){

/* string displayed correctly */
xil_printf("\r\nRunning Mainloop");

while(1){
sleep(2);
xil_printf("\nLoop");

/* here the values aren't displayed,but the "a"s and "b"s are displayd
*/
xil_printf("\n %l a", i_interrupt_count);
xil_printf("\n %l b", l_interrupt_count);
/* giving the arguments as pointers won't help either */
xil_printf("\n %l a", &i_interrupt_count);
xil_printf("\n %l b", &l_interrupt_count);
}

}


i have tried different compinations with "%d","%D","%l","%ul" or "%c"
as format-strings and different datatypes for the two variables
(unisgned, int, long, unsigned long).

i was looking at the xil_printf sources, too, to see what characters
after "%" are supported.

I'm using an uartlite at 9600 baud, 8 databits, no parity.

So, does someone might have an idea or hint what my mistake is?

Regards
Patrick
Reply With Quote
  #2 (permalink)  
Old 01-06-2005, 06:24 PM
Bo
Guest
 
Posts: n/a
Default Re: xil_printf not working as expected

The xil_printf documentation states:

This function is similar to printf but much smaller in size (only 1KB). It
does not have support for floating point numbers. xil_printf also does not
support printing of long long (i.e 64 bit numbers"This func is similar to
printf but much smaller. It does not have support for floating pt numbers or
long long. "

Try using %d instead of %l and see if you get *something*...



"Patrick" <[email protected]> wrote in message
news:[email protected] om...
> Hello,
>
> i know this is a rather stupid question, but i'm somewhat irritated.
>
> I'm triing to send some data per Uartlite. For normal
> characters/strings everything works fine, but if i try to send some
> integers or long integers they aren't displayed.
>
> (Short) example:
>
> ...
>
> /* global definitions, no pointers */
> Xuint32 interrupt_count = 0;
> volatile Xuint32 jiffies = 0;
>
> ...
>
> /* values incrementd during pit-isr, pit works, pit running at 100HZ
> */
> void pit_timer_int_handler(void * baseaddr_p)
> {
> jiffies++;
> interrupt_count++;
>
> XTime_TSRClearStatusBits(XREG_TSR_PIT_INTERRUPT_ST ATUS);
> }
>
> ...
>
> main(){
>
> /* string displayed correctly */
> xil_printf("\r\nRunning Mainloop");
>
> while(1){
> sleep(2);
> xil_printf("\nLoop");
>
> /* here the values aren't displayed,but the "a"s and "b"s are displayd
> */
> xil_printf("\n %l a", i_interrupt_count);
> xil_printf("\n %l b", l_interrupt_count);
> /* giving the arguments as pointers won't help either */
> xil_printf("\n %l a", &i_interrupt_count);
> xil_printf("\n %l b", &l_interrupt_count);
> }
>
> }
>
>
> i have tried different compinations with "%d","%D","%l","%ul" or "%c"
> as format-strings and different datatypes for the two variables
> (unisgned, int, long, unsigned long).
>
> i was looking at the xil_printf sources, too, to see what characters
> after "%" are supported.
>
> I'm using an uartlite at 9600 baud, 8 databits, no parity.
>
> So, does someone might have an idea or hint what my mistake is?
>
> Regards
> Patrick




Reply With Quote
  #3 (permalink)  
Old 01-07-2005, 01:26 PM
Jon Beniston
Guest
 
Posts: n/a
Default Re: xil_printf not working as expected

%l is for printing longs, not long longs. %ll is typically for long
longs.

Cheers,
JonB.

Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VCS PLI: vpi_put_value not working Yottameter Verilog 2 08-20-2007 06:58 PM
Help: not quite working correctly. Prime Verilog 1 09-13-2005 10:16 PM
Need help: getting 3.1i Coregen working on P4-system [email protected] FPGA 2 08-08-2003 11:47 AM


All times are GMT +1. The time now is 11:53 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved