Which setting? Bytes,Integers, voltages etc etc

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Which setting? Bytes,Integers, voltages etc etc

Postby JDR04 » Tue Apr 02, 2019 1:37 pm

Hi, the aim of this program is to sense a certain heat or temperature level with a 10K NTC thermistor and then turn on a fan IF the temperature heat level exceeds the set maximum set by the 10K potentiometer.

I've got the circuit working but am wondering if it is best to "read as Voltage" settings for the " thermistor and the Potentiometer. (10K Thermister NTC and 10K Potentiomer used)

It would be great if somebody could explain to me when and why to use intergers, bytes ,read as voltage etc. This would help greatly.

All help and advice is appreciated. I have attached the program. Thanks very much...John
Attachments
12F683 THERMISTOR TEST 1.fcf
(10.5 KiB) Downloaded 46 times

User avatar
Benj
Matrix Staff
Posts: 14371
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4447 times
Been thanked: 4150 times
Contact:

Re: Which setting? Bytes,Integers, voltages etc etc

Postby Benj » Thu Apr 04, 2019 12:17 pm

Hello,

Read as byte returns an 8-bit value in the range 0-255. Useful if you are using limited RAM or want high speed calculations on the value.

Read as int returns a 10-bit (0-1023) or 12-bit (0-4095) reading based on the capabilities of your device. This uses a bit more RAM but has much higher resolution. Again calculations are going to be fairly fast but not as fast as 8-bit (on an 8-bit device).

Read as Voltage does an int read of the ADC and then converts to a floating point voltage. This will use a fair amount of RAM and will also require more processing to perform the floating point maths. However it gives you a real number if you want to display the voltage or do more complex calculations.
These users thanked the author Benj for the post (total 2):
JDR04 (Sat Apr 06, 2019 6:51 pm) • AbhijitR (Mon May 06, 2019 9:31 am)
Rating: 10.53%
 

JDR04
Posts: 264
Joined: Tue Mar 05, 2013 10:49 pm
Has thanked: 111 times
Been thanked: 13 times
Contact:

Re: Which setting? Bytes,Integers, voltages etc etc

Postby JDR04 » Sat Apr 06, 2019 6:53 pm

Thanks benj, so in terms of my program, would you say I have correctly set this up or not?

User avatar
LeighM
Matrix Staff
Posts: 1914
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 460 times
Been thanked: 646 times
Contact:

Re: Which setting? Bytes,Integers, voltages etc etc

Postby LeighM » Mon Apr 08, 2019 8:32 am

Hi,
Your program is going to work, yes, but you now need to think about hardware.
The simplest solution is to use the thermistor in series with another fixed resistor to form a potential divider for the ADC input.
The voltage will be non-linear with respect to the temperature, so you need to look up the resistance/temperature curve for the NTC thermistor and determine the resulting voltage and if the 8 bit resolution (full scale 256 steps) is accurate enough.
i.e. the step size at your threshold temperature.
These users thanked the author LeighM for the post (total 2):
JDR04 (Mon Apr 08, 2019 10:27 am) • AbhijitR (Mon May 06, 2019 9:31 am)
Rating: 10.53%