Hi Ben
I need to create a string what is always 2char long. I need to show time on a Display. I wrote a text to Display macro.
it should be like this
sprintf(FCV_TEXT2DISPLAY," %x", 15); // result "15"
sprintf(FCV_TEXT2DISPLAY," %x", 2); // result "02"
But I just cachet a lot of errors.....
Can You help me to use printf or sprintf.....
sprint or how to create a string
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: sprint or how to create a string
Hello,
It looks like your using Flowcode from your variable names.
I would do this and this will then simulate and compile to hardware.
sprintf is a very large function used a lot on computers as it is very powerful but due to its power it's a very large function. Embedded compilers may not support it out the box. Some do but probably not all.
It looks like your using Flowcode from your variable names.
I would do this and this will then simulate and compile to hardware.
Code: Select all
Text2Display = ToString$( Number )
If (Number < 10)
Text2Display = "0" + Text2Display
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: sprint or how to create a string
If I put the code in "C-Code" ==> Error with Tostring$
If I put the code in "Calculation" ==> Error with IF
What if I put the code in simulate?
If I put the code in "Calculation" ==> Error with IF
What if I put the code in simulate?
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: sprint or how to create a string
Hi Ben
Ok I solved it...
Can I show text in the simulation on 100x32 pixel Display?
Ok I solved it...
Can I show text in the simulation on 100x32 pixel Display?