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

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

Which setting? Bytes,Integers, voltages etc etc

Post by JDR04 »

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 321 times

User avatar
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: Which setting? Bytes,Integers, voltages etc etc

Post by Benj »

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.

JDR04
Posts: 271
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

Post by JDR04 »

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: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

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

Post by LeighM »

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.

Post Reply