Hi all,
my name is Marek. I would like to migrate project for ATmega 32 from BASCOM to GCB, but I cannot see any float procedures.
I want to calculate output power using voltage from ADC :
Power_out = V * V 'P=(kU)(kU)/50=UUk*k/50
Power_out = Power_out * Wspolczynnik ' wspolczynnik = 66.74
Power_out = Power_out * Wspolczynnik
Power_out = Power_out / 50
I have the same problem with V calculation :
V = Vac * 0.004883 , where Vac is a value from ADC register
Is any way to make this calculations in GCB? I found float.h file, but it doesn't work with ATmega32.
Thanks,
Marek
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Great Cow BASIC does not support floats currently.
However, this can be worked around. If you factor up your calcualtions and then factor back down after your long divisions (these after factoring up will be integer) you will get the results you require.
There are many examples of factoring integers to decimals - the DS18B20 is a great example.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How this is finally inplemented depends upon the application. I cannot tell from your code what the final application is. It is to display "power" or is to control the power to a certain device? -- Possibly a porportional control?
What is the source of the voltage to the ADC?
Is the ADC implmented as 8-bit or 10-bit ?
What is the final application?
How much accuracy is required?
How much resoluition is required?
Answer these questions and you can get more detailed help.
William
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
my name is Marek. I would like to migrate project for ATmega 32 from BASCOM to GCB, but I cannot see any float procedures.
I want to calculate output power using voltage from ADC :
Power_out = V * V 'P=(kU)(kU)/50=UUk*k/50
Power_out = Power_out * Wspolczynnik ' wspolczynnik = 66.74
Power_out = Power_out * Wspolczynnik
Power_out = Power_out / 50
I have the same problem with V calculation :
V = Vac * 0.004883 , where Vac is a value from ADC register
Is any way to make this calculations in GCB? I found float.h file, but it doesn't work with ATmega32.
Thanks,
Marek
Hello and welcome,
Great Cow BASIC does not support floats currently.
However, this can be worked around. If you factor up your calcualtions and then factor back down after your long divisions (these after factoring up will be integer) you will get the results you require.
There are many examples of factoring integers to decimals - the DS18B20 is a great example.
Thanks for the explanation. I must analize this example.
How this is finally inplemented depends upon the application. I cannot tell from your code what the final application is. It is to display "power" or is to control the power to a certain device? -- Possibly a porportional control?
What is the source of the voltage to the ADC?
Is the ADC implmented as 8-bit or 10-bit ?
What is the final application?
How much accuracy is required?
How much resoluition is required?
Answer these questions and you can get more detailed help.
William