Learn to use 16F628A on ADC, EB005 display control an output

A collection of posts and articles on getting started in Flowcode v6

Moderator: Benj

Post Reply
skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Learn to use 16F628A on ADC, EB005 display control an output

Post by skquah »

Hello, all
1) I am a starter on V6 flowcode and has litter knowhow about ADC and EB005 display on V6 flowcode.. I wish to learn more how
to use the ADC, EB005 display to control an output of a heater device..
2) I have read thru' from forum LM34 Temp. sensor in year Oct. 2013 by Bill Felker, Martin and others.. I have downloaded that
file but it is written using V5 flowcode and I find it is difficult for me as a starter to convert it into V6 as there is no ADC and
EB005 display module in the dashboard panel and connection made to chip..
3) Can anyone write a simple demonstration V6 flowcode to educate me on chip 16F628A with ADC ( represent LM35), EB005 display
to control an output .. I will be using LM35 Temperature sensor for the Celcius application..
4) Many thanks to those whose can help me to move on to flowcode learning ..

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by kersing »

Have you found the Flowcode Learning Centre and more specifically Flowcode beginners course? Those resources should help you get started with the basics.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by skquah »

Thank you...... Kersing
I will go for the learning center to look for the information..

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by skquah »

Hello, Kersing and all
1) I have went to the learning center help and I have found one video tutorial regarding LM35 with ADC and LCD display..
2) I have learnt about the flowcode on the above topic and I have started to write with V6 with chip 16F628A..
3) I have few questions right now that I need help as a beginner to move on.. I am attaching my v6 flowcode file
for your help and correction..
i) Why the ADC _base component cannot be connected to chip.. I notice there is no function when I try to connect..
ii) Is there any other similar ADC component available for this v6 version ? If it cannot be connected to chip then
I could not run the flowcode simulation at all..
iii) I notice that the LCD display character and digit is not light up properly at certain cursor..
4) Thanks again, if someone could educate me... Regard.
Attachments
LM35_ADC_Thermometer.fcfx
LM35_ADC_Thermometer_16F628A
(6.37 KiB) Downloaded 532 times

EtsDriver
Posts: 444
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 345 times
Been thanked: 227 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by EtsDriver »

skquah wrote: i) Why the ADC _base component cannot be connected to chip.. I notice there is no function when I try to connect..
ii) Is there any other similar ADC component available for this v6 version ? If it cannot be connected to chip then
I could not run the flowcode simulation at all..
Hi!

You can use simple potentiometer component as your ADC to get readings from the LM35. (Inputs(General)-->potentiometer(color))
lcd component_messing..JPG
(166.8 KiB) Downloaded 3496 times
EtsDriver wrote:Then now i took a look, seems that the PIC16F628A you are using is somehow messed up.... Maybe Matrix team can help here? (If you point in chip window the A port pins, it shows like the LCD is connected to them?)

See Martins answer below. :)
skquah wrote: iii) I notice that the LCD display character and digit is not light up properly at certain cursor..
If you are reffering to the ASCII 233, it might be empty? I personally use usually the ' character to implement degrees :) Like 25,6'C .

I attach also one re-created using 16F877A. This lets your try out in simulation what your program does. :)
Attachments
LM35_reconstruct_877A.fcfx
(6.72 KiB) Downloaded 493 times
LM35_ADC_Thermometer.fcfx
(6.7 KiB) Downloaded 489 times
Last edited by EtsDriver on Tue Aug 02, 2016 3:36 pm, edited 1 time in total.
Ill just keep the good work up!

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by medelec35 »

Hi skquah,
16F628A does not have any inbuilt ADC, therefore you cant use any of the potentiometers within Flowcode.
You will need to change your target device for one which does have ADC converters.
You can use Microchip Advanced Part Selector
Un-slect 16 & 32bit devices.
Or
Steve's Flowcode Pic List for selecting a more suitable device.
Once you have done that we can assist you further.
skquah wrote: iii) I notice that the LCD display character and digit is not light up properly at certain cursor..
If you are referring to Print ASC(223) that is because the char is built in to the LCD char set of your hardware and I believe it can be different depending on microcontroller.
I does show a superscript o on the hardware, just not on the simulator.

Martin

Edit.
Post crossed with EtsDriver.
Martin

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by skquah »

