- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Kenshow-san
Sorry that this candidate is wrongly added.
Would you consider to translate other one?
Below is new candidate.. If you'd like to take, please document a new thread.
Displaying a Floating Point Number
printf / scanf functions in Imagecraft compiler
Thanks
Jenna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jenna-san,
Japanese translation was over.
Please check below.
Original KBA:
Displaying a Float Value on LCD Using PSoC® 3 or PSoC 5LP – KBA94460
Thanks.
==============================
タイトル: PSoC®3またはPSoC 5LPを使用してLCDに浮動小数点値を表示 – KBA94460
バージョン:**
質問:
浮動小数点値をASCIIに変換し、PSoC 3またはPSoC 5LPを使用してPSoC CreatorのLCDに表示するにはどうすればよいでしょうか?
回答:
LCDに浮動小数点値を表示するには、最初にsprintf関数を使用して浮動小数点値を文字列に変換する必要があります。
次のコードスニペットを使用して、LCDに浮動小数点値(たとえば-1.2345)を表示します。
#include <project.h>
#include <stdio.h>
int main(){ /* ここに初期化/起動コードを配置します(例:MyInst_Start())*/
char tstr [16];
float compValue = -1.2345;
LCD_Start();
LCD_Position(0,0);
Sprint(tstr,"%+ 1.4f", compValue); // floatをASCIIに変換し、char配列に格納します
tstr LCD_PrintString(tstr);
for(;;){ /* ここにアプリケーションコードを配置します */ }
}
==============================
1-Sept-2020