20151208-5:print.h和timer
2018-11-13 本文已影响0人
skylaugher
一、print.h (xc)
函数名 | 描述 |
---|---|
int printchar(char value) | Prints a character. return The number of characters printed, or -1 on error. |
int printcharln(char value | Prints a character followed by a new line. |
int printint(int value) | Prints a value as a signed decimal. |
int printintln(int value) | Prints a value as a signed decimal followed by a newline. |
int printuint(unsigned value) | Prints a value as a unsigned decimal |
int printuintln(unsigned value) | Prints a value as a unsigned decimal followed by a newline |
int printllong(long long value) | Prints a long long value as a signed decimal. |
int printllongln(long long value) | Prints a long long value as a signed decimal followed by a newline |
int printullong(unsigned long long value) | Prints a long long value as a unsigned decimal |
int printullongln(unsigned long long value) | Prints a long long value as a unsigned decimal followed by a newline |
int printhex(unsigned value) | Prints a value as a unsigned hexadecimal.The upper-case letters \p ABCDEF are used for the conversion. |
int printhexln(unsigned value); | Prints a value as a unsigned hexadecimal followed by a newline.The upper-case letters \p ABCDEF are used for the conversion. |
int printllonghex(unsigned long long value); | Prints a long long value as a unsigned hexadecimal. The upper-case letters \p ABCDEF are used for the conversion. |
int printllonghexln(unsigned long long value); | Prints a long long value as a unsigned hexadecimal followed by a newline.The upper-case letters \p ABCDEF are used for the conversion. |
int printbin(unsigned value); | Prints a value as an unsigned binary number. |
int printbinln(unsigned value); | Prints a value as an unsigned binary number followed by a newline. |
printstr(const char (& alias s)[]) | Prints a null terminated string. |
二、timer.h延时函数及timerafter写的延时功能块
函数名 | 描述 |
---|---|
void delay_ticks(unsigned ticks); | Pause the calling task for the specified number of reference clock ticks. |
void delay_ticks_longlong(unsigned long long ticks); | Pause the calling task for the specified number of reference clock ticks |
inline void delay_seconds(unsigned int delay) | Pause the calling task for the specified number of seconds. |
inline void delay_milliseconds(unsigned delay) | Pause the calling task for the specified number of milliseconds. |
inline void delay_microseconds(unsigned delay) | Pause the calling task for the specified number of microseconds. |
三、用print跟踪app_usb_aud_xk_216_mc项目
在audio()函数前加入print语句,如果没有打开XScope下的Real-Time mode,那么运行时不能在console上看到打印信息。而打开Read-Time XScope mode后,在可以在console上看到打印信息
thread_speed();
printstrln("audio"); //print语句加在这儿
audio(AUDIO_CHANNEL,
clip_image002.jpg
原因可能是因为并行机制、实时性强导致打印语句不能很好得到执行。普通情况下打印语句是费时操作,而在xscope模式下,print机制已经与普通的print机制不同。在文档xTIMEcomposer user guide的第25部分Debug with printf in real-time中有说明。