Hello, Martin and all
1) Thank you for the info. regarding the 16F628A that is not suitable for this ADC application.. There is no ADC available for
this chip.. Thank you for your 16f877A tutorial file for me to try out..
2) I have learnt regarding the ADC topic.. I have search thru' using this forum on LM35 and LM34 used as a thermometer in Celsius
and Fahrenheit and also accurate temperature thermometer using LM35 by Martin (Forum 2014)..
3) Now, I am trying to construct in v6 flowcode from the learning tutorial using the 16F1827 target chip which has the FVR 1.024v..
a) In my v6 flowcode learning, I am using 2 ADC.. One trim-pot as ADC to set/ adjust the temperature in degree C .. and the other
one as LM35 sensor to sense the output heater surface temperature..
b) On flowcode simulation, I am able to adjust the trim-pot temp. from 0 to 250 degree C ... And for the LM35 sensor, I am able to
make assumption by varying the LM35 sensor to match the set temperature and it is able 'on' then to cut-off the output heater (Led)..
I am happy to go that far..... Now, to go further..... I would like to have the set temperature limit about +/- 3.0 degree, so that
It could allows the heater to perform the 'on and 'off ' control within the set temperature..
4) This is the next task that I need help, if anyone could make alteration and add-in to my flowcode to have the above function..
Thank you in advance.. I appreciate the help to beginner to get thru' this learning on ADC topic to control an output heater.
Regards, skquah..
Attachments
16F1827 Temp Controller.fcfx
16F1827 Temperature controller LM35
(20.17 KiB) Downloaded 488 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by medelec35 »

Hi skquah,
What will be the maximum temperature of the heater?
The pot on max shows 250C yet LM35 only goes to 150C.
If you are looking at higher temperatures than 150C then you should be looking at an alternative temperature sensor.

Martin
Martin

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by skquah »

Hello, Martin and all
1) Actually, my target temperature is at 200 degrees C .. But I also know that LM35 max. temp. is at 150 C max. ..
I could not find any linear sensor beside LM35 that ca go more than 150 C .. So, I construct this flowcode basically is to start learn about
ADC application with flowcode..
2) Since, you have look thru' my application, that is to drive a IR heater of 200 ~ 250 degree which LM35 could not delivered, I would
kindly request if you can provide any suggestion of other sensor that can be used with the ADC flowcode that has a trim-pot (variable resistor)
to set the desire temperature, then the sensor is used to feed back the actual temp. to cut-in and cut-off the IR heater with the range of +/- 4 degree..
3) I hope this topic ADC- flowcode and temperature sensor to control an output IR heater could be a good learning exercise for beginners..
Regard, skquah..

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by medelec35 »

Hi skquah,
You could consider a 100K NTC thermistor?
For example Epcos B57540G1104F can measuring higher temperatures of up to 250C
Luckily Flowcode 6 and above has thermistor component available within the inputs section so should be relatively straight forward to implement.
For learning purposes, it would be best if you added the component yourself and see if you can get flowchart to work.
If you get stuck I can assist further.

Edit: looks like thermistor component only reaches 125C within flowcode simulator, so may have to use look-up table method?

Martin
Martin

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by skquah »

Hello Martin
1) Thanks for your advise to use the 100K NTC thermistor..
2) For my v6 flowcode, I can only find at the input section, there is one Thermistor EBM003 but not Epcos B57540G as you have mentioned..
I used the search window but there is no Epcos B57540G item listing..
3) When I click in this thermistor EBM003 to my dashboard to be used in flowcode, I find there are a few setting in the property
side which I could not understand what it is talking about.. I check the EBM003 user guide, the information does not tell us as
what related to the property setting.. The user guide just tell us on hardware connection..
4) I need help from you on this thermistor component and its property setting to be connected to my flowcode function.. Thank you
so much, if you could provide this help for my learning.. Regard... skquah

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by medelec35 »

Hi skquah
skquah wrote:there is one Thermistor EBM003
That's the one. It's general for all thermistors so long as you have the datasheet and enter requested values.
I only quoted Epcos B57540G so you can look it up to see if suitable then perhaps purchase one.
Other sensors like RTD or thermocouples that can measure over 200C normally require signal processing so makes hardware more complex.

If you do some research on what sensor will be suitable for you, then can help you further.
skquah wrote:I need help from you on this thermistor component
I stated earlier I could not get that component to work above 125C even after setting high limit to 250
Maybe Leigh would more about it?

Martin
Martin

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: Learn to use 16F628A on ADC, EB005 display control an ou

Post by LeighM »

Hi skquah

The EBM003 component has help tips that appear when you hover on any property.

The component calculates the temperature of the thermistor by using an ADC to read the voltage from the potential divider created by connecting the thermistor in series with a fixed value resistor. In the component properties the value of the fixed resistor is entered into the RESISTOR property, and the resistance values of the thermistor at various temperatures is entered in the properties labelled M25 to P125, where M25 is the thermistor resistance at minus 25 and P125 is the thermistor resistance at 125 degrees (positive).
Hence this component, at the moment, only works up to 125 degrees.

The component creats a table of expected ADC values, called sample points, for each of those temperatures.
SamplePoints[0] = ((M25 * (1 << ADC_BITS)) / (RESISTOR + M25))
SamplePoints[1] = ((P0 * (1 << ADC_BITS)) / (RESISTOR + P0))
SamplePoints[2] = ((P25 * (1 << ADC_BITS)) / (RESISTOR + P25))
SamplePoints[3] = ((P50 * (1 << ADC_BITS)) / (RESISTOR + P50))
SamplePoints[4] = ((P75 * (1 << ADC_BITS)) / (RESISTOR + P75))
SamplePoints[5] = ((P100 * (1 << ADC_BITS)) / (RESISTOR + P100))
SamplePoints[6] = ((P125 * (1 << ADC_BITS)) / (RESISTOR + P125))

