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_STATUS); }

...

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 to
Patrick
Loading thread data ...

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*...

Reply to
Bo

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

Cheers, JonB.

Reply to
Jon Beniston

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.