Home
フォーラム
Coron質問
ハイパーターミナルからデー...
引用付き投稿返答 :ハイパー...
Android事業
実績紹介
製品紹介
フォーラム
会社概要
お問い合わせ
メインメニュー
Home
Android事業
Android+Robot
GDD2011出展
Android アプリ開発
ロボット事業
製品情報
Go Simulation!
Coroid
Coron
フォーラム
ショップ
会社概要
会社情報
アクセス
採用情報
サイトマップ
ログイン
社長ブログ
引用付き投稿返答 :ハイパーターミナルからデータ受信する方法
ユーザー名
件名:
post_text_textarea
[admin2 2009-12-21 10:41:03]:
>char USB_getc(char wf )とchar USB_gets(char *buf) <p>の使い方教えてください。 </p><p> _</p><p>以下、USB_getcを使った簡単な例です(※v2.0.4のEx04_USB_COMから一部抜粋)。</p><p>USB_pets(char *buf);</p><p>の場合は、</p><p>char s[20]; //文字列を格納するバッファ</p><p>USB_gets(s); //文字列受信(待機無し)</p><p>//USB_getr(s,10); //10文字受信するまで待機 </p><p>のように使います。</p><p> </p><p> </p><p>//===================================================================<br />// Includes<br />//===================================================================<br />#include "stm32f10x_lib.h" //STマイクロライブラリ<br />#include "coron_lib.h" //Coron専用ライブラリ</p><p>//===================================================================<br />// main関数<br />//===================================================================<br />int main(void){<br /> int n=0; //受信回数n<br /> char buf; //1Byte受信バッファ<br /> <br /> coron_init(); //Coron初期化(※機能はcoron_conf.hで指定)<br /> <br /> //無限ループ<br /> while(1){<br /> buf=USB_getc(1); //1Byte受信 (1)→受信待機する (0)→受信待機しない<br /> n++; //受信回数nをカウント+1<br /> USB_putn(n,3); //受信回数nを表示 (3)→3桁で表示(000~999)<br /> USB_puts(" USB_getc = ["); //文字列送信<br /> USB_putc(buf); //1Byte送信<br /> USB_puts("]\r\n"); //文字列送信 <br /> }<br /> return 0;<br />}</p><p>/**********************************************************************/<br />/* <USB CDC関連> (coron_printf.c&h) */<br />/**********************************************************************/<br />/*<br /> void USB_putx(u32 num,char len); //16進数出力(数値、表示桁数)<br /> void USB_putn(s32 num,char len); //10進数出力(数値、表示桁数)</p><p> void USB_putc(char data); //1文字出力<br /> void USB_puts(char* buf); //文字列出力<br /> void USB_putd(char* buf,char len); //指定数文字列出力(文字列、文字数)</p><p> char USB_getc(char wf); //1文字入力(0:受信待ち無し 1:受信待ち有り)<br /> char USB_gets(char *buf); //文字列入力<br /> void USB_getr(char *buf,char len); //指定数文字列入力(文字列、文字数)<br />*/</p><p> </p><p>その他、ご不明な点があればお気軽にご連絡ください。</p>
セキュリティ:
プレビュー
保存
キャンセル
引用付き投稿返答 :ハイパーターミナルからデータ受信する方法
User
Powered by
ccBoard