USBCDC print string

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USBCDC print string

1,116 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by james on Wed Apr 18 03:08:40 MST 2012
Hi guy,

I modified the example in USBCDC to printstring instead of a single char by looping.

void VCOM_putstring(char *pcString)
{
    VCOM_putchar(13);                    //return carriage
    long i = 0;
    // loop through until reach string's zero terminator
    for (i=0;i<strlen(pcString);i++)
    {
        VCOM_putchar(pcString); // print each character
    }
}


However, this only prints up to 120chars into the teraterm. how can i modify it to print a lot more??
0 项奖励
回复
2 回复数

1,074 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by james on Wed Apr 18 19:20:18 MST 2012
Remove the strlen() works like a charm thanks
0 项奖励
回复

1,074 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Wed Apr 18 03:25:33 MST 2012
You need to modify VCOM_putchar so that it will wait for a free place in FIFO instead of exiting with EOF. Be warned that this is not the only problem with CDC sample.

Also, remove that strlen from your code. Check for NUL character instead before printing each char.:rolleyes:
0 项奖励
回复