USBCDC print string

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USBCDC print string

1,039件の閲覧回数
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 返答(返信)

997件の閲覧回数
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 件の賞賛
返信

997件の閲覧回数
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 件の賞賛
返信