Float point help!
Float point help!
Hi, I'm registrate user, please post example with convert 0-1023 to 0.00-100.00(2 decimals) use the thermometer and lcd components.Please post the real help for float point instructions and moore examples.Sory for my language.Thanks!!!!
- 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:
Hello Teo
Everything you need to get started with floating point is available from here.
http://www.matrixmultimedia.com/support ... .php?t=505
Try doing a little bit at a time rather then taking on the entire task all at once.
Let me know if you get stuck.
Everything you need to get started with floating point is available from here.
http://www.matrixmultimedia.com/support ... .php?t=505
Try doing a little bit at a time rather then taking on the entire task all at once.
Let me know if you get stuck.
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
- 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:
Hello
Firstly you need to read in the ADC value into an Int variable.
Then you will need to use C code to convert this Int into a float variable.
Then you will have to create a second float variable and assign the value of 10.23.
The you can devide the ADC result variable with the constant variable to get your range of 0 - 100.
You can then multiply the result by 10 to get a range of 0 - 10000. Then convert this variable back into an Int and you can then use flowcode to print out the number.
The 10000 wil represent 100.00
Firstly you need to read in the ADC value into an Int variable.
Then you will need to use C code to convert this Int into a float variable.
Then you will have to create a second float variable and assign the value of 10.23.
The you can devide the ADC result variable with the constant variable to get your range of 0 - 100.
You can then multiply the result by 10 to get a range of 0 - 10000. Then convert this variable back into an Int and you can then use flowcode to print out the number.
The 10000 wil represent 100.00
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
Thank you very much! I declare 'a' int variable and radius = float32_from_int32( a );
and dont work
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:31): error: unknown identifier 'a'
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:29): error: arguments of 'float32_from_int32' don't match the parameters of call
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:11): error: failed to generate expression
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:11): error: invalid operand 'float32_from_int32( a )'
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:9): error: failed to generate expression
float32.c success
please help!
and dont work

C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:31): error: unknown identifier 'a'
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:29): error: arguments of 'float32_from_int32' don't match the parameters of call
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:11): error: failed to generate expression
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:11): error: invalid operand 'float32_from_int32( a )'
C:\Documents and Settings\dumitru.teodor\Desktop\FLOWCODE\float32\float32.c(564:9): error: failed to generate expression
float32.c success
please help!
- 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:
Hello
Ok I can see where your going wrong.
If you create a variable in flowcode eg "a" then the C equivalent of that variable is "FCV_A".
so to clarify
Flowcode variable a becomes C code variable FCV_A
Flowcode variable var1 becomes C code variable FCV_VAR1
etc.
Hope this helps.
Ok I can see where your going wrong.
If you create a variable in flowcode eg "a" then the C equivalent of that variable is "FCV_A".
so to clarify
Flowcode variable a becomes C code variable FCV_A
Flowcode variable var1 becomes C code variable FCV_VAR1
etc.
Hope this helps.
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