Hello to all! I fail to temperature data from DS18B20 displayed on the 7-segment LED display. The code is simple. But it does not work. 7-segment display is dark. if deactivates row - DSdata = readtemp, the display starts. Where is the problem?
Sorry, what is the date of the Great Cow BASIC compiler? This is will tell you the version and the build date. In the IDE/SynWrite select IDETools/GCB Tools/GCB Compiler Version
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does this work? Let us just confirm the LED displays work. The sensor will work. Let us isolate the LEDs first. Have tried the Help code? I just adapted to your config - please inspect the sample code for pins out etc.
'This program will count from 0 to 99 on two LED displays
#chip 16F876A, 4
'See 7 Segment Display Overview for alternate ways of defining Ports
#define DISP_SEG_A PORTB.0
#define DISP_SEG_B PORTB.1
#define DISP_SEG_C PORTB.2
#define DISP_SEG_D PORTB.3
#define DISP_SEG_E PORTB.4
#define DISP_SEG_F PORTB.5
#define DISP_SEG_G PORTB.6
'#define DISP_SEG_DOT PORTB.7 ' Optional DP
#define DISP_SEL_1 PORTA.1
#define DISP_SEL_2 PORTA.2
#define DISP_SEL_3 PORTA.3
Do
For Counter = 0 To 99
'Get the 2 digits
Number = Counter
Num1 = 0
If Number >= 10 Then
Num1 = Number / 10
'SysCalcTempX stores remainder after division
Number = SysCalcTempX
End If
Num2 = Number
'Show the digits
'Each DisplayValue will erase the other (multiplexing)
'So they must be called often enough that the flickering
'cannot be seen.
Repeat 500
DisplayValue 1, Num1
Wait 1 ms
DisplayValue 2, Num2
Wait 1 ms
End Repeat
Next
Loop
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First I add #include <ds18b20.h>, Its OK, then I add #define DQ PortC.4, Its OK, but when I add
DSdata = readtemp, then programm stop , and Led display is dark</ds18b20.h>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hallo!! Apologies once again Anobium for my forgetfulness. But my project now have another problem. I use 3 pieces. 7_segmentu displays. Normally, without flashing, shines only the last display. Display 1 and 2 blink with a frequency Which Depend on the repeat cycle time. The display does not blink When the disables ReadDigitalTemp function. :(
If you read the documentation at the head of DS18B20.h file, it says the reading of the value can take up to 750 ms. This long time is why you see a blink.
I don't have an immediate solution. Try increasing the "repeat 50" to "repeat 500" which will make the display time longer.
Second I see a "250 ms" wait at the beginning of the include file DS18B20.h read that could be trimmed. You still would see a blink.
Otherwise we would be talking on creating an interrupt to scan the displays.
I will think on it. I have to go for now.
BR
M
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I want this LED display also use for other information indicating. Where data will be received from another microcontroller via USART interface, in 1 byte form. I do not know IF it will be Possible IF now the cycle is Interrupted for reading DC18b20 ..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ReadDigitalTemp appears to be a "blocking command". This means that the PIC cannot refresh the display from the time that ReadDigitalTemp is called until the time that it completes. This time could be up to 750ms. You have several options.
Use an analog temperature sensor that provides instant readings
Use a separate microcontroller for the DS18B20 and poll that controller via USART for saved temperature data.
Use a display that does not need constant refreshing
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello to all! I fail to temperature data from DS18B20 displayed on the 7-segment LED display. The code is simple. But it does not work. 7-segment display is dark. if deactivates row - DSdata = readtemp, the display starts. Where is the problem?
Which release please? Version of the Great Cow BASIC installation please.
SynWrite 6.22.2290
Sorry, what is the date of the Great Cow BASIC compiler? This is will tell you the version and the build date. In the IDE/SynWrite select IDETools/GCB Tools/GCB Compiler Version
Anobium, the answer is correct?
I think not.
It should be something like 0.96.01a 2017-02-20
0.97.01 2017-02-20
Have a look a the code in the Help, section DisplayValue.
I have just tried the first code example and that works for your chip.
As you are multiplexing you may need to add the code
Anobium, I tried the following:
The result is the same :(
I do not know what to do :(, maybe with the GCB is not possible to indicate the temperature on the LED 7-segment display?
Does this work? Let us just confirm the LED displays work. The sensor will work. Let us isolate the LEDs first. Have tried the Help code? I just adapted to your config - please inspect the sample code for pins out etc.
I checked earlier. I now have checked with your code. LED Display Works!
Now add the sensor - I would do it slower. One piece at a time, the includes, the port etc etc. Slowly, slowly is better than big attempt.
Good luck.
First I add #include <ds18b20.h>, Its OK, then I add #define DQ PortC.4, Its OK, but when I add
DSdata = readtemp, then programm stop , and Led display is dark</ds18b20.h>
ohhhh. Change = readtemp to a constant number, like DSdata = 50. This should proove the LEDs are working OK.
Let us know all is good with this test.
If this is good. Check the sensor configuration.
This test is good.
How to I can check The sensor config?
Check your config.
Thank Anobium. I forgot I was on a resistor :( Sorry
But later I still have a lot of questions about this project.
Hallo!! Apologies once again Anobium for my forgetfulness. But my project now have another problem. I use 3 pieces. 7_segmentu displays. Normally, without flashing, shines only the last display. Display 1 and 2 blink with a frequency Which Depend on the repeat cycle time. The display does not blink When the disables ReadDigitalTemp function. :(
Greetings JANIS,
If you read the documentation at the head of DS18B20.h file, it says the reading of the value can take up to 750 ms. This long time is why you see a blink.
I don't have an immediate solution. Try increasing the "repeat 50" to "repeat 500" which will make the display time longer.
Second I see a "250 ms" wait at the beginning of the include file DS18B20.h read that could be trimmed. You still would see a blink.
Otherwise we would be talking on creating an interrupt to scan the displays.
I will think on it. I have to go for now.
BR
M
Anobium already said that need "repeat 500"
. But the display also flashes.
I want this LED display also use for other information indicating. Where data will be received from another microcontroller via USART interface, in 1 byte form. I do not know IF it will be Possible IF now the cycle is Interrupted for reading DC18b20 ..
Display 1 and 2 blinking at intervals for about 3 seconds, the display 3 - OK.
ReadDigitalTemp appears to be a "blocking command". This means that the PIC cannot refresh the display from the time that ReadDigitalTemp is called until the time that it completes. This time could be up to 750ms. You have several options.