- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'd like to translate KBA94460 into Japanese.
moto
Original KBA: KBA94460
Displaying a Float Value on LCD Using PSoC® 3 or PSoC 5LP – KBA94460
Translated by: MoTa_728816
==============================
タイトル: PSoC® 3 or PSoC 5LP を使用して LCD に浮動小数点の値を表示する - KBA94460
ヴァージョン: **
質問:
PSoC 3 または PSoC 5LP を使用して浮動小数点の値をアスキーに変換して LCD に表示するのにはどうしたら良いですか?
回答:
浮動小数点の値を LCD に表示するためには、まず sprintf 関数を使用して浮動小数点の値を文字列に変換する必要があります。
以下のコードスニペットを使用して浮動小数点の値 (例えば -1.2345) を LCD に表示します。
#include <project.h>
#include <stdio.h>
int main() {
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
char tstr[16];
float compValue = -1.2345;
LCD_Start();
LCD_Position(0,0);
sprintf(tstr, "%+1.4f", compValue ); //converts floats to ASCII and stores it in char array tstr LCD_PrintString(tstr);
for(;;) {
/* Place your application code here. */
}
}
Note: Using snprintf() like the line below is safer and recommended.
snprintf(tstr, 16, "%+1.4f", compValue );
==============================
8-May-2020
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, Tanaka-san
We receive your translation, it will be published to KBA to Community.
After upload, You will receive the points as the word of KBA.
Due to the current delay of processed work, Please bear with me for the delayed the response.
It could be delayed, but it will be processed soon.
Thanks for your contribution to CDC!
Will keep you update the status.
Thanks,
Jenna Jo