Then when the temperature is to be read, the ADC value is taken and then compared with each of the sample points in turn. If it is between two points then it calculates the gradient between the two and calculates the approximated temperature. This method is called linear interpolation.
Maybe you could do something similar but extend the sample point table to 250?

Hope that helps
Leigh

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by skquah »

Hello, Martin, Leigh and all
1) Thanks Leigh for your thermistor component table and info. I appreciate that..
2) I have put the thermistor component into my flowcode and I have make some alteration in the calculation icon to match the
(i) the trim-pot set temp. and (ii) The thermistor readout temp. .. This is base on the max. temp. of 125 degree C..
Now when I run the simulation, I could set the desire temperature and when I moved the thermistor sense temp. to match the set temperature,
it is able to cut-off my output IR heater.. This seems I have met my first objective.. So far so good..
3) The second objective, that is to set the lower and upper limit of the set temperature ( temp. range).... I am, of no idea of how to write the
flowcode to control this limit .. I need help on this to move on..
4) I am attaching my flowcode file and wish someone could alter the flowcode and educate me..
Attachments
16F1827 Temp Controller Thermistor.fcfx
Thermistor temp. controller
(19.75 KiB) Downloaded 413 times

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an ou

Post by AbhijitR »

Hi! Martin
medelec35 wrote:
Other sensors like RTD or thermocouples that can measure over 200C normally require signal processing so makes hardware more complex.

If you do some research on what sensor will be suitable for you, then can help you further.

Martin
May I request you to help me with the RTD sensor with its analog part, probably using the Op-amp if I have not mistaken. I tried to learn as much as possible from the internet, about sensing the PT100 resistance using resistance bridge and finally achieving 0-5V DC to work further with the ADC, but unfortunately did not go well, if you have worked earlier with PT100 sensor is it possible for you to shed some light over it.

Thank you, hear you really soon.

Regards
Abhi

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: Learn to use 16F628A on ADC, EB005 display control an output

Post by Benj »

Hello Abhi,

Do you need a wheatstone bridge type arrangement for the sensor? If so we have had good results using the HX711 IC and corresponding Flowcode component.
May I request you to help me with the RTD sensor with its analog part, probably using the Op-amp if I have not mistaken. I tried to learn as much as possible from the internet, about sensing the PT100 resistance using resistance bridge and finally achieving 0-5V DC to work further with the ADC, but unfortunately did not go well
Do you want to share your schematic so far and your results, it could be you're on the right lines but encountering a minor problem that could be fairly easily solved with a small tweak.

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an output

Post by AbhijitR »

Hello! Ben

Many thanks for your quick reply, to be honest with you I have practically not worked on any circuit till now, but studied few, the ideas or circuits are from reliable sources though I was not affirmative (may be because I am not good on that) so still did not gave a try (I have ordered the necessary components waiting to receive the package) attached are couple of documents which I thought might be good one but still wanted to get sure from someone if I am on the right track, like the proverb It is better to hear "Straight from the Horse's Mouth". :)

May I request you to check the attached documents.

Thank you.

Regards
Abhi
Attachments
TIDU969.pdf
(1.18 MiB) Downloaded 208 times
2659.pdf
(8.32 KiB) Downloaded 179 times

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an output

Post by AbhijitR »

Hello! Ben
Good morning

A gentle reminder regarding my above post.

Thank you, hear you soon.

Regards
Abhi

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: Learn to use 16F628A on ADC, EB005 display control an output

Post by Benj »

Hi Abhi,

I don't think I'm the best person to be giving op amp advise. The circuits look ok to me but analogue circuitry is not my strongest.

It might be best to rig up the circuit using breadboard and playing around with it until it's working as you require. That's probably what I would do to come up with a good solution.

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an output

Post by AbhijitR »

Hi! Ben

Okay, even I see that is the only option left, I will give a try this week if I am successful I shall keep you posted may be it will be useful for someone later.

Thank you.

Regards
Abhi

v.rajaji
Posts: 12
Joined: Wed Sep 18, 2019 9:46 am
Been thanked: 1 time
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an output

Post by v.rajaji »

Hi Abhijit
Have you had success with RTD?

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an output

Post by AbhijitR »

Hello! Raja

Kindly excuse for the delayed reply, to be honest I did not notice.

As per my knowledge, may be I am wrong but while working with RTD it is better to use the hardwired sensing (using OpAmp or dedicated chips) and then process the remaining.

Regards
Abhi

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Learn to use 16F628A on ADC, EB005 display control an output

Post by Steve001 »

Evening

Just seen this post, maybe this will help

http://ww1.microchip.com/downloads/en/a ... 00687c.pdf

Steve
Success always occurs in private and failure in full view.

Post Reply