I want to use the DS18B20 sensor for a thermometer. I have reviewed the example from the wiki and created an environment to test.
I have created a Float type variable to see the temperature but in the simulation the variable is always at 0.
Can you tell me what I'm doing wrong?
Sensor DS18B20
-
- Posts: 123
- http://meble-kuchenne.info.pl
- Joined: Thu Oct 14, 2021 10:04 am
- Has thanked: 50 times
- Been thanked: 4 times
Re: Sensor DS18B20
Hi Carmelo,
First you need to Link the DS18B20 component to the One Wire component as below:
Next add your variable 'Temperatura' to the Return Value :(Float) under DS18B20 Component properties:
It is also good practice to Initialise the One Wire component.
KR
Martin
First you need to Link the DS18B20 component to the One Wire component as below:
Next add your variable 'Temperatura' to the Return Value :(Float) under DS18B20 Component properties:
It is also good practice to Initialise the One Wire component.
KR
Martin
Re: Sensor DS18B20
Hi Carmelo,
Attached is a copy of your flow chart amended with the changes listed in my previous post.
Good luck with your project.
Martin
Attached is a copy of your flow chart amended with the changes listed in my previous post.
Good luck with your project.
Martin
- Attachments
-
- Test_DS18B20_fixed.fcfx
- (11.12 KiB) Downloaded 23 times
-
- Valued Contributor
- Posts: 1575
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 561 times
Re: Sensor DS18B20
Hi
Just to add that as you are using an internal oscillator so you will need to add in a C-code block as your first iscon for this to run in hardware. Add the IntOsc component and it will help you.
Regards
Just to add that as you are using an internal oscillator so you will need to add in a C-code block as your first iscon for this to run in hardware. Add the IntOsc component and it will help you.
Regards
Re: Sensor DS18B20
Fhanks for the response.Arix wrote: ↑Sat Mar 22, 2025 7:40 amHi Carmelo,
First you need to Link the DS18B20 component to the One Wire component as below:
Link.jpg
properties.jpg
Next add your variable 'Temperatura' to the Return Value :(Float) under DS18B20 Component properties:
Value.jpg
It is also good practice to Initialise the One Wire component.
KR
Martin
I knew about the float variable but I forgot and I didn't know about linking the bus to the sensor, hence the question.
C.
Re: Sensor DS18B20
thanks for the response.chipfryer27 wrote: ↑Sat Mar 22, 2025 8:14 amHi
Just to add that as you are using an internal oscillator so you will need to add in a C-code block as your first iscon for this to run in hardware. Add the IntOsc component and it will help you.
Regards
I also know about the internal oscillator block, but since it is a test to see how it works I didn't take it into account.
C.
-
- Valued Contributor
- Posts: 1575
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 561 times
Re: Sensor DS18B20
Hi
"since it is a test to see how it works I didn't take it into account"
I frequently do the same as I am more interested in something specific rather than "the project", and I find FC simulation a great feature. I sometimes move on to Ghost when testing in hardware which again can be very helpful.
Regards
"since it is a test to see how it works I didn't take it into account"
I frequently do the same as I am more interested in something specific rather than "the project", and I find FC simulation a great feature. I sometimes move on to Ghost when testing in hardware which again can be very helpful.
Regards
Re: Sensor DS18B20
I already finished the program, except for one issue that I will try to resolve later.
But what has been done so far should work because I have been physically testing it in parts and the result is good.
When adding the temperature reading part, when compiling I get problems that appear in the attached file that cannot be interpreted.
Can you tell me what the problem is so I can solve it?
C.
But what has been done so far should work because I have been physically testing it in parts and the result is good.
When adding the temperature reading part, when compiling I get problems that appear in the attached file that cannot be interpreted.
Can you tell me what the problem is so I can solve it?
C.
- Attachments
-
- Termostato_10_90.msg.txt
- (6.02 KiB) Downloaded 18 times
-
- Termostato_10_90.fcfx
- (142.3 KiB) Downloaded 24 times
-
- Valued Contributor
- Posts: 1575
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 357 times
- Been thanked: 561 times
Re: Sensor DS18B20
Hi
I think you have ran out of memory.
I see you are using multiple 7-Segment displays and you have multiple macros that are used to display each individual number. That's ten sections of code that could perhaps be reduced by using one of the 7-Segment Display components.
Regards
I think you have ran out of memory.
I see you are using multiple 7-Segment displays and you have multiple macros that are used to display each individual number. That's ten sections of code that could perhaps be reduced by using one of the 7-Segment Display components.
Regards
Re: Sensor DS18B20
Thanks for clarifying the error Martin,chipfryer27 wrote: ↑Sat Mar 22, 2025 1:57 pmHi
I think you have ran out of memory.
I see you are using multiple 7-Segment displays and you have multiple macros that are used to display each individual number. That's ten sections of code that could perhaps be reduced by using one of the 7-Segment Display components.
Regards
I will change the pic model to 16F886.
Regarding the use of the 10 macros to represent the numbers, I have not used the component macro because after many tests with its use (I already made queries in another topic "Problems with a 7-segment display"), I have not been able to make it work for me.
What I need to add to the program is an improvement and no matter how many times I go around I can't find the solution:
I would like that within the "adjust tHi and tLo" macro, the digit on which the adjustment is being made is flashing and the other 2 digits remain fixed.
Any suggestions on how to implement that functionality?
Thanks in advance for your time.