Hello to all!
I want to make a thermometer using the DS18B20 digitalo temperature sensor. My code works only in positive values. When the temperature falls below 0, no numerical values appear on the 7 segment display. The second question -
How can a minus sign be displayed on a 7-segment display, then, when the variable value sign=1 ?
Do you get negative values on a serial terminal? Use the demos in this folder to show how to send to a serial terminal - \GCB@Syn\GreatCowBasic\Demos\Temperature Sensor Solutions\DS18B20 Sensor Solutions\Sensor to Hardware Serial Terminal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Not. Negative temperature values must be indicated on the same 7-segment display.Now you can not see temperature values below 0 degrees on the 7-segment display. Just when indicate negative values , then in 1 segment indicate ' - ' sign.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I mean the code that shows the results on a serial terminal. I want to check the results are negative - you may already know the sensor and the results are negative - so, I wanted to check the results on a serial terminal. This is the program I wanted to see.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It looks like DSint returns a negative number if the temperature is below zero. That's why nothing displays. You need to convert it back to a positive number:
DSint = DSint * -1
Last edit: Joseph Realmuto 2017-08-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Joseph, Not working your suggestion :(. I tried another day to connect the LCD display and read the values.Then I give a message. I do not know how to do this differently.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Negative numbers are represented in two's complement plus one format. For example, -1 is really 65535, -2 is 65534, and so forth. When you subtract from zero, you should end up with the correct positive number.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There are two undocumented ascii characters for the 7 segment display, space and minus ( 32 and 450. Otherwise the DisplayChar function must be a letter or number.
GL
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello to all!
I want to make a thermometer using the DS18B20 digitalo temperature sensor. My code works only in positive values. When the temperature falls below 0, no numerical values appear on the 7 segment display. The second question -
How can a minus sign be displayed on a 7-segment display, then, when the variable value sign=1 ?
Do you get negative values on a serial terminal? Use the demos in this folder to show how to send to a serial terminal - \GCB@Syn\GreatCowBasic\Demos\Temperature Sensor Solutions\DS18B20 Sensor Solutions\Sensor to Hardware Serial Terminal
Not. Negative temperature values must be indicated on the same 7-segment display.Now you can not see temperature values below 0 degrees on the 7-segment display. Just when indicate negative values , then in 1 segment indicate ' - ' sign.
You are not getting negative numbers on a Serial terminal? Can you attached your source code?
I have published a code. Do you not see the code , Anobium?
I mean the code that shows the results on a serial terminal. I want to check the results are negative - you may already know the sensor and the results are negative - so, I wanted to check the results on a serial terminal. This is the program I wanted to see.
I do not understand why serial code is needed? I do not have that. :(
I would guess that the Serial code is needed to determine where the error might be.
If the result displays as Negative on the Serial Terminal, it confirms that the temperature reading is correct and the display output needs debugging.
Conversely if the terminal is not showing a negative then the fault lays in the sensor reading not the display.
It is structured debugging, break the system into logical blocks and test each until you narrow down the course of the problem.
Hope that helps.
Cheers
Chris
For the sign just do this instead:
It looks like DSint returns a negative number if the temperature is below zero. That's why nothing displays. You need to convert it back to a positive number:
Last edit: Joseph Realmuto 2017-08-24
Joseph, Not working your suggestion :(. I tried another day to connect the LCD display and read the values.Then I give a message. I do not know how to do this differently.
Try this instead:
Negative numbers are represented in two's complement plus one format. For example, -1 is really 65535, -2 is 65534, and so forth. When you subtract from zero, you should end up with the correct positive number.
Try dim var as integer...works for +- 32767.
Hey , Thank you all!
! Joseph Realmuto, Yessss DSint = 0 - DSint works!
But the idea of minus '-' sign is not working. :(
JANIS,
You are looking for how to display a '-' on a 7 segment display?
Use:
There are two undocumented ascii characters for the 7 segment display, space and minus ( 32 and 450. Otherwise the DisplayChar function must be a letter or number.
GL
Mike
Thanks, mmotte! Super working now.
Then, when the code will fully ready, I'll post. I think that someone might be interested.